]> Frank Brehm's Git Trees - scripts/root-bin.git/commitdiff
Fixing deploy-incoming
authorFrank Brehm <frank@brehm-online.com>
Fri, 30 Dec 2022 10:15:57 +0000 (11:15 +0100)
committerFrank Brehm <frank@brehm-online.com>
Fri, 30 Dec 2022 10:15:57 +0000 (11:15 +0100)
deploy-incoming

index 8568ad5902632447687a7a1084a757902cbf1d0b..b3b7795b15d0a1e6295bbba460431a810c18c310 100755 (executable)
@@ -6,6 +6,8 @@ REPO_ROOT="/var/www/html"
 INCOMING_ROOT="/var/www/incoming"
 REPO_USER=repo
 REPO_GROUP=users
+REPO_USER_HOME="/home/repo"
+UPDATE_REPOS_SCRIPT="${REPO_USER_HOME}/bin/update-repos"
 
 declare -A MAPPINGS=()
 
@@ -34,27 +36,33 @@ for src_dir_part in "${!MAPPINGS[@]}" ; do
         for file in ${src_dir}/* ; do
             if [[ -f "${file}" ]] ; then
                 # echo " * ${file}"
+                file_base=$( basename "${file}" )
                 tgt="${tgt_dir}"
                 if [[ "${src_dir_part}" =~ ^el && "${file}" =~ src\.rpm$ ]] ; then
                     tgt="${src_tgt_dir}"
                 fi
+                tgt_file="${tgt}/${file_base}"
                 if [[ ! -d "${tgt}" ]] ; then
                     printf " * "
                     mkdir -p -v "${tgt}/"
                 fi
                 printf " * "
                 mv -v "${file}" "${tgt}/"
+                printf "   "
+                chown -v ${REPO_USER}:${REPO_GROUP} "${tgt_file}"
             fi
 
         done
 
-        echo
-        echo "Chowning '${src_dir}' to ${REPO_USER}:${REPO_GROUP} ..."
-        chown -R ${REPO_USER}:${REPO_GROUP} "${src_dir}"
-
     fi
 done
 
+if [[ -x "${UPDATE_REPOS_SCRIPT}" ]] ; then
+    echo
+    echo "Updating Debian repos ..."
+    su --login "${REPO_USER}" --command "${UPDATE_REPOS_SCRIPT}"
+fi
+
 for repo_dir in "${REPO_ROOT}"/Yum/* ; do
 
     bname=$( basename "${repo_dir}" )
@@ -76,5 +84,4 @@ for repo_dir in "${REPO_ROOT}"/Yum/* ; do
 
 done
 
-
 # vim: ts=4 et sw=4