]> Frank Brehm's Git Trees - scripts/root-bin.git/commitdiff
Adding update-repos
authorFrank Brehm <frank@brehm-online.com>
Fri, 30 Dec 2022 10:22:03 +0000 (11:22 +0100)
committerFrank Brehm <frank@brehm-online.com>
Fri, 30 Dec 2022 10:22:03 +0000 (11:22 +0100)
update-repos [new file with mode: 0755]

diff --git a/update-repos b/update-repos
new file mode 100755 (executable)
index 0000000..b54cbc1
--- /dev/null
@@ -0,0 +1,70 @@
+#!/bin/bash
+
+set -eu
+
+REPO_ROOT="/var/www/html"
+GPGP_FILE="/home/repo/.private/ggg.txt"
+MAIN_DISTROS="Debian Ubuntu"
+
+if [[ ! -d "${REPO_ROOT}" ]] ; then
+    echo "Directory '${REPO_ROOT}' doesn't exists." >&2
+    exit 5
+fi
+
+
+for mdistro in ${MAIN_DISTROS} ; do
+
+    root="${REPO_ROOT}/${mdistro}"
+
+    if [[ ! -d "${root}" ]] ; then
+        echo "Directory '${root}' doesn't exists." >&2
+        continue
+    fi
+
+    echo
+    echo "---------------------------------------"
+    echo "Performing main distro '${mdistro}' ..."
+
+    for d in "${root}"/* ; do
+        if [[ ! -d "${d}" ]] ; then
+            continue
+        fi
+        echo
+        echo "Performing '${d}' ..."
+
+        cd "${d}"
+        rm -fv Packages
+        rm -fv Packages.gz
+        apt-ftparchive packages . > Packages
+        gzip -v9 -c Packages > Packages.gz
+        apt-ftparchive release . > Release
+        rm -fv Release.gpg
+        gpg --output Release.gpg -u B796E12A --armor --detach-sign --batch --pinentry-mode loopback --passphrase-file "${GPGP_FILE}" Release
+
+        chmod -R -v g+w "${d}"
+
+    done
+
+done
+
+root="${REPO_ROOT}/Sources"
+if [[ -d "${root}" ]] ; then
+
+    echo
+    echo "---------------------------------------"
+    echo "Performing sources ..."
+
+    cd "${root}"
+    rm -fv Sources
+    rm -fv Sources.gz
+    apt-ftparchive sources . > Sources
+    gzip -v9 -c Sources > Sources.gz
+    apt-ftparchive release . > Release
+    rm -fv Release.gpg
+    gpg --output Release.gpg -u B796E12A --armor --detach-sign --batch --pinentry-mode loopback --passphrase-file "${GPGP_FILE}" Release
+
+fi
+
+
+
+# vim: ts=4 et sw=4