#!/bin/sh # @(#)lmxstart.sh 1.17 11/13/97 LMPATHS="`/bin/dirname $0`/../lib/lmpaths" if [ -f ${LMPATHS} ] then . ${LMPATHS} else . lmpaths fi # INFORMATION # This command is executed by lmx.ctrl very early during initialization. # The role of this script is to ensure that the accounts and share list # files are in place and nominally correct. # The output of this command goes into $START_LOG_PATH in the lan manager # directory. # The server is in the LAN Manager home directory when this command is issued. SCRIPTNAME=`basename $0` echo "$SCRIPTNAME Start: `date`\n" > $START_LOG_PATH ( # Delete any subdirectories below the mailslot directory if [ -d $MAILSLOT_PATH ] then rm -rf $MAILSLOT_PATH/* fi > $DEV_NULL_PATH 2>&1 # If the $SHAREFILE_PATH file does not exist, create it if [ ! -f $SHAREFILE_PATH ] then echo "Creating the share file: $SHAREFILE_PATH" $LMSHARE_PATH -n echo else echo "Upgrading share file" $UPGRADESHARE_PATH echo fi # # verify that SAM/LSA exists # if [ ! -f $LSA_PATH ] then echo "\nCreating the Accounts files\n" mkdir $SAMDIR_PATH $SAMCHECK_PATH -d fi # # verify that an ACL database is present # if [ ! -f $ACL_PATH ] then echo "\nCreating the Access Control List file\n" $ACLADM_PATH -N fi # # Create shares for ADMIN$, IPC$, C$, and D$ if they do not exist. # echo "Checking ADMIN$ share" $LMSHARE_PATH -a -i >$DEV_NULL_PATH << END "ADMIN$" "d" "Admin Share" "rwcxda" "-1" "${LANMAN_PATH}" "" "" "0" "" "0" "" "0" "" "" "" "" "" END echo "Checking IPC$ share" $LMSHARE_PATH -a -i >$DEV_NULL_PATH << END "IPC$" "i" "IPC Share" "rwcxda" "-1" "" "" "" "0" "" "0" "" "0" "" "" "" "" "" END echo "Checking C$ share" $LMSHARE_PATH -a -i >$DEV_NULL_PATH << END "C$" "d" "Root Share" "r" "-1" "/" "" "" "0" "" "0" "" "0" "" "" "" "" "" END echo "Checking D$ share" $LMSHARE_PATH -a -i >$DEV_NULL_PATH << END "D$" "d" "SystemRoot Share" "r" "-1" "$LMSHARES_PATH"" "" "0" "" "0" "" "0" "" "" "" "" "" END echo "Checking PRINT$ share" $LMSHARE_PATH -a -i >$DEV_NULL_PATH << END "PRINT$" "d" "Printer Driver Share" "rwcxda" "-1" "$PRINTDRV_PATH"" "" "0" "" "0" "" "0" "" "" "" "" "" END # INFORMATION # This script looks in the directory $LMSHARES_PATH for subdirectories that # should be the treetop of a share area. For them to be automatically shared # during server startup, there needs to be a file named 'shareinf' in the # subdirectory that has keyword=value tokens in it to guide the automatic # sharing process. In particular, three keywords are recognized: # # .VL 10 2 # .LI "COMMENT" # is the comment associated with the share area. # .LI "ACCESS" # is the access permissions associated with the share area. Examples # are r or rw. # .LI "SHARENAME" # is the share name the path will receive. SHARENAME lines can appear # as many times as desired in this file to share the path multiple times. # Also, the last ACCESS and/or COMMENT lines are the ACCESS and COMMENT # values used for this particular SHARENAME entry. # .LE echo "Checking shares under $LMSHARES_PATH" for I in $LMSHARES_PATH/* do SHARECOMMENT= ACCESS=r if [ -d $I -a -f $I/shareinf ] then echo "\tChecking share entry for: `basename $I`" while read LINE do case "$LINE" in COMMENT*=*) SHARECOMMENT=`echo $LINE|cut -d= -f2` ;; ACCESS*=*|PERMISSION*=*) set -- `echo $LINE|cut -d= -f2` ACCESS=$1 ;; SHARENAME*=*) set -- `echo $LINE|cut -d= -f2|tr '[a-z]' '[A-Z]'` $LMSHARE_PATH -a -i << END "$1" "d" "$SHARECOMMENT" "$ACCESS" "-1" "$I" "" "" "0" "" "0" "" "0" "" "" "" "" "" END ;; esac done < $I/shareinf >$DEV_NULL_PATH 2>&1 fi done # # Make sure the spool directories for client printers are shared. # for i in `/bin/ls $CONFIGDIR_PATH` do . $CONFIGDIR_PATH/$i echo "Checking $CLSHARE share" $LMSHARE_PATH -a -i >$DEV_NULL_PATH << END "$CLSHARE" "d" "Client Printer Share Area" "r" "-1" "$CLIPRDIR_PATH/$i" "" "" "0" "" "0" "" "0" "" "" "" "" "" END done # Add LMU to the listener databases for all stacks if no listenname defined listenname=`$SRVCONFIG_PATH -g server,listenname` ListenExtension=`$SRVCONFIG_PATH -g "lmxserver,listenextension" | \ tr '[A-Z]' '[a-z]'` if [ -z "$ListenExtension" ] then ListenExtension=".serve" fi len=`echo $ListenExtension | wc -c` len=`expr 16 - $len` UnameDotServe="`uname -n | cut -c1-${len}`${ListenExtension}" if [ "$listenname" = "" -o "$listenname" = "$UnameDotServe" ] then for x in `$NLSADMIN_PATH -x | cut -f1` do $NLSADMIN_PATH -q -z 2 $x > $DEV_NULL_PATH 2>&1 if [ "$?" != "0" ] then echo "Adding the server to protocol stack: $x" $NLSADMIN_PATH -m -a 2 -c "$PASSCLI_PATH" -y \ "Used by Advanced Server for UNIX Systems server" -w root $x fi done fi ) 2>&1 | while read LINE do if [ "$LINE" ] then echo "\t" $LINE fi done >> $START_LOG_PATH 2>&1 echo "\n$SCRIPTNAME Complete: `date`" >> $START_LOG_PATH