diff options
author | Wim Muskee <wimmuskee@gmail.com> | 2012-12-05 18:03:53 +0100 |
---|---|---|
committer | Wim Muskee <wimmuskee@gmail.com> | 2012-12-05 18:03:53 +0100 |
commit | 84de87968990d03700d2ae3feeaab81b380edc0e (patch) | |
tree | 3bc7f82c8d2c3ae2b72a55232f0c8726807ca9c4 | |
parent | Make rm only use verbose option when verbose is selected. (diff) | |
download | localepurge-84de87968990d03700d2ae3feeaab81b380edc0e.tar.gz localepurge-84de87968990d03700d2ae3feeaab81b380edc0e.tar.bz2 localepurge-84de87968990d03700d2ae3feeaab81b380edc0e.zip |
When localedir is symlink, do free space check on parentdir because it gets removed.
-rwxr-xr-x | localepurge | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/localepurge b/localepurge index e2279ed..10e32bb 100755 --- a/localepurge +++ b/localepurge @@ -166,7 +166,13 @@ remove() { ${ACTION} `find ${REMOVEPATH} -type f -o -type l` if [ "$SHOWFREEDSPACE" = "enabled" ]; then - SPACEAFTER=$(df -P ${REMOVEPATH} | awk '{if ( NR==2 ) { print $3 }}') + # if symlink, REMOVEPATH could be removed + # check from parentdir then + if [ -d ${REMOVEPATH} ]; then + SPACEAFTER=$(df -P ${REMOVEPATH} | awk '{if ( NR==2 ) { print $3 }}') + else + SPACEAFTER=$(df -P ${REMOVEPATH%/*} | awk '{if ( NR==2 ) { print $3 }}') + fi SPACESUM=$(($SPACEBEFORE - $SPACEAFTER)) if test $SPACESUM -gt 0 ; then |