Makeinstall.rc (1143B)
1 #!/bin/rc 2 3 # This script will install all executables in the current directory to $1 4 # Directory structure is preserved 5 # It stores a list of everything it has transferred / created 6 7 bin = $1 8 9 scripts = `$nl{find . -perm 0755 -type f ! -name 'Make*' | grep -v '/\.' | sed 's/^\.\///'} 10 11 touch .installed .dirsmade 12 installed = `$nl{cat .installed} 13 dirsmade = `$nl{cat .dirsmade} 14 15 # Stores lists before exiting. 16 # This is the last step regardless of success 17 fn sigexit { 18 {for (s in $installed) { echo $s }} > .installed 19 {for (d in $dirsmade) { echo $d }} > .dirsmade 20 } 21 22 for (s in $scripts) { 23 d = `$nl{dirname $s} 24 if (!~ $d '.') { 25 # could use mkdir -p here, however in order to actually keep a 26 # list of what's been made, use a for loop 27 28 p = $bin 29 for (e in `($nl '/'){echo $d}) { 30 p = $p/$e 31 if (!test -d $p) { 32 echo MKDIR $p 33 mkdir $p || exit 1 34 35 # add to list if not already present 36 if (!~ $d $dirsmade) { 37 dirsmade = ($dirsmade $d) 38 } 39 } 40 } 41 } 42 43 if (!cmp -s $s $bin/$s) { 44 echo CP $s $bin/$s 45 cp $s $bin/$s 46 if (!~ $s $installed) { 47 installed = ($installed $s) 48 } 49 } 50 } 51 52 echo everything up to date