src.hhvn.uk > hhvn.uk-scripts > file > Makeuninstall.rc

scripts that power hhvn.uk
Log | Files | Refs | README

Makeuninstall.rc (534B)


      1 #!/bin/rc
      2 
      3 # This script will uninstall all scripts/dirs copied into $1
      4 # It uses rmdir(1) to prevent removal of any files from elsewhere
      5 
      6 bin = $1
      7 
      8 if (test -f .installed) {
      9 	installed = `$nl{cat .installed}
     10 	for (s in $installed) {
     11 		echo RM $bin/$s
     12 		rm $bin/$s
     13 		removed = ($removed $bin/$s)
     14 	}
     15 	rm .installed
     16 }
     17 
     18 if (test -f .dirsmade) {
     19 	dirsmade  = `$nl{cat .dirsmade}
     20 	for (d in $dirsmade) {
     21 		echo RMDIR $bin/$d
     22 		rmdir $bin/$d
     23 		removed = ($removed $bin/$s)
     24 	}
     25 	rm .dirsmade
     26 }
     27 
     28 if (~ $removed ()) {
     29 	echo nothing to remove
     30 }