1 | #!/bin/sh |
---|
2 | # Script to bounce the packs on an Athena workstation |
---|
3 | # |
---|
4 | # $Id: reactivate.sh,v 1.23 1996-05-09 02:45:54 cfields Exp $ |
---|
5 | |
---|
6 | trap "" 1 15 |
---|
7 | |
---|
8 | PATH=/bin:/bin/athena:/usr/ucb:/usr/bin; export PATH |
---|
9 | |
---|
10 | umask 22 |
---|
11 | . /etc/athena/rc.conf |
---|
12 | |
---|
13 | # Default options |
---|
14 | dflags="-clean" |
---|
15 | |
---|
16 | |
---|
17 | # Set various flags (based on environment and command-line) |
---|
18 | if [ "$1" = "-detach" ]; then dflags=""; fi |
---|
19 | |
---|
20 | if [ "$1" = "-prelogin" ]; then |
---|
21 | if [ "${PUBLIC}" = "false" ]; then exit 0; fi |
---|
22 | echo "Cleaning up..." >> /dev/console |
---|
23 | else |
---|
24 | full=true |
---|
25 | fi |
---|
26 | |
---|
27 | if [ "${USER}" = "" ]; then |
---|
28 | exec 1>/dev/console 2>&1 |
---|
29 | quiet=-q |
---|
30 | else |
---|
31 | echo Reactivating workstation... |
---|
32 | quiet= |
---|
33 | fi |
---|
34 | |
---|
35 | case "${SYSTEM}" in |
---|
36 | ULTRIX*) |
---|
37 | cp=/bin/cp |
---|
38 | ;; |
---|
39 | *) |
---|
40 | cp="/bin/cp -p" |
---|
41 | esac |
---|
42 | |
---|
43 | # Flush all NFS uid mappings |
---|
44 | /bin/athena/fsid $quiet -p -a |
---|
45 | |
---|
46 | # Sun attach bug workaround. Attach apparently loses on some options. |
---|
47 | # fsid does not though, so we zap them only after executing fsid. |
---|
48 | if [ "${MACHINE}" = "SUN4" ]; then |
---|
49 | dflags="" |
---|
50 | quiet="" |
---|
51 | fi |
---|
52 | |
---|
53 | # Tell the Zephyr hostmanager to reset state |
---|
54 | if [ -f /etc/athena/zhm.pid -a "${ZCLIENT}" = "true" ] ; then |
---|
55 | /bin/kill -HUP `/bin/cat /etc/athena/zhm.pid` |
---|
56 | fi |
---|
57 | |
---|
58 | case "${MACHINE}" in |
---|
59 | RSAIX) |
---|
60 | chmod 666 /dev/hft |
---|
61 | ;; |
---|
62 | *) |
---|
63 | ;; |
---|
64 | esac |
---|
65 | |
---|
66 | # kdestroy from /tmp any ticket files that may have escaped other methods |
---|
67 | # of destruction, before we clear /tmp. |
---|
68 | for i in /tmp/tkt* /tmp/krb5cc*; do |
---|
69 | KRBTKFILE=$i /usr/athena/bin/kdestroy -f |
---|
70 | done |
---|
71 | |
---|
72 | if [ $full ]; then # START tmp clean |
---|
73 | # Clean temporary areas (including temporary home directories) |
---|
74 | case "${MACHINE}" in |
---|
75 | RSAIX) |
---|
76 | find /tmp -depth \( -type f -o -type l \) -print | xargs /bin/rm -f - |
---|
77 | find /tmp -depth -type d -print | xargs /bin/rmdir 1>/dev/null 2>&1 |
---|
78 | ;; |
---|
79 | |
---|
80 | SUN4) |
---|
81 | cp -p /tmp/ps_data /usr/tmp/ps_data |
---|
82 | /bin/rm -rf /tmp/* > /dev/null 2>&1 |
---|
83 | cp -p /usr/tmp/ps_data /tmp/ps_data |
---|
84 | /bin/rm -f /usr/tmp/ps_data |
---|
85 | ;; |
---|
86 | INDY) |
---|
87 | /bin/rm -rf /tmp/* > /dev/null 2>&1 |
---|
88 | ;; |
---|
89 | *) |
---|
90 | /bin/mv /tmp/.X11-unix /tmp/../.X11-unix |
---|
91 | /bin/rm -rf /tmp/ > /dev/null 2>&1 |
---|
92 | /bin/mv /tmp/../.X11-unix /tmp/.X11-unix |
---|
93 | ;; |
---|
94 | esac |
---|
95 | fi # END tmp clean |
---|
96 | |
---|
97 | # Copy in latest password file |
---|
98 | if [ "${PUBLIC}" = "true" ]; then |
---|
99 | if [ -r /srvd/etc/passwd ]; then |
---|
100 | ${cp} /srvd/etc/passwd /etc/passwd.local |
---|
101 | chmod 644 /etc/passwd.local |
---|
102 | chown root /etc/passwd.local |
---|
103 | fi |
---|
104 | if [ -r /srvd/etc/shadow ]; then |
---|
105 | ${cp} /srvd/etc/shadow /etc/shadow.local |
---|
106 | chmod 600 /etc/shadow.local |
---|
107 | chown root /etc/shadow.local |
---|
108 | fi |
---|
109 | fi |
---|
110 | |
---|
111 | # Restore password and group files |
---|
112 | case "${MACHINE}" in |
---|
113 | RSAIX) |
---|
114 | ;; |
---|
115 | *) |
---|
116 | if [ -f /etc/passwd.local ] ; then |
---|
117 | ${cp} /etc/passwd.local /etc/ptmp && /bin/mv -f /etc/ptmp /etc/passwd |
---|
118 | fi |
---|
119 | if [ -f /etc/shadow.local ] ; then |
---|
120 | ${cp} /etc/shadow.local /etc/stmp && /bin/mv -f /etc/stmp /etc/shadow |
---|
121 | fi |
---|
122 | if [ -f /etc/group.local ] ; then |
---|
123 | ${cp} /etc/group.local /etc/gtmp && /bin/mv -f /etc/gtmp /etc/group |
---|
124 | fi |
---|
125 | ;; |
---|
126 | esac |
---|
127 | |
---|
128 | if [ $full ]; then # START AFS reconfig |
---|
129 | # Reconfigure AFS state |
---|
130 | if [ "${AFSCLIENT}" != "false" ]; then |
---|
131 | if [ -f /afs/athena.mit.edu/service/aklog ] ; then |
---|
132 | ${cp} /afs/athena.mit.edu/service/aklog /bin/athena/aklog.new && \ |
---|
133 | test -s /bin/athena/aklog.new && \ |
---|
134 | /bin/mv /bin/athena/aklog.new /bin/athena/aklog |
---|
135 | /bin/rm -f /bin/athena/aklog.new |
---|
136 | fi |
---|
137 | /etc/athena/config_afs > /dev/null 2>&1 & |
---|
138 | fi |
---|
139 | fi # END AFS reconfig |
---|
140 | |
---|
141 | # punt any processes owned by users not in /etc/passwd |
---|
142 | /etc/athena/cleanup -passwd |
---|
143 | |
---|
144 | if [ $full ]; then # START time-consuming stuff |
---|
145 | # Finally, detach all remote filesystems |
---|
146 | /bin/athena/detach -O -h -n $quiet $dflags -a |
---|
147 | |
---|
148 | # Now start activate again |
---|
149 | /etc/athena/save_cluster_info |
---|
150 | |
---|
151 | if [ -f /etc/athena/clusterinfo.bsh ] ; then |
---|
152 | . /etc/athena/clusterinfo.bsh |
---|
153 | else |
---|
154 | if [ "${RVDCLIENT}" = "true" ]; then |
---|
155 | echo "Can't find library servers." |
---|
156 | exit 1 |
---|
157 | fi |
---|
158 | fi |
---|
159 | |
---|
160 | if [ "${RVDCLIENT}" = "true" ]; then |
---|
161 | /bin/athena/attach $quiet -h -n -o hard $SYSLIB |
---|
162 | fi |
---|
163 | |
---|
164 | # Perform an update if appropriate |
---|
165 | if [ "${AUTOUPDATE}" = "true" -a -f /srvd/auto_update ]; then |
---|
166 | /srvd/auto_update reactivate |
---|
167 | elif [ -f /srvd/.rvdinfo ]; then |
---|
168 | NEWVERS=`awk '{a=$5}; END{print a}' /srvd/.rvdinfo` |
---|
169 | VERSION=`awk '{a=$5}; END{print a}' /etc/athena/version` |
---|
170 | if [ "${NEWVERS}" != "${VERSION}" ]; then |
---|
171 | cat <<EOF |
---|
172 | The workstation software version ($VERSION) does not match the |
---|
173 | version on the system packs ($NEWVERS). A new version of software |
---|
174 | may be available. Please contact Athena Operations (x3-1410) to |
---|
175 | have your workstation updated. |
---|
176 | EOF |
---|
177 | if [ ! -f /usr/tmp/update.check -a -f /usr/ucb/logger ]; then |
---|
178 | /usr/ucb/logger -t `hostname` -p user.notice at revision $VERSION |
---|
179 | cp /dev/null /usr/tmp/update.check |
---|
180 | fi |
---|
181 | fi |
---|
182 | fi |
---|
183 | fi # END time-consuming stuff |
---|
184 | |
---|
185 | if [ -f /usr/athena/bin/access_off ]; then /usr/athena/bin/access_off; fi |
---|
186 | |
---|
187 | if [ $full ]; then # START reactivate.local |
---|
188 | if [ -f /etc/athena/reactivate.local ]; then |
---|
189 | /etc/athena/reactivate.local |
---|
190 | fi |
---|
191 | fi # END reactivate.local |
---|
192 | |
---|
193 | exit 0 |
---|