From 096a16e01d54799ed08df910edc9ebe936a1cf87 Mon Sep 17 00:00:00 2001 From: Frank Brehm Date: Fri, 30 Dec 2022 11:32:16 +0100 Subject: [PATCH] Adding chowning resulting files in update-repos --- update-repos | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/update-repos b/update-repos index b54cbc1..3d8d162 100755 --- a/update-repos +++ b/update-repos @@ -5,12 +5,18 @@ set -eu REPO_ROOT="/var/www/html" GPGP_FILE="/home/repo/.private/ggg.txt" MAIN_DISTROS="Debian Ubuntu" +REPO_USER=repo +REPO_GROUP=users if [[ ! -d "${REPO_ROOT}" ]] ; then echo "Directory '${REPO_ROOT}' doesn't exists." >&2 exit 5 fi +I_AM_ROOT="n" +if [[ "$( id -u )" == "0" ]] then + I_AM_ROOT="y" +fi for mdistro in ${MAIN_DISTROS} ; do @@ -43,6 +49,10 @@ for mdistro in ${MAIN_DISTROS} ; do chmod -R -v g+w "${d}" + if [[ "${I_AM_ROOT}" == "y" ]] ; then + chown -v ${REPO_USER}:${REPO_GROUP} Packages* Release* + fi + done done @@ -63,6 +73,10 @@ if [[ -d "${root}" ]] ; then rm -fv Release.gpg gpg --output Release.gpg -u B796E12A --armor --detach-sign --batch --pinentry-mode loopback --passphrase-file "${GPGP_FILE}" Release + if [[ "${I_AM_ROOT}" == "y" ]] ; then + chown -v ${REPO_USER}:${REPO_GROUP} Sources* Release* + fi + fi -- 2.39.5