X-Git-Url: https://git.grml.org/?p=grml-live.git;a=blobdiff_plain;f=buildd%2Fcleanup.sh;h=3d643468c4cc388fcb1fb103f689d1df840caa8a;hp=2f1654971240c1113493beb43f694654ffa2618c;hb=36c28682d60241e5f36136983cb3ce09dbe9f668;hpb=d82c19690884d3a645cc13aefd3de0a7fc8f4d12 diff --git a/buildd/cleanup.sh b/buildd/cleanup.sh index 2f16549..3d64346 100755 --- a/buildd/cleanup.sh +++ b/buildd/cleanup.sh @@ -1,50 +1,49 @@ #!/bin/sh -# Filename: /usr/share/grml-live/buildd/cleanup.sh +# Filename: cleanup.sh # Purpose: clean up daily builds directory - remove old files # Authors: grml-team (grml.org), (c) Michael Prokop # Bug-Reports: see http://grml.org/bugs/ # License: This file is licensed under the GPL v2 or any later version. -# Latest change: YDATE [mika] ################################################################################ set -e . /etc/grml/grml-buildd.conf -[ -n "$RECIPIENT" ] || RECIPIENT=root@localhost - [ -n "$MIRROR_DIRECTORY" ] || exit 1 cd $MIRROR_DIRECTORY || exit 2 # we want to always keep a few images, no matter how old they are # but get rid of the oldest ones first of course :) -# so: how many images do we want to keep? +# so: how many images do we want to keep? DAYS=3 usually means 'keep 4 images' DAYS=3 REMOVE_ME="" -for flavour in grml-small_etch grml-small_sid grml-medium_etch grml-medium_sid grml_sid grml_etch \ - grml64-small_etch grml64-small_sid grml64-medium_etch grml64-medium_sid grml64_sid grml64_etch ; do - FILE_COUNT=$(ls -1 $flavour*.iso | wc -l) +for flavour in grml-medium_lenny grml-medium_squeeze grml-medium_sid grml-small_lenny grml-small_squeeze grml-small_sid \ + grml64-medium_lenny grml64-medium_squeeze grml64-medium_sid grml64-small_lenny grml64-small_squeeze grml64-small_sid \ + grml64_lenny grml64_squeeze grml64_sid grml_lenny grml_squeeze grml_sid ; do + FILE_COUNT=$(ls -1 $flavour/$flavour*.iso | wc -l) if [ "$FILE_COUNT" -gt "$DAYS" ] ; then - FILES=$(ls -1 $flavour*.iso | tail -"$DAYS") - OLD_FILES=$(ls $flavour*.iso | grep -v "$FILES") + FILES=$(ls -1 $flavour/$flavour*.iso | tail -"$DAYS") + OLD_FILES=$(ls $flavour/$flavour*.iso | grep -v "$FILES") for file in $OLD_FILES ; do REMOVE_ME="$REMOVE_ME $(find $file -mtime +$DAYS)" done fi done -[ -d .delete ] || mkdir .delete +[ -d .archive ] || mkdir .archive -# move them before we really delete them: for file in $REMOVE_ME ; do test -f ${file} && rm -f $file - test -f ${file}.md5 && mv ${file}.md5 .delete + # ... but keep their md5sum / sha1sum: + test -f ${file}.md5 && mv ${file}.md5 .archive + test -f ${file}.sha1 && mv ${file}.sha1 .archive done # inform on successful removal: if [ "$(echo "$REMOVE_ME" | tr -d ' ' )" != "" ] ; then - echo "deleted files $REMOVE_ME" | mail -s "daily-builds cleanup script" $RECIPIENT + echo "deleted files $REMOVE_ME" | mail -s "daily-builds cleanup script" mika@grml.org fi ## END OF FILE #################################################################