scc

A fork of https://git.simple-cc.org/scc/ for Qute

git clone https://git.8pit.net/scc.git

 1#!/bin/sh
 2
 3set -e
 4
 5for i
 6do
 7	case "$i" in
 8	-p)
 9		proto=$2
10		shift 2
11		;;
12	-*)
13		echo usage: uninstall [-p proto] root >&2
14		exit 1
15		;;
16	esac
17done
18
19root=${1?'root missed'}
20proto=${proto:-scripts/proto.all}
21
22while read type perm name
23do
24	case $type in
25	d)
26		echo $type $perm $name
27		continue
28		;;
29	f)
30		rm -f $root/$name
31		;;
32	*)
33		echo install: wrong entry type >&2
34		exit 1
35		;;
36	esac
37done < $proto |
38sort -r |
39while read type perm name
40do
41	case $type in
42	d)
43		if test `ls $root/$name | wc -l` -eq 0
44		then
45			rmdir $root/$name
46		fi
47		;;
48	esac
49done