blob: 33c1cf9fde82661a556b8f1b043ddfad320c179b (
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
#!/bin/rc
# This script will install all executables in the current directory to $1
# Directory structure is preserved
# It stores a list of everything it has transferred / created
bin = $1
scripts = `$nl{find . -perm 0755 -type f ! -name 'Make*' | grep -v '/\.' | sed 's/^\.\///'}
touch .installed .dirsmade
installed = `$nl{cat .installed}
dirsmade = `$nl{cat .dirsmade}
# Stores lists before exiting.
# This is the last step regardless of success
fn sigexit {
{for (s in $installed) { echo $s }} > .installed
{for (d in $dirsmade) { echo $d }} > .dirsmade
}
for (s in $scripts) {
d = `$nl{dirname $s}
if (!~ $d '.') {
# could use mkdir -p here, however in order to actually keep a
# list of what's been made, use a for loop
p = $bin
for (e in `($nl '/'){echo $d}) {
p = $p/$e
if (!test -d $p) {
echo MKDIR $p
mkdir $p || exit 1
# add to list if not already present
if (!~ $d $dirsmade) {
dirsmade = ($dirsmade $d)
}
}
}
}
if (!cmp -s $s $bin/$s) {
echo CP $s $bin/$s
cp $s $bin/$s
if (!~ $s $installed) {
installed = ($installed $s)
}
}
}
echo everything up to date
|