123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556 |
- XCOMM!/bin/ksh
- XCOMM $XConsortium: dtconfig.src /main/5 1996/04/23 12:12:10 drk $
- XCOMM (c) Copyright 1996 Digital Equipment Corporation.
- XCOMM (c) Copyright 1993,1994,1996 Hewlett-Packard Company.
- XCOMM (c) Copyright 1993,1994,1996 International Business Machines Corp.
- XCOMM (c) Copyright 1993,1994,1996 Sun Microsystems, Inc.
- XCOMM (c) Copyright 1993,1994,1996 Novell, Inc.
- XCOMM (c) Copyright 1996 FUJITSU LIMITED.
- XCOMM (c) Copyright 1996 Hitachi.
- XCOMM (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
- XCOMM Novell, Inc.
- XCOMM
- XCOMM This version of the CDE dtconfig script is for use in the Solaris(TM)
- XCOMM operating environment.
- XCOMM
- XCOMM Common Desktop Environment
- XCOMM
- XCOMM This script can be run after CDE installation to configure CDE within
- XCOMM the host platforms operating environment. For example, when auto-start
- XCOMM is selected, the CDE desktop login window will be displayed at end of the
- XCOMM workstation's power up boot cycle.
- XCOMM
- XCOMM Location: CDE_INSTALLATION_TOP/bin/dtconfig
- #define HASH #
- mode=$1
- arg_count=$#
- prg_name=$0
- Message()
- {
- HASH Message() - display message from dtconfig.cat
- HASH $1 - message id
- HASH $2 - fallback message text
- if [ -x $DTDSPMSG ]; then
- $DTDSPMSG -s 20 dtconfig $1 "$2" "$3"
- echo " "
- else
- echo "$2"
- fi
- }
- usage_error() {
- echo " "
- Message 1 " CDE configuration utility"
- echo " "
- Message 2 " $prg_name -d (disable auto-start)" $prg_name
- Message 3 " $prg_name -e (enable auto-start)" $prg_name
- Message 4 " $prg_name -kill (kill dtlogin)" $prg_name
- Message 5 " $prg_name -reset (reset dtlogin)" $prg_name
- Message 6 " $prg_name -p (printer action update)" $prg_name
- Message 25 " $prg_name -inetd (inetd.conf /usr/dt daemons)" $prg_name
- Message 26 " $prg_name -inetd.ow (inetd.conf /usr/openwin daemons)" $prg_name
- echo " "
- }
- XCOMM
- XCOMM Allow for configured and factory versions of dtlogin.rc
- XCOMM
- if [ -f CDE_CONFIGURATION_TOP/config/dtlogin.rc ]
- then
- RC_MASTER=CDE_CONFIGURATION_TOP/config/dtlogin.rc
- elif [ -f CDE_INSTALLATION_TOP/config/dtlogin.rc ]
- then
- RC_MASTER=CDE_INSTALLATION_TOP/config/dtlogin.rc
- fi
- RC_COPY=/etc/init.d/dtlogin
- XCOMM
- XCOMM Allow for configured and factory versions of dtlogin.xml
- XCOMM
- if [ -f CDE_CONFIGURATION_TOP/config/dtlogin.xml ]
- then
- SVC_MASTER=CDE_CONFIGURATION_TOP/config/dtlogin.xml
- elif [ -f CDE_INSTALLATION_TOP/config/dtlogin.xml ]
- then
- SVC_MASTER=CDE_INSTALLATION_TOP/config/dtlogin.xml
- fi
- SVC_COPY=application/graphical-login/dtlogin
- LEVEL_0_KILL=/etc/rc0.d/K10dtlogin
- LEVEL_1_KILL=/etc/rc1.d/K10dtlogin
- LEVEL_2_START=/etc/rc2.d/S99dtlogin
- DTDSPMSG=/usr/dt/bin/dtdspmsg
- NAWK=/usr/bin/nawk
- set `/bin/id`
- if [ $1 != "uid=0(root)" ]; then
- Message 7 "$prg_name: this script must be run as root" $prg_name
- exit 1
- fi
- if [ $arg_count -ne 1 ]; then
- echo " "
- HASH
- HASH Display error message for too many arguments
- HASH
- if [ $arg_count -gt 1 ]; then
- Message 8 "Usage: Too many arguments"
-
- HASH
- HASH Display error message for NULL arguments passed
- HASH
- elif [ $arg_count -eq 0 ]; then
- Message 9 "Usage: Needs one argument"
-
- fi
- usage_error
- exit 1
- fi
- rc_master_check() {
- if [ ! -x $RC_MASTER ]; then
- Message 10 "option failed"
- Message 11 "could not execute $RC_MASTER" $RC_MASTER
- exit 1
- fi
- }
- nawk_check() {
- if [ ! -x $NAWK ]; then
- Message 10 "option failed"
- Message 11 "could not execute $NAWK" $NAWK
- exit 1
- fi
- }
- XCOMM Following inetdSP() procedure is from Sun CDE SI post_install
- XCOMM configMin file. It adds the Subprocess Control daemon inetd.conf
- XCOMM line so it points to /usr/dt/bin/dtspcd.
- inetdSP()
- {
- FILE=/etc/inetd.conf
- TMPFILE=/tmp/inetd.conf
- XCOMM
- XCOMM check for existence of /etc/inetd.conf
- XCOMM
- if [ ! -f $FILE ] # highly unlikely
- then
- echo "" >$FILE
- fi
- XCOMM
- XCOMM see if it already exists
- XCOMM
- $NAWK '{if ($1 == "dtspc")
- print $0 > "/tmp/dtspc-already-there"
- }' $FILE >/dev/null
- DTSPCD=CDE_INSTALLATION_TOP/bin/dtspcd
- if [ ! -f /tmp/dtspc-already-there ]
- then
- echo "dtspc stream tcp nowait root $DTSPCD $DTSPCD" >>$FILE
- else
- rm /tmp/dtspc-already-there
- fi
- XCOMM
- XCOMM remove legacy entries like dtspcd
- XCOMM
- $NAWK '{if ($1 == "dtspcd" || $1 == "#dtspcd")
- ;
- else
- print $0
- }' $FILE >$TMPFILE
- cp $TMPFILE $FILE
- rm $TMPFILE
- FILE=/etc/services
- TMPFILE=/tmp/services
- XCOMM
- XCOMM check for existence of /etc/services
- XCOMM
- if [ ! -f $FILE ] # highly unlikely
- then
- echo "" >$FILE
- fi
- XCOMM
- XCOMM see if it already exists
- XCOMM
- $NAWK '{if ($1 == "dtspc")
- print $0 > "/tmp/dtspc-already-there"
- }' $FILE >/dev/null
- if [ ! -f /tmp/dtspc-already-there ]
- then
- echo "dtspc\t6112/tcp\t#subprocess control" >>$FILE
- else
- rm /tmp/dtspc-already-there
- fi
- XCOMM
- XCOMM remove legacy entries like dtspcd
- XCOMM
- $NAWK '{if ($1 == "dtspcd" || $1 == "#dtspcd")
- ;
- else
- print $0
- }' $FILE >$TMPFILE
- cp $TMPFILE $FILE
- rm $TMPFILE
- }
- XCOMM Following inetdTT() procedure code from Sun CDE SI post_install
- XCOMM configTT file. It updates the ToolTalk daemon inetd.conf
- XCOMM line so it points to /usr/dt/bin/rpc.ttdbserverd.
- inetdTT()
- {
- FILE=/etc/inetd.conf
- TMPFILE=/tmp/inetd.conf
- TTDBSERVERD=CDE_INSTALLATION_TOP/bin/rpc.ttdbserverd
- XCOMM
- XCOMM remove any non-dt ttdbserverd line
- XCOMM
- $NAWK -v ttdb=$TTDBSERVERD \
- '{if ($1 == "100083/1" && $6 != ttdb)
- ;
- else
- print $0
- }' $FILE >$TMPFILE
- cp $TMPFILE $FILE
- rm $TMPFILE
- XCOMM
- XCOMM add dt ttdbserverd line if its not already there
- XCOMM
- $NAWK '{if ($1 == "100083/1")
- print $0 > "/tmp/tt-already-there"
- }' $FILE >/dev/null
- if [ ! -f /tmp/tt-already-there ]
- then
- echo "100083/1 stream rpc/tcp wait root $TTDBSERVERD $TTDBSERVERD" \
- >>$FILE
- else
- rm /tmp/tt-already-there
- fi
- }
- XCOMM Following owTT() procedure updates the ToolTalk daemon inetd.conf
- XCOMM line so it points to /usr/openwin/bin/rpc.ttdbserverd.
- owTT()
- {
- FILE=/etc/inetd.conf
- TMPFILE=/tmp/inetd.conf
- TTDBSERVERD=/usr/openwin/bin/rpc.ttdbserverd
- XCOMM
- XCOMM remove any non-ow ttdbserverd line
- XCOMM
- $NAWK -v ttdb=$TTDBSERVERD \
- '{if ($1 == "100083/1" && $6 != ttdb)
- ;
- else
- print $0
- }' $FILE >$TMPFILE
- cp $TMPFILE $FILE
- rm $TMPFILE
- XCOMM
- XCOMM add ow ttdbserverd line if its not already there
- XCOMM
- $NAWK '{if ($1 == "100083/1")
- print $0 > "/tmp/tt-already-there"
- }' $FILE >/dev/null
- if [ ! -f /tmp/tt-already-there ]
- then
- echo "100083/1 stream rpc/tcp wait root $TTDBSERVERD $TTDBSERVERD" \
- >>$FILE
- else
- rm /tmp/tt-already-there
- fi
- }
- XCOMM Following inetdCM() procedure is from Sun CDE SI post_install
- XCOMM configRun file. It updates the Calendar Manager daemon inetd.conf
- XCOMM line so it points to /usr/dt/bin/rpc.cmsd.
- inetdCM()
- {
- FILE=/etc/inetd.conf
- TMPFILE=/tmp/inetd.conf
- CMSD=CDE_INSTALLATION_TOP/bin/rpc.cmsd
- XCOMM
- XCOMM remove any non-dt rpc.cmsd line
- XCOMM
- $NAWK -v cmsd=$CMSD \
- '{if ( ($1 == "100068/2-4" || $1 == "100068/2-5") && $6 != cmsd)
- ;
- else
- print $0
- }' $FILE >$TMPFILE
- cp $TMPFILE $FILE
- rm $TMPFILE
- XCOMM
- XCOMM remove possible old dt cmsd level 2-4 entry
- XCOMM
- $NAWK -v cmsd=$CMSD \
- '{if ($1 == "100068/2-4" && $6 == cmsd)
- ;
- else
- print $0
- }' $FILE >$TMPFILE
- cp $TMPFILE $FILE
- rm $TMPFILE
- XCOMM
- XCOMM add dt cmsd line in needed
- XCOMM
- $NAWK -v cmsd=$CMSD \
- '{if ($6 == cmsd && $1 == "100068/2-5")
- print $0 > "/tmp/cmsd-already-there"
- }' $FILE >/dev/null
- if [ ! -f /tmp/cmsd-already-there ]
- then
- echo "100068/2-5 dgram rpc/udp wait root $CMSD rpc.cmsd" >>$FILE
- else
- rm /tmp/cmsd-already-there
- fi
- }
- XCOMM Following owCM() procedure updates the Calendar Manager daemon inetd.conf
- XCOMM line so it points to /usr/openwin/bin/cmsd.
- owCM()
- {
- FILE=/etc/inetd.conf
- TMPFILE=/tmp/inetd.conf
- CMSD=/usr/openwin/bin/rpc.cmsd
- XCOMM
- XCOMM remove any non-ow rpc.cmsd line
- XCOMM
- $NAWK -v cmsd=$CMSD \
- '{if ( ($1 == "100068/2-4" || $1 == "100068/2-5") && $6 != cmsd )
- ;
- else
- print $0
- }' $FILE >$TMPFILE
- cp $TMPFILE $FILE
- rm $TMPFILE
- XCOMM
- XCOMM add openwin rpc.cmsd line if not already there
- XCOMM
- $NAWK -v cmsd=$CMSD \
- '{if ( ($1 == "100068/2-4" || $1 == "100068/2-5") && $6 == cmsd )
- print $0 > "/tmp/cmsd-already-there"
- }' $FILE >/dev/null
- XCOMM
- XCOMM if it is not there, add it
- XCOMM (note openwin cmsd is one rev back, its at level 2-4)
- XCOMM
- if [ ! -f /tmp/cmsd-already-there ]
- then
- echo "100068/2-4 dgram rpc/udp wait root $CMSD rpc.cmsd" >>$FILE
- else
- rm /tmp/cmsd-already-there
- fi
- }
- case "$mode" in
- '-d')
- if [ -f /usr/sbin/svcadm ]; then
- if svcs $SVC_COPY >/dev/null 2>&1; then
- if ! svcadm disable $SVC_COPY >/dev/null; then
- Message 12 "disable failed"
- Message 13 "could not disable dtlogin service" "svc-dtlogin"
- exit 1
- fi
- fi
- else
- /usr/bin/rm -f $LEVEL_2_START
- if [ -f $LEVEL_2_START ]; then
- Message 12 "disable failed"
- Message 13 "could not remove $LEVEL_2_START" $LEVEL_2_START
- exit 1
- fi
- fi
- Message 14 "done"
- Message 15 "desktop auto-start disabled."
- ;;
- '-e')
- if [ -f /usr/sbin/svcadm ]; then
- if ! svcs $SVC_COPY >/dev/null 2>&1; then
- if ! svccfg import $SVC_MASTER; then
- Message 16 "Enable Failed"
- Message 17 "could not import $SVC_MASTER" $SVC_MASTER
- exit 1
- fi
- elif ! svcadm enable $SVC_COPY >/dev/null; then
- Message 16 "enable failed"
- Message 17 "could not enable dtlogin service" svc-dtlogin
- exit 1
- fi
- else
- if [ -f $RC_MASTER ]; then
- /usr/bin/rm -f $RC_COPY
- fi
- if [ ! -x $RC_COPY ]; then
- if [ ! -f $RC_MASTER ]; then
- Message 16 "enable failed"
- Message 17 "could not find $RC_MASTER" $RC_MASTER
- exit 1
- fi
- /usr/bin/cp $RC_MASTER $RC_COPY
- /usr/bin/chmod 0555 $RC_COPY
-
- if [ ! -x $RC_COPY ]; then
- Message 16 "enable failed"
- Message 18 "could not create $RC_COPY" $RC_COPY
- exit 1
- fi
- fi
- /usr/bin/rm -f $LEVEL_0_KILL
- /usr/bin/ln $RC_COPY $LEVEL_0_KILL
- /usr/bin/rm -f $LEVEL_1_KILL
- /usr/bin/ln $RC_COPY $LEVEL_1_KILL
- /usr/bin/rm -f $LEVEL_2_START
- /usr/bin/ln $RC_COPY $LEVEL_2_START
- if [ ! -f $LEVEL_2_START ]; then
- Message 16 "enable failed"
- Message 19 "could not create $LEVEL_2_START" $LEVEL_2_START
- exit 1
- fi
- fi
- Message 14 "done"
- Message 20 "desktop auto-start enabled."
- ;;
- '-inetd')
- nawk_check
- inetdSP
- inetdCM
- inetdTT
- Message 14 "done"
- Message 27 "Next system boot, following will be run from /usr/dt/bin"
- Message 28 " rpc.ttdbserverd (ToolTalk)"
- Message 29 " rpc.cmsd (Calendar Manager)"
- Message 30 " dtspcd (Subprocess Control)"
- ;;
- '-inetd.ow')
- nawk_check
- owCM
- owTT
- Message 14 "done"
- Message 31 "Next system boot, following will be run from /usr/openwin/bin"
- Message 32 " rpc.ttdbserverd (ToolTalk)"
- Message 33 " rpc.cmsd (Calendar Manager)"
- ;;
- '-kill')
- if [ -f /usr/sbin/svcadm ]; then
- svcadm disable -t $SVC_COPY
- fi
- rc_master_check
- $RC_MASTER stop
- Message 14 "done"
- Message 21 "dtlogin kill complete."
- ;;
- '-reset')
- rc_master_check
- $RC_MASTER reset
- Message 14 "done"
- Message 22 "dtlogin config resources reloaded."
- ;;
- '-p')
- rc_master_check
- $RC_MASTER update_printers
- Message 14 "done"
- Message 23 "printer action update is complete"
- ;;
- *)
- echo " "
- Message 24 "Usage:"
- usage_error
- exit 1
- ;;
- esac
- exit 0
|