summaryrefslogtreecommitdiff
path: root/util/sbase/scripts/uninstall
blob: e9c74f2d4c6a8055eea7b878c1d736ddb42d3eca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/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