summaryrefslogtreecommitdiffstats
path: root/misc-scripts/ftpdir-cleanup
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2010-02-21 16:50:34 +0100
committerPierre Schmitz <pierre@archlinux.de>2010-02-21 16:50:34 +0100
commitdea6954635ff0eccd116c384065c1ad745fcd1d2 (patch)
tree4eff408fbb60ac25eb2eaf869ea27a97768548d0 /misc-scripts/ftpdir-cleanup
parentcd84eaf5a82cae5414245cc24eb94b06fc1b9b4f (diff)
downloaddbscripts-dea6954635ff0eccd116c384065c1ad745fcd1d2.tar.gz
dbscripts-dea6954635ff0eccd116c384065c1ad745fcd1d2.tar.xz
add dry run option to ftpdir-cleanup
Signed-off-by: Pierre Schmitz <pierre@archlinux.de>
Diffstat (limited to 'misc-scripts/ftpdir-cleanup')
-rwxr-xr-xmisc-scripts/ftpdir-cleanup12
1 files changed, 7 insertions, 5 deletions
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