4 logfile=/new.system.1.log
6 ## Set global env variables
11 OS=$(uname -r | cut -c3-)
13 # Get configfiles from Bismol (IP address is used because the machine is not
14 # currently setup enough to know how to resolve bismol to an IP address)
15 configfiles_machine=15.0.96.154
20 # Filename for configuration files
21 configfiles=${OS}configfiles.shar
24 print -u2 "$me: Error: $1"
28 print -u2 "$me: Warning: $1"
36 display "$me: Info: $1"
40 if [ ! -z "$verbose" ]; then
46 if [ ! -z "$debug" ]; then
47 print -u2 "$me: Debug: $1"
52 display "$ME -c/learcase [-v|verbose] [-d|debug] [-usage]"
53 display " -c/learcase Perform ClearCase installation"
54 display " -v|verbose: Turns on verbose mode"
55 display " -d|debug: Turns on debug mode"
56 display " -usage: Print this usage message"
58 display "The following options will be prompted for if not supplied on the"
59 display "command line. If any parameter has spaces in it then you need to"
60 display "surround it in quotes (e.g. -owners_fullname \"Andrew DeFaria\"."
61 display "You'll probably need to do this for the first 3 in the list below:"
63 display " -owners_fullname Specify owners full name"
64 display " -machine_usage Specify what this machine is to be used for"
65 display " -location Specify where this machine is located"
66 display " -owners_email Specify email address (no @cup.hp.com)"
67 display " -owners_extension Specify phone extenstion in the format of"
68 display " 7-XXXX (the t-44 will be prepended)"
69 display " -new_machine_name Specify the name of this system (REQUIRED)"
76 let step_nbr=step_nbr+1
77 display "Step #$step_nbr: $@"
80 function get_configfiles {
82 passwd=$LOGNAME@$(uname -n).cup.hp.com
83 directory=pub/Configuration
85 ftp -n $configfiles_machine <<@EOD
95 function export_disks {
96 # First check to see if all local disks are exported
97 cut -f1 -d' ' /etc/xtab > /tmp/xtab
98 bdf -t hfs | grep "/dev" | grep -v "/stand" | awk '{print $NF}' >
101 if $(diff /tmp/exports /tmp/xtab > /dev/null 2>&1); then
102 verbose "All local disks exported"
104 verbose "Some local disks are not exported"
105 if [ "$mode" != "check" ]; then
106 verbose "Fixing the problem..."
107 cp /etc/exports /etc/exports.old
108 cp /tmp/exports /etc/exports
109 verbose "Exporting all disks..."
110 /usr/sbin/exportfs -a
116 function display_options {
117 display "Setup this machine according to the following profile:"
119 --------------------------------------------------------------------------------
121 display "Clearcase:\t\t\c"
122 if [ "_$clearcase" = "_" ]; then
128 display "Verbose Mode:\t\t\c"
129 if [ "_$verbose" = "_" ]; then
135 display "Debug Mode:\t\t\c"
136 if [ "_$debug" = "_" ]; then
142 display "Machine Name:\t\t$new_machine_name"
143 display "Machine Usage:\t\t$machine_usage"
144 display "Macine Location:\t$location"
145 display "Owner's Fullname:\t$owners_fullname"
146 display "Owner's Email:\t\t$owners_email"
147 display "Owner's Extension:\t$owners_extension"
150 # Set initial parm values
152 display "\t\tWelcome to the new system setup script"
153 display "\t\tThis is the first script of 4 that you"
154 display "\t\twill need to run to setup a new Virtual"
155 display "\t\tWorkstation Server or Buildpool Server."
168 while [ $# -ge 1 ]; do
187 if [ $# -le 1 ]; then
188 usage "Owner's Full Name is not specified!"
195 if [ $# -le 1 ]; then
196 usage "Machine Usage was not specified!"
203 if [ $# -le 1 ]; then
204 usage "Location was not specified!"
211 if [ $# -le 1 ]; then
212 usage "Owner's Email was not specified!"
219 if [ $# -le 1 ]; then
220 usage "Owner's Extention was not specified!"
223 owners_extension="$1"
227 if [ $# -le 1 ]; then
228 usage "New Machine Name not specified!"
231 new_machine_name="$1"
235 usage "Unrecognized parameter $1"
241 # Prompt for options not specified on the command line
243 if [ "_$clearcase" = "_" ]; then
244 print "Do you wish to install Clearcase?"
247 if [ "_$clearcase" = "_" ]; then
248 error "You must specify y or n"
252 if [ "_$owners_fullname" = "_" ]; then
253 print "Owner's Fullname"
256 if [ "_$owners_fullname" = "_" ]; then
257 owners_fullname=Unknown
261 if [ "_$machine_usage" = "_" ]; then
262 print "What is this machine used for?"
265 if [ "_$machine_usage" = "_" ]; then
266 machine_usage="This machine is used by \<whom\> for \<what\>"
270 if [ "_$location" = "_" ]; then
271 print "Where is this machine located?"
274 if [ "_$location" = "_" ]; then
275 location="\<Physical Location\>"
279 if [ "_$owners_email" = "_" ]; then
280 print "Owner's Email address:"
281 print "(Should be the same as username. This script will supply the cup.hp.com)"
284 if [ "_$owners_email" = "_" ]; then
289 if [ "_$owners_extension" = "_" ]; then
290 print "Owner's Phone extention:"
291 print "(Should be of the format 7-XXXX This script will prepend \"t-44\" to"
292 print "the entered extension)"
294 read owners_extension
295 if [ "_$owners_extension" = "_" ]; then
296 owners_extension=7-XXXX
300 until [ "_$new_machine_name" != "_" ]; do
301 new_machine_name="garbage"
302 print "New machine name:"
304 read new_machine_name
306 if [ "_$new_machine_name" = "_" ]; then
307 error "Must enter a new machine name"
311 if [ $(id -u) -ne 0 ]; then
312 error "Must be root to execute this command"
319 display "Continue Installation (Y/n)?\c"
327 display "Installation aborted. Rerun $me if you wish to install again"
332 function do_installation {
335 step "Get configuration files"
339 if [ $? -ne 0 ]; then
340 error "Unable to ftp $configfiles from $configfiles_machine"
344 step "Unpack configuration files"
347 sh $configfiles >> $logfile 2>&1
350 step "Change GenericSysName in /etc/issue"
352 sed "s/GenericSysName/$new_machine_name/" /etc/issue > /etc/issue.new
353 mv /etc/issue /etc/issue.old
354 mv /etc/issue.new /etc/issue
356 step "Allow Access to at(1)"
358 touch /var/adm/cron/at.deny
359 rm -f /var/adm/cron/at.allow
361 step "Setup ClearCase Build Hosts File"
362 echo `uname -n` > /.bldhost.hppa
363 cat /etc/bldhost.hppa >> /.bldhost.hppa
366 step "Symlink /nfs -> /net"
368 ln -s /net /nfs 2>> $logfile
370 step "Symlink /usr/preserve -> /var/preserve"
372 ln -s /var/preserve /usr/preserve 2>> $logfile
374 step "Setup Application Server"
376 /net/bismol/app/admin/bin/setup
378 step "Setup Mother of All Passwords (AKA MoA)"
380 /net/bismol/app/admin/bin/mkpass -f
382 step "Create /etc/motd"
384 banner $new_machine_name > /etc/motd
385 uname -a >> /etc/motd
386 cat >> /etc/motd <<:END
388 *******************************************************************************
389 * This is a private system operated for the Hewlett-Packard Company business. *
390 * Authorization from HP management is required to use this system. *
391 * Use by unauthorized persons is prohibited. *
392 *******************************************************************************
393 For System Support: Mon-Fri 8:00-5:00 Email (site-ux@cup.hp.com)
394 Phone: t-447-1212 After hours/weekend Pre-arrange: t-447-0629
395 -------------------------------------------------------------------------------
396 Usage: $machine_usage
397 Owner: $owners_fullname ($owners_email@cup.hp.com) Phone:
398 t-44$owners_extension
400 -------------------------------------------------------------------------------
403 step "Edit /etc/gettydefs: Change \"Console login:\" to \"$new_machine_name login:\""
405 sed "s/Console Login:/$new_machine_name Login:/" /etc/gettydefs \
407 mv /etc/gettydefs /etc/gettydefs.old
408 mv /etc/gettydefs.new /etc/gettydefs
410 step "Ninstalling lp, adm and net3 packages"
412 /usr/local/bin/ninstall -h bismol lp adm net3 >> $logfile 2>&1
414 step "Run netdaemon.dy"
416 /usr/adm/netdist/netdaemon.dy 2>> $logfile
418 step "Fix /usr/sbin/rlp"
420 chmod +x /usr/sbin/rlp
422 step "Install root crontab"
424 crontab /crontab.root >> $logfile 2>&1
427 step "Allow usage of crontab for ordinary users"
429 touch /var/adm/cron/cron.deny
430 rm -f /var/adm/cron/cron.allow
432 if [ "$clearcase" = "y" ]; then
433 step "Make symlink for the Build Environment"
435 ln -s /CLO/BUILD_ENV/usr/lib /usr/shlib 2>> $logfile
437 step "Symlinking clearmake for parallel build support"
439 ln -s /usr/eclipse/bin/clearmake /usr/contrib/bin/clearmake
442 step "Adjust nfsd/biod's"
455 9000/780|9000/813|9000/829|9000/849|9000/889|9000/898)
461 warning "Unknown machine model $(uname -m)!"
462 warning "Leaving nfsd/biod's as default"
466 if [ $nfsd -ne 4 ]; then
467 cp /etc/rc.config.d/nfsconf /etc/rc.config.d/nfsconf.old
468 sed "s/NUM_NFSD=4/NUM_NFSD=$nfsd/" /etc/rc.config.d/nfsconf \
469 > /etc/rc.config.d/nfsconf.new
470 mv /etc/rc.config.d/nfsconf.new /etc/rc.config.d/nfsconf
471 sed "s/NUM_NFSIOD=4/NUM_NFSIOD=$biod/" /etc/rc.config.d/nfsconf \
472 > /etc/rc.config.d/nfsconf.new
473 mv /etc/rc.config.d/nfsconf.new /etc/rc.config.d/nfsconf
476 step "Setting up for 9.x build environment"
478 mv /usr/lib/libisamstub.1 /usr/lib/libisamstub.0
479 cp /net/bismol/app/admin/lib/libisamstub.1 /usr/lib/libisamstub.1
480 chmod 555 /usr/lib/libisamstub.1
481 chown bin:bin /usr/lib/libisamstub.1
485 ln -s /net/bismol/aspirin/DTS /usr/DTS 2>> $logfile
487 step "Setup automounter to use hard mounts"
489 echo "/net -hosts -intr" > /etc/auto_master
491 step "Link /var/mail"
493 mv /var/mail /var/mail.orig
494 ln -s /net/cllmail/var/mail/ /var/mail
496 step "Fix Root's name entry in /etc/passwd.loc"
498 sed "s/Root user/Root\@$(uname -n)/" /etc/passwd.loc > /tmp/passwd.loc
499 mv /tmp/passwd.loc /etc/passwd.loc
501 step "Fix permissions on /dev/lan*"
505 step "Installing OptionalSoftware"
508 display "This step will take several minutes and then the machine will
510 display "After the machine is back up continue with new.system.2."
513 -s wampus:/Depots/$OS \
518 info "Swinstall complete, system will reboot if there were no errors"
522 do_installation | tee $logfile