You've already forked Reprepro-Wrapper
Inital Commit
This commit is contained in:
2
root/DEBIAN/conffiles
Normal file
2
root/DEBIAN/conffiles
Normal file
@@ -0,0 +1,2 @@
|
||||
/etc/reprepro/distributions
|
||||
/etc/reprepro/options
|
||||
10
root/DEBIAN/control
Normal file
10
root/DEBIAN/control
Normal file
@@ -0,0 +1,10 @@
|
||||
Package: reprepro-wrapper
|
||||
Version: 1.0.0
|
||||
Architecture:
|
||||
Installed-Size:
|
||||
Depends: reprepro, gpg
|
||||
Priority: optional
|
||||
Section: misc
|
||||
Homepage: http://www.privlab.it
|
||||
Maintainer: PrivLab <hostmaster@privlab.it>
|
||||
Description: Wrapper for Debian package repository producer
|
||||
64
root/DEBIAN/postinst
Normal file
64
root/DEBIAN/postinst
Normal file
@@ -0,0 +1,64 @@
|
||||
#!/usr/bin/sh
|
||||
|
||||
set -e
|
||||
set -u
|
||||
|
||||
if [ -d '/run/systemd/system' ]; then
|
||||
/usr/bin/systemctl --system daemon-reload > '/dev/null' 2>&1 || \
|
||||
/usr/bin/true
|
||||
fi
|
||||
|
||||
case "${1}" in
|
||||
configure)
|
||||
if [ -x '/usr/bin/deb-systemd-helper' ]; then
|
||||
/usr/bin/deb-systemd-helper unmask 'reprepro-import.path' > '/dev/null' 2>&1 || \
|
||||
/usr/bin/true
|
||||
/usr/bin/deb-systemd-helper unmask 'reprepro-import.service' > '/dev/null' 2>&1 || \
|
||||
/usr/bin/true
|
||||
/usr/bin/deb-systemd-helper unmask 'reprepro-morgue.timer' > '/dev/null' 2>&1 || \
|
||||
/usr/bin/true
|
||||
/usr/bin/deb-systemd-helper unmask 'reprepro-morgue.service' > '/dev/null' 2>&1 || \
|
||||
/usr/bin/true
|
||||
fi
|
||||
if /usr/bin/deb-systemd-helper --quiet was-enabled 'reprepro-import.path'; then
|
||||
/usr/bin/deb-systemd-helper enable 'reprepro-import.path' > '/dev/null' 2>&1 || \
|
||||
/usr/bin/true
|
||||
else
|
||||
/usr/bin/deb-systemd-helper update-state 'reprepro-import.path' > '/dev/null' 2>&1 || \
|
||||
/usr/bin/true
|
||||
fi
|
||||
if /usr/bin/deb-systemd-helper --quiet was-enabled 'reprepro-morgue.timer'; then
|
||||
/usr/bin/deb-systemd-helper enable 'reprepro-morgue.timer' > '/dev/null' 2>&1 || \
|
||||
/usr/bin/true
|
||||
else
|
||||
/usr/bin/deb-systemd-helper update-state 'reprepro-morgue.timer' > '/dev/null' 2>&1 || \
|
||||
/usr/bin/true
|
||||
fi
|
||||
/usr/bin/chgrp --quiet 'adm' '/var/log/reprepro'
|
||||
/usr/bin/chgrp --quiet 'adm' '/var/logrotate/reprepro'
|
||||
if [ ! -f '/var/lib/gnupg/pubring.kbx' ] || [ ! -f '/var/lib/gnupg/trustdb.gpg' ]; then
|
||||
/usr/bin/gpg --batch --gen-key --homedir '/var/lib/gnupg' --quiet <<EOF
|
||||
Key-Type: RSA
|
||||
Key-Length: 4096
|
||||
Subkey-Type: RSA
|
||||
Subkey-Length: 4096
|
||||
Name-Real: Repository
|
||||
Expire-Date: 0
|
||||
%no-protection
|
||||
EOF
|
||||
fi
|
||||
if [ -x '/usr/bin/deb-systemd-invoke' ]; then
|
||||
/usr/bin/systemctl --system daemon-reload > '/dev/null' 2>&1 || \
|
||||
/usr/bin/true
|
||||
if [ -n "${2}" ]; then
|
||||
_dh_action='restart'
|
||||
else
|
||||
_dh_action='start'
|
||||
fi
|
||||
/usr/bin/deb-systemd-invoke "${_dh_action}" 'reprepro-import.path' > '/dev/null' 2>&1 || \
|
||||
/usr/bin/true
|
||||
/usr/bin/deb-systemd-invoke "${_dh_action}" 'reprepro-morgue.timer' > '/dev/null' 2>&1 || \
|
||||
/usr/bin/true
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
48
root/DEBIAN/postrm
Normal file
48
root/DEBIAN/postrm
Normal file
@@ -0,0 +1,48 @@
|
||||
#!/usr/bin/sh
|
||||
|
||||
set -e
|
||||
set -u
|
||||
|
||||
if [ -d '/run/systemd/system' ]; then
|
||||
/usr/bin/systemctl --system daemon-reload > '/dev/null' 2>&1 || \
|
||||
/usr/bin/true
|
||||
fi
|
||||
|
||||
case "${1}" in
|
||||
remove)
|
||||
if [ -x '/usr/bin/deb-systemd-helper' ]; then
|
||||
/usr/bin/deb-systemd-helper mask 'reprepro-import.path' > '/dev/null' 2>&1 || \
|
||||
/usr/bin/true
|
||||
/usr/bin/deb-systemd-helper mask 'reprepro-morgue.timer' > '/dev/null' 2>&1 || \
|
||||
/usr/bin/true
|
||||
/usr/bin/deb-systemd-helper mask 'reprepro-import.service' > '/dev/null' 2>&1 || \
|
||||
/usr/bin/true
|
||||
/usr/bin/deb-systemd-helper mask 'reprepro-morgue.service' > '/dev/null' 2>&1 || \
|
||||
/usr/bin/true
|
||||
fi
|
||||
/usr/bin/rm --force --recursive '/var/log/reprepro/'*
|
||||
/usr/bin/rm --force --recursive '/var/log/reprepro/'.*
|
||||
/usr/bin/rm --force --recursive '/var/logrotate/reprepro/'*
|
||||
/usr/bin/rm --force --recursive '/var/logrotate/reprepro/'.*
|
||||
;;
|
||||
purge)
|
||||
if [ -x '/usr/bin/deb-systemd-helper' ]; then
|
||||
/usr/bin/deb-systemd-helper purge 'reprepro-import.path' > '/dev/null' 2>&1 || \
|
||||
/usr/bin/true
|
||||
/usr/bin/deb-systemd-helper purge 'reprepro-morgue.timer' > '/dev/null' 2>&1 || \
|
||||
/usr/bin/true
|
||||
/usr/bin/deb-systemd-helper unmask 'reprepro-import.path' > '/dev/null' 2>&1 || \
|
||||
/usr/bin/true
|
||||
/usr/bin/deb-systemd-helper unmask 'reprepro-morgue.timer' > '/dev/null' 2>&1 || \
|
||||
/usr/bin/true
|
||||
fi
|
||||
/usr/bin/rm --force --recursive '/var/lib/gnupg/'*
|
||||
/usr/bin/rm --force --recursive '/var/lib/gnupg/'.*
|
||||
/usr/bin/rm --force --recursive '/var/lib/reprepro/'*
|
||||
/usr/bin/rm --force --recursive '/var/lib/reprepro/'.*
|
||||
/usr/bin/rm --force --recursive '/var/log/reprepro/'*
|
||||
/usr/bin/rm --force --recursive '/var/log/reprepro/'.*
|
||||
/usr/bin/rm --force --recursive '/var/logrotate/reprepro/'*
|
||||
/usr/bin/rm --force --recursive '/var/logrotate/reprepro/'.*
|
||||
;;
|
||||
esac
|
||||
19
root/DEBIAN/prerm
Normal file
19
root/DEBIAN/prerm
Normal file
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/sh
|
||||
|
||||
set -e
|
||||
set -u
|
||||
|
||||
case "${1}" in
|
||||
remove)
|
||||
if [ -x '/usr/bin/deb-systemd-invoke' ]; then
|
||||
/usr/bin/deb-systemd-invoke stop 'reprepro-import.path' > '/dev/null' 2>&1 || \
|
||||
/usr/bin/true
|
||||
/usr/bin/deb-systemd-invoke stop 'reprepro-morgue.timer' > '/dev/null' 2>&1 || \
|
||||
/usr/bin/true
|
||||
/usr/bin/deb-systemd-invoke disable 'reprepro-import.path' > '/dev/null' 2>&1 || \
|
||||
/usr/bin/true
|
||||
/usr/bin/deb-systemd-invoke disable 'reprepro-morgue.timer' > '/dev/null' 2>&1 || \
|
||||
/usr/bin/true
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
78
root/etc/logrotate.d/reprepro
Normal file
78
root/etc/logrotate.d/reprepro
Normal file
@@ -0,0 +1,78 @@
|
||||
/var/log/reprepro/*.log {
|
||||
# Truncate the original log file in place after creating a copy,
|
||||
# instead of moving the old log file and optionally creating a
|
||||
# new one. It can be used when some program cannot be told to
|
||||
# close its logfile and thus might continue writing (appending)
|
||||
# to the previous log file forever. Note that there is a very
|
||||
# small time slice between copying the file and truncating it, so
|
||||
# some logging data might be lost. When this option is used, the
|
||||
# create option will have no effect, as the old log file stays in
|
||||
# place.
|
||||
copytruncate
|
||||
|
||||
# Archive old versions of log files adding a daily extension like
|
||||
# YYYYMMDD instead of simply adding a number. The extension may
|
||||
# be configured using the dateformat option.
|
||||
dateext
|
||||
|
||||
# Specify the extension for dateext using the notation similar to
|
||||
# strftime(3) function. Only %Y %m %d and %s specifiers are allowed.
|
||||
# The default value is -%Y%m%d. Note that also the character
|
||||
# separating log name from the extension is part of the dateformat
|
||||
# string. The system clock must be set past Sep 9th 2001 for %s to
|
||||
# work correctly. Note that the datestamps generated by this format
|
||||
# must be lexically sortable (i.e., first the year, then the month
|
||||
# then the day. e.g., 2001/12/01 is ok, but 01/12/2001 is not, since
|
||||
# 01/11/2002 would sort lower while it is later). This is because when
|
||||
# using the rotate option, logrotate sorts all rotated filenames to
|
||||
# find out which logfiles are older and should be removed.
|
||||
dateformat .%Y-%m-%d
|
||||
|
||||
# Use yesterday's instead of today's date to create the dateext
|
||||
# extension, so that the rotated log file has a date in its name that
|
||||
# is the same as the timestamps within it.
|
||||
dateyesterday
|
||||
|
||||
# Postpone compression of the previous log file to the next rotation
|
||||
# cycle. This only has effect when used in combination with compress.
|
||||
# It can be used when some program cannot be told to close its logfile
|
||||
# and thus might continue writing to the previous log file for some time.
|
||||
delaycompress
|
||||
|
||||
# If the log file is missing, go on to the next one without issuing an
|
||||
# error message.
|
||||
missingok
|
||||
|
||||
# Do not copy the original log file and leave it in place.
|
||||
nocopy
|
||||
|
||||
# New log files are not created.
|
||||
nocreate
|
||||
|
||||
# Don't mail old log files to any address.
|
||||
nomail
|
||||
|
||||
# Do not use shred when deleting old log files.
|
||||
noshred
|
||||
|
||||
# Do not rotate the log if it is empty.
|
||||
notifempty
|
||||
|
||||
# Logs are moved into directory for rotation. The directory must be on the
|
||||
# same physical device as the log file being rotated, and is assumed to be
|
||||
# relative to the directory holding the log file unless an absolute path
|
||||
# name is specified. When this option is used all old versions of the log
|
||||
# end up in directory.
|
||||
olddir /var/logrotate/reprepro
|
||||
|
||||
# Log files are rotated count times before being removed or mailed to the
|
||||
# address specified in a mail directive. If count is 0, old versions are
|
||||
# removed rather than rotated.
|
||||
rotate 1
|
||||
|
||||
# Log files are rotated if the current weekday is less than the weekday of
|
||||
# the last rotation or if more than a week has passed since the last
|
||||
# rotation. This is normally the same as rotating logs on the first day of
|
||||
# the week, but it works better if logrotate is not run every night.
|
||||
weekly
|
||||
}
|
||||
31
root/etc/reprepro/distributions
Normal file
31
root/etc/reprepro/distributions
Normal file
@@ -0,0 +1,31 @@
|
||||
Codename: bookworm
|
||||
Suite: oldstable
|
||||
Origin: Oldstable Repository
|
||||
Label: Oldstable Repository
|
||||
Description: Debian Bookworm Oldstable Repository
|
||||
Architectures: amd64 arm64
|
||||
Components: main pve8 pve8-ceph pbs8
|
||||
Update: bookworm
|
||||
SignWith:
|
||||
Log: bookworm.log
|
||||
|
||||
Codename: trixie
|
||||
Suite: stable
|
||||
Origin: Stable Repository
|
||||
Label: Stable Repository
|
||||
Description: Debian Trixie Stable Repository
|
||||
Architectures: amd64 arm64
|
||||
Components: main pve9 pve9-ceph pbs9
|
||||
Update: trixie
|
||||
SignWith:
|
||||
Log: trixie.log
|
||||
|
||||
Codename: noble
|
||||
Suite: stable
|
||||
Origin: Stable Repository
|
||||
Label: Stable Repository
|
||||
Description: Ubuntu Noble Numbat Stable Repository
|
||||
Architectures: amd64 arm64
|
||||
Components: main
|
||||
SignWith:
|
||||
Log: noble.log
|
||||
9
root/etc/reprepro/options
Normal file
9
root/etc/reprepro/options
Normal file
@@ -0,0 +1,9 @@
|
||||
verbose
|
||||
outdir /var/lib/reprepro
|
||||
confdir /etc/reprepro
|
||||
distdir /var/lib/reprepro/dists
|
||||
logdir /var/log/reprepro
|
||||
dbdir /var/lib/reprepro/db
|
||||
listdir /var/tmp
|
||||
morguedir /var/lib/reprepro/morgue
|
||||
gnupghome /var/lib/gnupg
|
||||
8
root/lib/systemd/system/reprepro-import.path
Normal file
8
root/lib/systemd/system/reprepro-import.path
Normal file
@@ -0,0 +1,8 @@
|
||||
[Unit]
|
||||
Description=Reprepro Package Importer
|
||||
|
||||
[Path]
|
||||
PathExistsGlob=/var/lib/reprepro/import/*.rep
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
10
root/lib/systemd/system/reprepro-import.service
Normal file
10
root/lib/systemd/system/reprepro-import.service
Normal file
@@ -0,0 +1,10 @@
|
||||
[Unit]
|
||||
Description=Reprepro Package Import
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStartPre=/usr/bin/sleep 15s
|
||||
ExecStart=/usr/lib/reprepro/import
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
9
root/lib/systemd/system/reprepro-morgue.service
Normal file
9
root/lib/systemd/system/reprepro-morgue.service
Normal file
@@ -0,0 +1,9 @@
|
||||
[Unit]
|
||||
Description=Reprepro Morgue Cleanup
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
ExecStart=/usr/lib/reprepro/morgue
|
||||
|
||||
[Install]
|
||||
WantedBy=timers.target
|
||||
9
root/lib/systemd/system/reprepro-morgue.timer
Normal file
9
root/lib/systemd/system/reprepro-morgue.timer
Normal file
@@ -0,0 +1,9 @@
|
||||
[Unit]
|
||||
Description=Reprepro Morgue Cleanup
|
||||
|
||||
[Timer]
|
||||
OnCalendar=Sun *-*-* 00:00:00
|
||||
Persistent=true
|
||||
|
||||
[Install]
|
||||
WantedBy=timers.target
|
||||
46
root/usr/lib/reprepro/import
Normal file
46
root/usr/lib/reprepro/import
Normal file
@@ -0,0 +1,46 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
|
||||
###
|
||||
#
|
||||
# Options Section
|
||||
#
|
||||
###
|
||||
|
||||
set -e
|
||||
set -o pipefail
|
||||
|
||||
|
||||
###
|
||||
#
|
||||
# Variable Section
|
||||
#
|
||||
###
|
||||
|
||||
OUTDIR=$(/usr/bin/grep 'outdir' '/etc/reprepro/options' | /usr/bin/sed --expression='s/outdir //')
|
||||
|
||||
|
||||
###
|
||||
#
|
||||
# Runtime Environment
|
||||
#
|
||||
###
|
||||
|
||||
if [[ ! -d "${OUTDIR}" ]]; then
|
||||
/usr/bin/install --directory --group='nogroup' --owner='nobody' "${OUTDIR}"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
for DEBINFO in "${OUTDIR}/import"/*.rep; do
|
||||
source "${DEBINFO}"
|
||||
if [[ -f "${OUTDIR}/pool/${COMPONENT}/${DEB:0:1}/${PACKAGE}/${DEB}" ]]; then
|
||||
for VERSION_CODENAME in ${CODENAME}; do
|
||||
/usr/bin/reprepro --confdir '/etc/reprepro' --silent --component "${COMPONENT}" remove "${VERSION_CODENAME}" "${PACKAGE}" &> '/dev/null'
|
||||
done
|
||||
fi
|
||||
for VERSION_CODENAME in ${CODENAME}; do
|
||||
/usr/bin/reprepro --confdir '/etc/reprepro' --silent --component "${COMPONENT}" includedeb "${VERSION_CODENAME}" "${OUTDIR}/import/${DEB}" &> '/dev/null'
|
||||
done
|
||||
/usr/bin/rm --force "${OUTDIR}/import/${DEB}"
|
||||
/usr/bin/rm --force "${DEBINFO}"
|
||||
done
|
||||
35
root/usr/lib/reprepro/morgue
Normal file
35
root/usr/lib/reprepro/morgue
Normal file
@@ -0,0 +1,35 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
|
||||
###
|
||||
#
|
||||
# Options Section
|
||||
#
|
||||
###
|
||||
|
||||
set -e
|
||||
set -o pipefail
|
||||
|
||||
|
||||
###
|
||||
#
|
||||
# Variable Section
|
||||
#
|
||||
###
|
||||
|
||||
OUTDIR=$(/usr/bin/grep 'outdir' '/etc/reprepro/options' | /usr/bin/sed --expression='s/outdir //')
|
||||
MORGUE="${OUTDIR}/morgue"
|
||||
|
||||
|
||||
###
|
||||
#
|
||||
# Runtime Environment
|
||||
#
|
||||
###
|
||||
|
||||
if [[ ! -d "${MORGUE}" ]]; then
|
||||
/usr/bin/install --directory "${MORGUE}"
|
||||
exit 0
|
||||
fi
|
||||
/usr/bin/rm --force --recursive "${MORGUE}"/*
|
||||
exit 0
|
||||
253
root/usr/sbin/repository
Normal file
253
root/usr/sbin/repository
Normal file
@@ -0,0 +1,253 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
|
||||
###
|
||||
#
|
||||
# Options Section
|
||||
#
|
||||
###
|
||||
|
||||
set -e
|
||||
set -o pipefail
|
||||
|
||||
|
||||
###
|
||||
#
|
||||
# Function Section
|
||||
#
|
||||
###
|
||||
|
||||
function import_pve () {
|
||||
local ARCHITECTURE
|
||||
local VERSION_CODENAME
|
||||
local COMPONENT
|
||||
local TEMP
|
||||
local REPOSITORY
|
||||
local DEBS
|
||||
local DEBSVERSIONS
|
||||
local DEB
|
||||
local BASENAME
|
||||
local PKGNAME
|
||||
|
||||
ARCHITECTURE="${1}"
|
||||
VERSION_CODENAME="${2}"
|
||||
COMPONENT="${3}"
|
||||
TEMP=$(/usr/bin/mktemp --directory --quiet)
|
||||
REPOSITORY="https://download.lierfang.com/pxcloud/pxvirt/dists/${VERSION_CODENAME}/${COMPONENT}/binary-${ARCHITECTURE}/"
|
||||
case "${COMPONENT}" in
|
||||
main)
|
||||
case "${VERSION_CODENAME}" in
|
||||
bookworm)
|
||||
COMPONENT='bookworm-pve'
|
||||
;;
|
||||
trixie)
|
||||
COMPONENT='trixie-pve'
|
||||
;;
|
||||
*)
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
ceph*)
|
||||
case "${VERSION_CODENAME}" in
|
||||
bookworm)
|
||||
COMPONENT='bookworm-ceph'
|
||||
;;
|
||||
trixie)
|
||||
COMPONENT='trixie-ceph'
|
||||
;;
|
||||
*)
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
*)
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
/usr/bin/wget --quiet --output-document="${TEMP}/repository.html" "${REPOSITORY}"
|
||||
HTML=$(/usr/bin/grep --perl-regexp --only-matching 'href="\K[^"]*(amd64|arm64|all)[^"]*\.deb' "${TEMP}/repository.html")
|
||||
/usr/bin/sleep '3s'
|
||||
declare -A DEBS
|
||||
declare -A VERSIONS
|
||||
for DEB in ${HTML}; do
|
||||
NAME=$(/bin/echo "${DEB}" | /usr/bin/sed -E 's/(_[0-9].*)//')
|
||||
VERSION="${DEB#*_}"
|
||||
VERSION="${VERSION%_*.deb}"
|
||||
if [[ -z "${VERSIONS[$NAME]}" ]] || \
|
||||
/usr/bin/dpkg --compare-versions "$VERSION" gt "${VERSIONS[$NAME]}" 2>/dev/null; then
|
||||
DEBS[$NAME]="$DEB"
|
||||
VERSIONS[$NAME]="$VERSION"
|
||||
fi
|
||||
done
|
||||
for DEB in "${DEBS[@]}"; do
|
||||
PKGNAME="${DEB%%_*}"
|
||||
VERSION_A="${DEB#*_}"
|
||||
VERSION_A="${VERSION_A%_*.deb}"
|
||||
VERSION_B=$(/usr/bin/reprepro --confdir '/etc/reprepro' --silent --component "${COMPONENT}" list "${VERSION_CODENAME}" "${PKGNAME}" | /usr/bin/mawk '{print $NF}' | /usr/bin/head --lines='1')
|
||||
if /usr/bin/dpkg --compare-versions "$VERSION_A" gt "${VERSION_B}" 2>/dev/null; then
|
||||
/usr/bin/echo '# --- --- --- --- --- #'
|
||||
/usr/bin/echo "Download (lierfang/pxvirt): ${DEB}"
|
||||
/usr/bin/wget --quiet --output-document="${TEMP}/${DEB}" "${REPOSITORY}${DEB}"
|
||||
/usr/bin/echo "Repository (${VERSION_CODENAME}/${COMPONENT}): ${PKGNAME}"
|
||||
/usr/bin/reprepro --confdir '/etc/reprepro' --silent --component "${COMPONENT}" includedeb "${VERSION_CODENAME}" "${TEMP}/${DEB}" &> '/dev/null'
|
||||
/usr/bin/rm --force "${TEMP}/${DEB}"
|
||||
fi
|
||||
done
|
||||
/bin/rm --force --recursive "${TEMP}"
|
||||
}
|
||||
|
||||
function import_pbs () {
|
||||
local VERSION_CODENAME
|
||||
local TEMP
|
||||
local REPOSITORY
|
||||
local URLS
|
||||
local URL
|
||||
local DEB
|
||||
local PKGNAME
|
||||
|
||||
VERSION_CODENAME="${1}"
|
||||
TEMP=$(/usr/bin/mktemp --directory --quiet)
|
||||
case "${VERSION_CODENAME}" in
|
||||
bookworm)
|
||||
REPOSITORY="https://api.github.com/repos/wofferl/proxmox-backup-arm64/releases/tags/3.4.6-1"
|
||||
COMPONENT='bookworm-pbs'
|
||||
;;
|
||||
trixie)
|
||||
REPOSITORY="https://api.github.com/repos/wofferl/proxmox-backup-arm64/releases/latest"
|
||||
COMPONENT='trixie-pbs'
|
||||
;;
|
||||
*)
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
/usr/bin/wget --quiet --output-document="${TEMP}/gitapi.json" "${REPOSITORY}"
|
||||
URLS=$(/usr/bin/grep 'browser_download_url' "${TEMP}/gitapi.json" | /usr/bin/cut --delimiter='"' --fields='4')
|
||||
for URL in ${URLS}; do
|
||||
DEB=$(/usr/bin/basename "${URL}")
|
||||
PKGNAME=$(/usr/bin/basename "${URL%%_*}")
|
||||
VERSION_A="${DEB#*_}"
|
||||
VERSION_A="${VERSION_A%_*.deb}"
|
||||
VERSION_B=$(/usr/bin/reprepro --confdir '/etc/reprepro' --silent --component "${COMPONENT}" list "${VERSION_CODENAME}" "${PKGNAME}" | /usr/bin/mawk '{print $NF}' | /usr/bin/head --lines='1')
|
||||
if [[ -z "${VERSION_B}" ]] || \
|
||||
/usr/bin/dpkg --compare-versions "$VERSION_A" gt "${VERSION_B}" 2>/dev/null; then
|
||||
/usr/bin/echo '# --- --- --- --- --- #'
|
||||
/usr/bin/echo "Download (wofferl/proxmox-backup-arm64): ${DEB}"
|
||||
/usr/bin/wget --quiet --output-document="${TEMP}/${DEB}" "${URL}"
|
||||
/usr/bin/echo "Repository (${VERSION_CODENAME}/${COMPONENT}): ${PKGNAME}"
|
||||
/usr/bin/reprepro --confdir '/etc/reprepro' --silent --component "${COMPONENT}" includedeb "${VERSION_CODENAME}" "${TEMP}/${DEB}" &> '/dev/null'
|
||||
/usr/bin/rm --force "${TEMP}/${DEB}"
|
||||
fi
|
||||
done
|
||||
/usr/bin/rm --force --recursive "${TEMP}"
|
||||
}
|
||||
|
||||
|
||||
###
|
||||
#
|
||||
# Runtime Environment
|
||||
#
|
||||
###
|
||||
|
||||
if [[ "${EUID}" -ne '0' ]]; then
|
||||
/usr/bin/echo 'Error: Permission Denied'
|
||||
exit 1
|
||||
fi
|
||||
if [[ -z "${1}" ]] || \
|
||||
[[ "${1}" != @(add|remove|update) ]]; then
|
||||
/usr/bin/echo 'Usage: repository [add|remove|update]'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
OUTDIR=$(/usr/bin/grep 'outdir' '/etc/reprepro/options' | /usr/bin/sed --expression='s/outdir //')
|
||||
ARGUMENT="${1}"
|
||||
VERSION_CODENAME="${2}"
|
||||
DEB_PATH="${3}"
|
||||
DEB_NAME=$(/usr/bin/basename "${DEB_PATH}")
|
||||
PKGNAME=$(/usr/bin/basename "${DEB_PATH%%_*}")
|
||||
|
||||
case "${ARGUMENT}" in
|
||||
add)
|
||||
if [[ -z "${VERSION_CODENAME}" ]] || \
|
||||
[[ "${VERSION_CODENAME}" != @(all|bookworm|trixie|noble) ]] || \
|
||||
[[ -z "${DEB_PATH}" ]]; then
|
||||
/usr/bin/echo 'Usage: repository [add] (all|bookworm|trixie|noble) (DEB)'
|
||||
exit 1
|
||||
fi
|
||||
if /usr/bin/dpkg-deb -W "${DEB_PATH}" &> '/dev/null'; then
|
||||
if [[ -d "${OUTDIR}/pool/main/${DEB_NAME:0:1}/${PKGNAME}" ]]; then
|
||||
/usr/bin/echo "Error: The Package '${PKGNAME}' already exist."
|
||||
exit 1
|
||||
fi
|
||||
if [[ "${VERSION_CODENAME}" == 'all' ]]; then
|
||||
for VERSION_CODENAME in bookworm trixie noble; do
|
||||
/usr/bin/echo '# --- --- --- --- --- #'
|
||||
/usr/bin/echo "Repository (${VERSION_CODENAME}/main) : ${PKGNAME}"
|
||||
/usr/bin/reprepro --confdir '/etc/reprepro' --silent --component 'main' includedeb "${VERSION_CODENAME}" "${DEB_PATH}" &> '/dev/null'
|
||||
/usr/bin/echo '# --- --- --- --- --- #'
|
||||
done
|
||||
elif [[ "${VERSION_CODENAME}" =~ ^(bookworm|trixie|noble)$ ]]; then
|
||||
/usr/bin/echo '# --- --- --- --- --- #'
|
||||
/usr/bin/echo "Repository (${VERSION_CODENAME}/main) : ${PKGNAME}"
|
||||
/usr/bin/reprepro --confdir '/etc/reprepro' --silent --component 'main' remove "${VERSION_CODENAME}" "${PKGNAME}" &> '/dev/null'
|
||||
/usr/bin/reprepro --confdir '/etc/reprepro' --silent --component 'main' includedeb "${VERSION_CODENAME}" "${DEB_PATH}" &> '/dev/null'
|
||||
/usr/bin/echo '# --- --- --- --- --- #'
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
remove)
|
||||
if [[ -z "${VERSION_CODENAME}" ]] || \
|
||||
[[ "${VERSION_CODENAME}" != @(all|bookworm|trixie|noble) ]] || \
|
||||
[[ -z "${DEB_PATH}" ]]; then
|
||||
/usr/bin/echo 'Usage: repository [remove] (all|bookworm|trixie|noble) (DEB)'
|
||||
exit 1
|
||||
fi
|
||||
if [[ ! -d "${OUTDIR}/pool/main/${DEB_NAME:0:1}/${PKGNAME}" ]]; then
|
||||
/usr/bin/echo "Error: The Package '${PKGNAME}' does not exist."
|
||||
exit 1
|
||||
fi
|
||||
if [[ "${VERSION_CODENAME}" == 'all' ]]; then
|
||||
for VERSION_CODENAME in bookworm trixie noble; do
|
||||
/usr/bin/echo '# --- --- --- --- --- #'
|
||||
/usr/bin/echo "Repository (${VERSION_CODENAME}/main) : ${PKGNAME}"
|
||||
/usr/bin/reprepro --confdir '/etc/reprepro' --silent --component 'main' remove "${VERSION_CODENAME}" "${PKGNAME}" &> '/dev/null'
|
||||
/usr/bin/echo '# --- --- --- --- --- #'
|
||||
done
|
||||
elif [[ "${VERSION_CODENAME}" =~ ^(bookworm|trixie|noble)$ ]]; then
|
||||
/usr/bin/echo '# --- --- --- --- --- #'
|
||||
/usr/bin/echo "Repository (${VERSION_CODENAME}/main) : ${PKGNAME}"
|
||||
/usr/bin/reprepro --confdir '/etc/reprepro' --silent --component 'main' remove "${VERSION_CODENAME}" "${PKGNAME}" &> '/dev/null'
|
||||
/usr/bin/echo '# --- --- --- --- --- #'
|
||||
fi
|
||||
;;
|
||||
update)
|
||||
if [[ -z "${VERSION_CODENAME}" ]] || \
|
||||
[[ "${VERSION_CODENAME}" != @(all|bookworm|trixie|noble) ]]; then
|
||||
/usr/bin/echo 'Usage: repository [update] (all|bookworm|trixie|noble)'
|
||||
exit 1
|
||||
fi
|
||||
case "${VERSION_CODENAME}" in
|
||||
all)
|
||||
import_pve 'arm64' 'bookworm' 'main'
|
||||
import_pve 'arm64' 'bookworm' 'ceph-squid'
|
||||
import_pbs 'bookworm'
|
||||
import_pve 'arm64' 'trixie' 'main'
|
||||
import_pve 'arm64' 'trixie' 'ceph-squid'
|
||||
import_pbs 'trixie'
|
||||
;;
|
||||
bookworm)
|
||||
import_pve 'arm64' 'bookworm' 'main'
|
||||
import_pve 'arm64' 'bookworm' 'ceph-squid'
|
||||
import_pbs 'bookworm'
|
||||
;;
|
||||
trixie)
|
||||
import_pve 'arm64' 'trixie' 'main'
|
||||
import_pve 'arm64' 'trixie' 'ceph-squid'
|
||||
import_pbs 'trixie'
|
||||
;;
|
||||
noble)
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
Reference in New Issue
Block a user