source: trunk/packs/maint/local-netscape.sh @ 17983

Revision 17983, 2.9 KB checked in by ghudson, 22 years ago (diff)
Make sure scripts are readable as well as executable.
Line 
1#!/bin/sh
2# $Id: local-netscape.sh,v 1.7 2002-10-17 05:13:03 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
7PATH=/usr/xpg4/bin:/bin:/usr/bin:/sbin:/usr/sbin:/bin/athena:/usr/athena/bin:/usr/athena/etc
8export PATH
9
10local=/var/athena/infoagents
11rconf=/var/athena/rconf.infoagents
12
13# Attach the infoagents locker and get its mountpoint.
14locker=`attach -pn infoagents`
15if [ -z "$locker" ]; then
16  exit
17fi
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.
23space=`df -kP /var/athena | awk '{ x = $4; } END { print x; }'`
24if [ ! -d "$local" -a "$space" -lt 102400 ]; then
25  exit
26fi
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.
31bin=`athdir $local`
32if [ -n "$bin" ]; then
33  rm -f "$bin/netscape.adjusted"
34  rm -f "$bin/mozilla.adjusted"
35fi
36
37version=1
38if [ -r "$locker/.syncversion" ]; then
39  if [ `cat "$locker/.syncversion"` -gt $version ]; then
40    exit
41  fi
42fi
43
44# Write out the rconf file.
45arch=`athdir -t "" -p "$locker" | sed -e "s,^$locker/,," -e 's,/$,,'`
46if [ -z "$arch" ]; then
47  exit
48fi
49rm -f $rconf
50cat > $rconf << EOF
51delete *
52copy www -f
53copy www/netscape -f
54copy www/netscape/* -f
55copy share -f
56copy share/Netscape -f
57copy share/Netscape/* -f
58copy share/app-defaults -f
59copy share/app-defaults/* -f
60copy arch -f
61copy arch/share -f
62copy arch/share/* -f
63chase $arch
64copy $arch -f
65copy $arch/* -f
66delete $arch/MIT-only/*
67chase $arch/MIT-only/netscape
68copy $arch/MIT-only/netscape -f
69copy $arch/MIT-only/netscape/* -f
70chase $arch/MIT-only/mozilla
71copy $arch/MIT-only/mozilla -f
72copy $arch/MIT-only/mozilla/* -f
73EOF
74
75# Do the synctree of the locker.
76mkdir -p $local
77synctree -q -nosrcrules -nodstrules -s "$locker" -d $local -a $rconf
78if [ $? -ne 0 ]; then
79  rm -rf "$local"
80  exit
81fi
82
83# If we don't have a netscape binary, assume our synctree failed partially
84# and remove our local copy.
85if [ ! -f "$local/$arch/MIT-only/netscape/netscape" ]; then
86  rm -rf "$local"
87  exit
88fi
89
90# Make sure the local copy of the locker is readable.
91find $local \( -type f -o -type d \) -print | xargs chmod a+rX
92
93# Massage the netscape startup script.
94script=$local/arch/share/bin/netscape
95if [ -x "$script" ]; then
96  rm -f "$script.adjusted"
97  sed -e "s,$locker,$local,g" -e 's,^progname=.*$,progname=netscape,' \
98    "$script" > $script.new
99  chmod a+rx "$script.new"
100  mv "$script.new" "$script.adjusted"
101fi
102
103# Massage the mozilla startup script.
104script=$local/arch/share/bin/mozilla
105if [ -x "$script" ]; then
106  rm -f "$script.adjusted"
107  sed -e "s,$locker,$local,g" -e 's,^progname=.*$,progname=mozilla,' \
108    "$script" > $script.new
109  chmod a+rx "$script.new"
110  mv "$script.new" "$script.adjusted"
111fi
Note: See TracBrowser for help on using the repository browser.