1 | #!/bin/sh |
---|
2 | # Script to bounce the packs on an Athena workstation |
---|
3 | # |
---|
4 | # $Id: reactivate.sh,v 1.35 1997-12-15 07:27:37 ghudson Exp $ |
---|
5 | |
---|
6 | trap "" 1 15 |
---|
7 | |
---|
8 | PATH=/bin:/bin/athena:/usr/ucb:/usr/bin; export PATH |
---|
9 | HOSTTYPE=`/bin/athena/machtype`; export HOSTTYPE |
---|
10 | |
---|
11 | umask 22 |
---|
12 | . /etc/athena/rc.conf |
---|
13 | |
---|
14 | # Set various flags (based on environment and command-line) |
---|
15 | if [ "$1" = -detach ]; then |
---|
16 | dflags="" |
---|
17 | else |
---|
18 | dflags="-clean" |
---|
19 | fi |
---|
20 | |
---|
21 | if [ "$1" = -prelogin ]; then |
---|
22 | if [ "$PUBLIC" = "false" ]; then |
---|
23 | exit 0; |
---|
24 | fi |
---|
25 | echo "Cleaning up..." >> /dev/console |
---|
26 | full=false |
---|
27 | else |
---|
28 | full=true |
---|
29 | fi |
---|
30 | |
---|
31 | if [ -z "$USER" ]; then |
---|
32 | exec 1>/dev/console 2>&1 |
---|
33 | quiet=-q |
---|
34 | else |
---|
35 | echo "Reactivating workstation..." |
---|
36 | quiet="" |
---|
37 | fi |
---|
38 | |
---|
39 | # Flush all NFS uid mappings |
---|
40 | /bin/athena/fsid $quiet -p -a |
---|
41 | |
---|
42 | # Tell the Zephyr hostmanager to reset state |
---|
43 | if [ -f /var/athena/zhm.pid -a "$ZCLIENT" = true ] ; then |
---|
44 | /bin/kill -HUP `/bin/cat /var/athena/zhm.pid` |
---|
45 | fi |
---|
46 | |
---|
47 | # kdestroy from /tmp any ticket files that may have escaped other methods |
---|
48 | # of destruction, before we clear /tmp. |
---|
49 | for i in /tmp/tkt* /tmp/krb5cc*; do |
---|
50 | KRBTKFILE=$i /usr/athena/bin/kdestroy -f |
---|
51 | done |
---|
52 | |
---|
53 | if [ "$full" = true ]; then |
---|
54 | # Clean temporary areas (including temporary home directories) |
---|
55 | case "$HOSTTYPE" in |
---|
56 | sun4) |
---|
57 | cp -p /tmp/ps_data /var/athena/ps_data |
---|
58 | rm -rf /tmp/* > /dev/null 2>&1 |
---|
59 | cp -p /var/athena/ps_data /tmp/ps_data |
---|
60 | rm -f /var/athena/ps_data |
---|
61 | ;; |
---|
62 | *) |
---|
63 | rm -rf /tmp/* > /dev/null 2>&1 |
---|
64 | ;; |
---|
65 | esac |
---|
66 | rm -rf /var/athena/tmphomedir/* > /dev/null 2>&1 |
---|
67 | fi |
---|
68 | |
---|
69 | # Copy in latest password file |
---|
70 | if [ "$PUBLIC" = true ]; then |
---|
71 | if [ -r /srvd/etc/passwd ]; then |
---|
72 | cp -p /srvd/etc/passwd /etc/passwd.local |
---|
73 | chmod 644 /etc/passwd.local |
---|
74 | chown root /etc/passwd.local |
---|
75 | fi |
---|
76 | if [ -r /srvd/etc/shadow ]; then |
---|
77 | cp -p /srvd/etc/shadow /etc/shadow.local |
---|
78 | chmod 600 /etc/shadow.local |
---|
79 | chown root /etc/shadow.local |
---|
80 | fi |
---|
81 | fi |
---|
82 | |
---|
83 | # Restore password and group files |
---|
84 | if [ -f /etc/passwd.local ] ; then |
---|
85 | cp -p /etc/passwd.local /etc/ptmp && /bin/mv -f /etc/ptmp /etc/passwd |
---|
86 | fi |
---|
87 | if [ -f /etc/shadow.local ] ; then |
---|
88 | cp -p /etc/shadow.local /etc/stmp && /bin/mv -f /etc/stmp /etc/shadow |
---|
89 | fi |
---|
90 | if [ -f /etc/group.local ] ; then |
---|
91 | cp -p /etc/group.local /etc/gtmp && /bin/mv -f /etc/gtmp /etc/group |
---|
92 | fi |
---|
93 | |
---|
94 | if [ "$full" = true ]; then |
---|
95 | # Reconfigure AFS state |
---|
96 | if [ "$AFSCLIENT" != "false" ]; then |
---|
97 | /etc/athena/config_afs > /dev/null 2>&1 & |
---|
98 | fi |
---|
99 | fi |
---|
100 | |
---|
101 | # Punt any processes owned by users not in /etc/passwd. |
---|
102 | /etc/athena/cleanup -passwd |
---|
103 | |
---|
104 | if [ "$full" = true ]; then |
---|
105 | # Remove session files. |
---|
106 | for i in /var/athena/sessions/*; do |
---|
107 | # Sanity check. |
---|
108 | if [ -s $i ]; then |
---|
109 | logger -p user.notice "Non-empty session record $i" |
---|
110 | fi |
---|
111 | rm -f $i |
---|
112 | end |
---|
113 | |
---|
114 | # Detach all remote filesystems |
---|
115 | /bin/athena/detach -O -h -n $quiet $dflags -a |
---|
116 | |
---|
117 | # Now start activate again |
---|
118 | /etc/athena/save_cluster_info |
---|
119 | |
---|
120 | if [ -f /var/athena/clusterinfo.bsh ] ; then |
---|
121 | . /var/athena/clusterinfo.bsh |
---|
122 | elif [ "$RVDCLIENT" = true ]; then |
---|
123 | echo "Can't determine system packs location." |
---|
124 | exit 1 |
---|
125 | fi |
---|
126 | |
---|
127 | if [ "$RVDCLIENT" = true ]; then |
---|
128 | /bin/athena/attach $quiet -h -n -o hard -O $SYSLIB |
---|
129 | fi |
---|
130 | |
---|
131 | # Perform an update if appropriate |
---|
132 | /srvd/auto_update reactivate |
---|
133 | |
---|
134 | if [ "$PUBLIC" = true -a -f /srvd/.rvdinfo ]; then |
---|
135 | NEWVERS=`awk '{a=$5} END{print a}' /srvd/.rvdinfo` |
---|
136 | THISVERS=`awk '{a=$5} END{print a}' /etc/athena/version` |
---|
137 | if [ "$NEWVERS" = "$THISVERS" ]; then |
---|
138 | /usr/athena/etc/track |
---|
139 | cf=`cat /srvd/usr/athena/lib/update/configfiles` |
---|
140 | for i in $cf; do |
---|
141 | if [ -f /srvd$i ]; then |
---|
142 | cp -p /srvd$i $i |
---|
143 | else |
---|
144 | cp -p /os$i $i |
---|
145 | fi |
---|
146 | done |
---|
147 | ps -e | awk '$4=="inetd" {print $1}' | xargs kill -HUP |
---|
148 | fi |
---|
149 | rm -f /etc/athena/reactivate.local |
---|
150 | fi |
---|
151 | fi |
---|
152 | |
---|
153 | if [ -f /usr/athena/bin/access_off ]; then |
---|
154 | /usr/athena/bin/access_off |
---|
155 | fi |
---|
156 | |
---|
157 | if [ "$full" = true ]; then |
---|
158 | if [ -f /etc/athena/reactivate.local ]; then |
---|
159 | /etc/athena/reactivate.local |
---|
160 | fi |
---|
161 | fi |
---|
162 | |
---|
163 | exit 0 |
---|