uninstall (349B)
1 #!/bin/sh 2 3 set -e 4 5 while read type src dst perm 6 do 7 case $type in 8 d) 9 echo $type $src $dst $perm 10 continue 11 ;; 12 c) 13 rm -f $dst 14 ;; 15 *) 16 echo uninstall: wrong entry type >&2 17 exit 1 18 ;; 19 esac 20 done < $1 | 21 sort -r | 22 while read type src dst perm 23 do 24 case $type in 25 d) 26 if test `ls $dst | wc -l` -eq 0 27 then 28 rmdir $dst 29 fi 30 ;; 31 esac 32 done