diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2010-02-21 16:50:34 +0100 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2010-02-21 16:50:34 +0100 |
commit | dea6954635ff0eccd116c384065c1ad745fcd1d2 (patch) | |
tree | 4eff408fbb60ac25eb2eaf869ea27a97768548d0 | |
parent | cd84eaf5a82cae5414245cc24eb94b06fc1b9b4f (diff) |
add dry run option to ftpdir-cleanup
Signed-off-by: Pierre Schmitz <pierre@archlinux.de>
-rw-r--r-- | config | 1 | ||||
-rwxr-xr-x | misc-scripts/ftpdir-cleanup | 12 |
2 files changed, 8 insertions, 5 deletions
@@ -5,6 +5,7 @@ FTP_OS_SUFFIX="os" SVNREPO="file:///srv/svn-packages" CLEANUP_DESTDIR="/srv/package-cleanup" +CLEANUP_DRYRUN=false SOURCE_CLEANUP_DESTDIR="/srv/source-cleanup" STAGING="$HOME/staging" diff --git a/misc-scripts/ftpdir-cleanup b/misc-scripts/ftpdir-cleanup index f0f89a3..6a69d72 100755 --- a/misc-scripts/ftpdir-cleanup +++ b/misc-scripts/ftpdir-cleanup @@ -13,6 +13,8 @@ dest=$2 . "$(dirname $0)/../db-functions" . "$(dirname $0)/../config" +${CLEANUP_DRYRUN} && echo 'dry run mode is active' + ftppath_base="$FTP_BASE/$reponame/$FTP_OS_SUFFIX" for arch in ${ARCHES[@]}; do @@ -93,7 +95,7 @@ for arch in ${ARCHES[@]}; do for mf in $missfiles; do if [ -e "${ftppath_base}/any/${mf}" ]; then echo "Restoring missing 'any' symlink: ${mf}" - ln -s "../any/${mf}" "${ftppath}" + ${CLEANUP_DRYRUN} || ln -s "../any/${mf}" "${ftppath}" else MISSINGFILES="${MISSINGFILES} ${mf}" fi @@ -141,17 +143,17 @@ for arch in ${ARCHES[@]}; do fi if [ -n "${DELETEFILES}" ]; then - mv ${DELETEFILES} "$dest" + ${CLEANUP_DRYRUN} || mv ${DELETEFILES} "$dest" echo "" fi if [ -n "${DELETESYMLINKS}" ]; then - rm -f ${DELETESYMLINKS} + ${CLEANUP_DRYRUN} || rm -f ${DELETESYMLINKS} echo "" fi if [ -n "${EXTRAFILES}" ]; then - mv ${EXTRAFILES} "$dest" + ${CLEANUP_DRYRUN} || mv ${EXTRAFILES} "$dest" echo "" fi @@ -189,6 +191,6 @@ fi if [ -d "$ftppath_base/any" -a -n "${ARCHINDEPFILES}" ]; then cd "$ftppath_base/any" - mv ${ARCHINDEPFILES} "$dest" + ${CLEANUP_DRYRUN} || mv ${ARCHINDEPFILES} "$dest" echo "" fi |