source: trunk/packs/maint/reactivate.sh @ 8380

Revision 8380, 4.7 KB checked in by cfields, 28 years ago (diff)
Add /tmp clean for INDY. Copy in a new password file from AFS for PUBLIC=true every time. Clean up *.local -> * copies.
Line 
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
6trap "" 1 15
7
8PATH=/bin:/bin/athena:/usr/ucb:/usr/bin; export PATH
9
10umask 22
11. /etc/athena/rc.conf
12
13# Default options
14dflags="-clean"
15
16
17# Set various flags (based on environment and command-line)
18if [ "$1" = "-detach" ]; then dflags=""; fi
19
20if [ "$1" = "-prelogin" ]; then
21        if [ "${PUBLIC}" = "false" ]; then exit 0; fi
22        echo "Cleaning up..." >> /dev/console
23else
24        full=true
25fi
26
27if [ "${USER}" = "" ]; then
28        exec 1>/dev/console 2>&1
29        quiet=-q
30else
31        echo Reactivating workstation...
32        quiet=
33fi
34
35case "${SYSTEM}" in
36ULTRIX*)
37        cp=/bin/cp
38        ;;
39*)
40        cp="/bin/cp -p"
41esac
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.
48if [ "${MACHINE}" = "SUN4" ]; then
49        dflags=""
50        quiet=""
51fi
52
53# Tell the Zephyr hostmanager to reset state
54if [ -f /etc/athena/zhm.pid -a "${ZCLIENT}" = "true" ] ; then
55        /bin/kill -HUP `/bin/cat /etc/athena/zhm.pid`
56fi
57
58case "${MACHINE}" in
59RSAIX)
60        chmod 666 /dev/hft
61        ;;
62*)
63        ;;
64esac
65
66# kdestroy from /tmp any ticket files that may have escaped other methods
67# of destruction, before we clear /tmp.
68for i in /tmp/tkt* /tmp/krb5cc*; do
69  KRBTKFILE=$i /usr/athena/bin/kdestroy -f
70done
71
72if [ $full ]; then              # START tmp clean
73# Clean temporary areas (including temporary home directories)
74case "${MACHINE}" in
75RSAIX)
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
80SUN4)
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        ;;
86INDY)
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        ;;
94esac
95fi                              # END tmp clean
96
97# Copy in latest password file
98if [ "${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
109fi
110
111# Restore password and group files
112case "${MACHINE}" in
113RSAIX)
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        ;;
126esac
127
128if [ $full ]; then              # START AFS reconfig
129# Reconfigure AFS state
130if [ "${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 &
138fi
139fi                              # END AFS reconfig
140
141# punt any processes owned by users not in /etc/passwd
142/etc/athena/cleanup -passwd
143
144if [ $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
151if [ -f /etc/athena/clusterinfo.bsh ] ; then
152        . /etc/athena/clusterinfo.bsh
153else
154        if [ "${RVDCLIENT}" = "true" ]; then
155                echo "Can't find library servers."
156                exit 1
157        fi
158fi
159
160if [ "${RVDCLIENT}" = "true" ]; then
161        /bin/athena/attach      $quiet -h -n -o hard  $SYSLIB
162fi
163
164# Perform an update if appropriate
165if [ "${AUTOUPDATE}" = "true" -a -f /srvd/auto_update ]; then
166        /srvd/auto_update reactivate
167elif [ -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
172The workstation software version ($VERSION) does not match the
173version on the system packs ($NEWVERS).  A new version of software
174may be available.  Please contact Athena Operations (x3-1410) to
175have your workstation updated.
176EOF
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
182fi
183fi                              # END time-consuming stuff
184
185if [ -f /usr/athena/bin/access_off ]; then /usr/athena/bin/access_off; fi
186
187if [ $full ]; then              # START reactivate.local
188if [ -f /etc/athena/reactivate.local ]; then
189        /etc/athena/reactivate.local
190fi
191fi                              # END reactivate.local
192
193exit 0
Note: See TracBrowser for help on using the repository browser.