1
0
mirror of git://git.suckless.org/sbase synced 2025-03-20 01:50:43 +00:00
sbase/scripts/uninstall

33 lines
349 B
Plaintext
Raw Normal View History

2023-09-26 21:09:34 +00:00
#!/bin/sh
set -e
while read type src dst perm
do
case $type in
d)
echo $type $src $dst $perm
continue
;;
c)
rm -f $dst
;;
*)
echo uninstall: wrong entry type >&2
exit 1
;;
esac
done < $1 |
sort -r |
while read type src dst perm
do
case $type in
d)
if test `ls $dst | wc -l` -eq 0
then
rmdir $dst
fi
;;
esac
done