[4333] | 1 | #!/bin/sh |
---|
| 2 | # Script to bounce the packs on an Athena workstation |
---|
| 3 | # |
---|
[10907] | 4 | # $Id: reactivate.sh,v 1.35 1997-12-15 07:27:37 ghudson Exp $ |
---|
[4333] | 5 | |
---|
| 6 | trap "" 1 15 |
---|
| 7 | |
---|
[5355] | 8 | PATH=/bin:/bin/athena:/usr/ucb:/usr/bin; export PATH |
---|
[10741] | 9 | HOSTTYPE=`/bin/athena/machtype`; export HOSTTYPE |
---|
[4333] | 10 | |
---|
| 11 | umask 22 |
---|
[5355] | 12 | . /etc/athena/rc.conf |
---|
[4333] | 13 | |
---|
[5526] | 14 | # Set various flags (based on environment and command-line) |
---|
[10741] | 15 | if [ "$1" = -detach ]; then |
---|
| 16 | dflags="" |
---|
| 17 | else |
---|
| 18 | dflags="-clean" |
---|
| 19 | fi |
---|
[5526] | 20 | |
---|
[10741] | 21 | if [ "$1" = -prelogin ]; then |
---|
| 22 | if [ "$PUBLIC" = "false" ]; then |
---|
| 23 | exit 0; |
---|
| 24 | fi |
---|
[7311] | 25 | echo "Cleaning up..." >> /dev/console |
---|
[10741] | 26 | full=false |
---|
[7311] | 27 | else |
---|
| 28 | full=true |
---|
| 29 | fi |
---|
| 30 | |
---|
[10741] | 31 | if [ -z "$USER" ]; then |
---|
[4333] | 32 | exec 1>/dev/console 2>&1 |
---|
| 33 | quiet=-q |
---|
| 34 | else |
---|
[10741] | 35 | echo "Reactivating workstation..." |
---|
| 36 | quiet="" |
---|
[4333] | 37 | fi |
---|
| 38 | |
---|
| 39 | # Flush all NFS uid mappings |
---|
[4334] | 40 | /bin/athena/fsid $quiet -p -a |
---|
[4333] | 41 | |
---|
| 42 | # Tell the Zephyr hostmanager to reset state |
---|
[10741] | 43 | if [ -f /var/athena/zhm.pid -a "$ZCLIENT" = true ] ; then |
---|
[9804] | 44 | /bin/kill -HUP `/bin/cat /var/athena/zhm.pid` |
---|
[4333] | 45 | fi |
---|
| 46 | |
---|
[7503] | 47 | # kdestroy from /tmp any ticket files that may have escaped other methods |
---|
| 48 | # of destruction, before we clear /tmp. |
---|
[7836] | 49 | for i in /tmp/tkt* /tmp/krb5cc*; do |
---|
[10741] | 50 | KRBTKFILE=$i /usr/athena/bin/kdestroy -f |
---|
[7503] | 51 | done |
---|
| 52 | |
---|
[10741] | 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 |
---|
[10907] | 58 | rm -rf /tmp/* > /dev/null 2>&1 |
---|
[10741] | 59 | cp -p /var/athena/ps_data /tmp/ps_data |
---|
| 60 | rm -f /var/athena/ps_data |
---|
| 61 | ;; |
---|
| 62 | *) |
---|
[10907] | 63 | rm -rf /tmp/* > /dev/null 2>&1 |
---|
[10741] | 64 | ;; |
---|
| 65 | esac |
---|
| 66 | rm -rf /var/athena/tmphomedir/* > /dev/null 2>&1 |
---|
| 67 | fi |
---|
[6662] | 68 | |
---|
[8380] | 69 | # Copy in latest password file |
---|
[10741] | 70 | if [ "$PUBLIC" = true ]; then |
---|
[8380] | 71 | if [ -r /srvd/etc/passwd ]; then |
---|
[10741] | 72 | cp -p /srvd/etc/passwd /etc/passwd.local |
---|
| 73 | chmod 644 /etc/passwd.local |
---|
| 74 | chown root /etc/passwd.local |
---|
[8380] | 75 | fi |
---|
| 76 | if [ -r /srvd/etc/shadow ]; then |
---|
[10741] | 77 | cp -p /srvd/etc/shadow /etc/shadow.local |
---|
| 78 | chmod 600 /etc/shadow.local |
---|
| 79 | chown root /etc/shadow.local |
---|
[8380] | 80 | fi |
---|
| 81 | fi |
---|
| 82 | |
---|
[5526] | 83 | # Restore password and group files |
---|
[10741] | 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 |
---|
[5355] | 93 | |
---|
[10741] | 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 |
---|
[4333] | 99 | fi |
---|
| 100 | |
---|
[10741] | 101 | # Punt any processes owned by users not in /etc/passwd. |
---|
[4333] | 102 | /etc/athena/cleanup -passwd |
---|
| 103 | |
---|
[10741] | 104 | if [ "$full" = true ]; then |
---|
[10876] | 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 | |
---|
[10741] | 114 | # Detach all remote filesystems |
---|
| 115 | /bin/athena/detach -O -h -n $quiet $dflags -a |
---|
[4333] | 116 | |
---|
[10741] | 117 | # Now start activate again |
---|
| 118 | /etc/athena/save_cluster_info |
---|
[4333] | 119 | |
---|
[10741] | 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." |
---|
[4333] | 124 | exit 1 |
---|
| 125 | fi |
---|
| 126 | |
---|
[10741] | 127 | if [ "$RVDCLIENT" = true ]; then |
---|
| 128 | /bin/athena/attach $quiet -h -n -o hard -O $SYSLIB |
---|
| 129 | fi |
---|
[4333] | 130 | |
---|
[10741] | 131 | # Perform an update if appropriate |
---|
| 132 | /srvd/auto_update reactivate |
---|
[8529] | 133 | |
---|
[10741] | 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 |
---|
[10830] | 147 | ps -e | awk '$4=="inetd" {print $1}' | xargs kill -HUP |
---|
[10741] | 148 | fi |
---|
| 149 | rm -f /etc/athena/reactivate.local |
---|
[10643] | 150 | fi |
---|
| 151 | fi |
---|
[4334] | 152 | |
---|
[10741] | 153 | if [ -f /usr/athena/bin/access_off ]; then |
---|
| 154 | /usr/athena/bin/access_off |
---|
| 155 | fi |
---|
[4333] | 156 | |
---|
[10741] | 157 | if [ "$full" = true ]; then |
---|
| 158 | if [ -f /etc/athena/reactivate.local ]; then |
---|
| 159 | /etc/athena/reactivate.local |
---|
| 160 | fi |
---|
[4333] | 161 | fi |
---|
| 162 | |
---|
| 163 | exit 0 |
---|