--- /dev/null
+#!/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