1 | #!/bin/sh |
---|
2 | # $Id: local-netscape.sh,v 1.4 2000-07-29 14:19:07 ghudson Exp $ |
---|
3 | |
---|
4 | # local-netscape: A cron job to copy part of the infoagents locker onto |
---|
5 | # local disk so that netscape can be started more quickly. |
---|
6 | |
---|
7 | PATH=/usr/xpg4/bin:/bin:/usr/bin:/sbin:/usr/sbin:/bin/athena:/usr/athena/bin:/usr/athena/etc |
---|
8 | export PATH |
---|
9 | |
---|
10 | local=/var/athena/infoagents |
---|
11 | rconf=/var/athena/rconf.infoagents |
---|
12 | |
---|
13 | # Attach the infoagents locker and get its mountpoint. |
---|
14 | locker=`attach -pn infoagents` |
---|
15 | if [ -z "$locker" ]; then |
---|
16 | exit |
---|
17 | fi |
---|
18 | |
---|
19 | # Make sure we have 100MB of space available under /var if this is the |
---|
20 | # first time we're bringing netscape local. Note that df's -P option |
---|
21 | # is only supported by /usr/xpg4/bin/df on Solaris 7; thus the |
---|
22 | # /usr/xpg4/bin at the beginning of the PATH above. |
---|
23 | space=`df -kP /var/athena | awk '{ x = $4; } END { print x; }'` |
---|
24 | if [ ! -d "$local" -a "$space" -lt 102400 ]; then |
---|
25 | exit |
---|
26 | fi |
---|
27 | |
---|
28 | # Remove netscape.adjusted until everything is properly set up. |
---|
29 | # /usr/athena/bin/netscape will use the infoagents locker in the |
---|
30 | # meantime. |
---|
31 | bin=`athdir $local` |
---|
32 | if [ -n "$bin" ]; then |
---|
33 | rm -f "$bin/netscape.adjusted" |
---|
34 | fi |
---|
35 | |
---|
36 | version=1 |
---|
37 | if [ -r "$locker/.syncversion" ]; then |
---|
38 | if [ `cat "$locker/.syncversion"` -gt $version ]; then |
---|
39 | exit |
---|
40 | fi |
---|
41 | fi |
---|
42 | |
---|
43 | # Write out the rconf file. |
---|
44 | arch=`athdir -t "" -p "$locker" | sed -e "s,^$locker/,," -e 's,/$,,'` |
---|
45 | if [ -z "$arch" ]; then |
---|
46 | exit |
---|
47 | fi |
---|
48 | rm -f $rconf |
---|
49 | cat > $rconf << EOF |
---|
50 | delete * |
---|
51 | copy www -f |
---|
52 | copy www/netscape -f |
---|
53 | copy www/netscape/* -f |
---|
54 | copy share -f |
---|
55 | copy share/Netscape -f |
---|
56 | copy share/Netscape/* -f |
---|
57 | copy share/app-defaults -f |
---|
58 | copy share/app-defaults/* -f |
---|
59 | copy arch -f |
---|
60 | copy arch/share -f |
---|
61 | copy arch/share/* -f |
---|
62 | chase $arch |
---|
63 | copy $arch -f |
---|
64 | copy $arch/* -f |
---|
65 | delete $arch/MIT-only/* |
---|
66 | chase $arch/MIT-only/netscape |
---|
67 | copy $arch/MIT-only/netscape |
---|
68 | copy $arch/MIT-only/netscape/* |
---|
69 | EOF |
---|
70 | |
---|
71 | # Do the synctree of the locker. |
---|
72 | mkdir -p $local |
---|
73 | synctree -q -nosrcrules -nodstrules -s "$locker" -d $local -a $rconf |
---|
74 | if [ $? -ne 0 ]; then |
---|
75 | rm -rf "$local" |
---|
76 | exit |
---|
77 | fi |
---|
78 | |
---|
79 | # Make sure the local copy of the locker is readable. |
---|
80 | find $local \( -type f -o -type d \) -print | xargs chmod a+rX |
---|
81 | |
---|
82 | # Massage the netscape startup script. |
---|
83 | script=$local/arch/share/bin/netscape |
---|
84 | if [ -x "$script" ]; then |
---|
85 | rm -f "$script.adjusted" |
---|
86 | sed -e "s,$locker,$local,g" -e 's,^progname=.*$,progname=netscape,' \ |
---|
87 | "$script" > $script.new |
---|
88 | chmod a+x "$script.new" |
---|
89 | mv "$script.new" "$script.adjusted" |
---|
90 | fi |
---|