shithub: riscv

ref: e08cc065177138fe821abb84dc6381fd0400e944
dir: /sys/src/cmd/pkg/remove/

View raw version
#!/bin/rc -e

cd /
if(test -s /sys/lib/pkg/$1) {
	fs=(`{cat /sys/lib/pkg/$1 | awk '{print $1}'})
	ss=(`{cat /sys/lib/pkg/$1 | awk '{print $2}'})
	for(i in `{seq $#fs}) {
		s=`{sha1sum $fs($i) | awk '{print $1}' | tr a-z A-Z}
		if(test $s '=' $ss($i)) {
			echo D $fs($i)
			rm $fs($i)
		} 
		if not {
			echo M $fs($i) NOT DELETING
		}
	}
	rm -rf /sys/src/pkg/$1
	rm /sys/lib/pkg/$1
}