All pastes #920176 Raw Edit

slow part of petget

public text v1 · immutable
#920176 ·published 2008-02-27 07:09 UTC
rendered paste body
   #v2.11 go through again and remove any empty dirs...
   #note, it is done above, but is incomplete. this should catch the rest...
   for ONEFILE in `cat ./$APKGNAME.files`
   do
    DELDIR="`dirname $ONEFILE`"
    [ -d $DELDIR ] && [ "`ls -1 $DELDIR`" = "" ] && rmdir $DELDIR
    #check one level up... but do not delete top dir, like /opt...
    DELLEVELS=`echo -n "$DELDIR" | sed -e 's/[^/]//g' | wc -c | sed -e 's/ //g'`
    if [ $DELLEVELS -gt 2 ];then
     DELDIR="`dirname $DELDIR`"
     [ -d $DELDIR ] && [ "`ls -1 $DELDIR`" = "" ] && rmdir $DELDIR
    fi
   done