diff options
author | Aaron Griffin <aaronmgriffin@gmail.com> | 2009-07-21 00:58:08 +0200 |
---|---|---|
committer | Aaron Griffin <aaronmgriffin@gmail.com> | 2009-07-21 00:58:08 +0200 |
commit | f8d7e57ea25a60e2dad75a7675cfee16a167f3f5 (patch) | |
tree | 5695292949208be45060641bc7aaea02b4b03ee3 /misc-scripts/ftpdir-cleanup | |
parent | 754d26d772570d02c878ab6afc3dc5f75e17e373 (diff) | |
download | dbscripts-f8d7e57ea25a60e2dad75a7675cfee16a167f3f5.tar.gz dbscripts-f8d7e57ea25a60e2dad75a7675cfee16a167f3f5.tar.xz |
ftpdir-cleanup: Fix the symlink restore loop
Previous logic was stupid... let's just check the missing files.
If it's missing and exists in the any dir, then common sense says
we deleted a symlink somewhere...
Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
Diffstat (limited to 'misc-scripts/ftpdir-cleanup')
-rwxr-xr-x | misc-scripts/ftpdir-cleanup | 29 |
1 files changed, 7 insertions, 22 deletions
diff --git a/misc-scripts/ftpdir-cleanup b/misc-scripts/ftpdir-cleanup index 7de64b9..2573cf4 100755 --- a/misc-scripts/ftpdir-cleanup +++ b/misc-scripts/ftpdir-cleanup @@ -98,32 +98,17 @@ if [ -z "$DELETEFILES$MISSINGFILES$EXTRAFILES$ARCHINDEPFILES" ]; then exit 0 fi -#Do a quick check. If we have a MISSINGFILE and an ARCHINDEPFILE of the same -#name to remove, then let's restore the symlink. - -archfiles="$ARCHINDEPFILES" -ARCHINDEPFILES="" -for af in $archfiles; do - af_satisfied=0 - for mf in $MISSINGFILES; do - if [ "${af}" = "${mf}" ]; then - ln -s "${ftppath_base}/any/${af}" "${ftppath}" - af_satisfied=1 - fi - - done - if [ $af_satisfied -eq 0 ]; then - ARCHINDEPFILES="${ARCHINDEPFILES} ${af}" - fi -done -#rescan missing files now +# Do a quick check to see if a missing ARCHINDEPFILE is in the any dir +# If it is, and the file is MISSING, restore it missfiles="$MISSINGFILES" MISSINGFILES="" for mf in $missfiles; do - if [ ! -e "${ftppath}/${mf}" ]; then - MISSINGFILES="${MISSINGFILES} ${mf}" + af_satisfied=0 + if [ -e "${ftppath_base}/any/${mf}" ]; then + echo "Restoring missing 'any' symlink: ${mf}" + ln -s "${ftppath_base}/any/${mf}" "${ftppath}" else - echo "Missing file has been restored: $mf" + MISSINGFILES="${MISSINGFILES} ${mf}" fi done |