source: trunk/packs/maint/config_afs.sh @ 17466

Revision 17466, 2.5 KB checked in by ghudson, 22 years ago (diff)
Fix syntax error.
  • Property svn:executable set to *
Line 
1#!/bin/sh -
2#
3# $Id: config_afs.sh,v 1.20 2002-04-09 16:33:41 ghudson Exp $
4#
5# This script configures the workstation's notion of AFS.
6# 1. It updates the cell location information from /usr/vice/etc/CellServDB
7# 2. It updates the cell setuid information from /usr/vice/etc/SuidCells
8# 3. It updates the cell alias information from /usr/vice/etc/CellAlias
9PATH=/bin:/bin/athena:/usr/bin; export PATH
10
11VICEDIR=/usr/vice/etc
12CELLDB=${VICEDIR}/CellServDB
13SUIDDB=${VICEDIR}/SuidCells
14ALIAS=${VICEDIR}/CellAlias
15HOSTTYPE=`/bin/athena/machtype`
16
17echo "Updating cell location information"
18rm -f ${VICEDIR}/Ctmp
19cp /afs/athena.mit.edu/service/CellServDB ${VICEDIR}/Ctmp &&
20        [ -s ${VICEDIR}/Ctmp ] &&
21        mv -f ${VICEDIR}/Ctmp ${CELLDB}.public &&
22        cat ${CELLDB}.public ${CELLDB}.local >${VICEDIR}/Ctmp 2>/dev/null
23[ -s ${VICEDIR}/Ctmp ] && {
24        cmp -s ${VICEDIR}/Ctmp ${CELLDB} || {
25                rm -f ${CELLDB}.last &&
26                ln ${CELLDB} ${CELLDB}.last &&
27                mv -f ${VICEDIR}/Ctmp ${CELLDB} &&
28                chmod 644 ${CELLDB} &&
29                sync &&
30                awk '
31                        /^>/ {printf("\nfs newcell %s", \
32                                substr($1,2,length($1)-1))};
33                        /^[0-9]/ {printf(" %s",$1)};
34                        END {printf("\n")}' ${CELLDB} | sh
35        }
36}
37
38echo "Updating setuid cell information"
39rm -f ${VICEDIR}/Ctmp
40cp /afs/athena.mit.edu/service/SuidCells ${VICEDIR}/Ctmp &&
41        [ -s ${VICEDIR}/Ctmp ] &&
42        mv -f ${VICEDIR}/Ctmp ${SUIDDB}.public &&
43        cat ${SUIDDB}.public ${SUIDDB}.local >${VICEDIR}/Ctmp 2>/dev/null
44[ -s ${VICEDIR}/Ctmp ] &&
45        mv -f ${VICEDIR}/Ctmp ${SUIDDB} &&
46        chmod 644 ${SUIDDB}
47
48echo "Only allowing setuid/setgid programs from the following cells:"
49
50for cellname in `/etc/athena/listsuidcells`; do
51        fs setcell "$cellname" -nosuid
52done
53cat ${SUIDDB} | awk '
54        /^-$/   { numcells = 0; exit; }
55        /^-/    { suid[substr($1,2,length($1)-1)] = 0; }
56        /^[^-]/ { suid[$1] = 1;
57                  cells[numcells++] = $1; }
58        END     { for (i = 0; i < numcells; i++) {
59                        if (suid[cells[i]]) {
60                                printf("fs setcell %s -suid\n", cells[i]);
61                                printf("echo %s\n", cells[i]); } } }' | sh
62
63
64if [ sgi != "$HOSTTYPE" ]; then
65    echo "Updating cell alias information"
66    rm -f ${VICEDIR}/Ctmp
67    cp /afs/athena.mit.edu/service/CellAlias ${VICEDIR}/Ctmp &&
68            [ -s ${VICEDIR}/Ctmp ] &&
69            mv -f ${VICEDIR}/Ctmp ${ALIAS}.public &&
70            cat ${ALIAS}.public ${ALIAS}.local >${VICEDIR}/Ctmp 2>/dev/null
71    [ -s ${VICEDIR}/Ctmp ] && {
72            cmp -s ${VICEDIR}/Ctmp ${ALIAS} || {
73                    rm -f ${ALIAS}.last &&
74                    mv -f ${VICEDIR}/Ctmp ${ALIAS} &&
75                    chmod 644 ${ALIAS} &&
76                    sync &&
77                    awk '
78                            /^#/ {next} \
79                            NF == 2 {print "fs newalias",$2,$1}' ${ALIAS} \
80                        | sh
81            }
82    }
83fi
84
85exit 0
Note: See TracBrowser for help on using the repository browser.