xref: /titanic_44/usr/src/cmd/stmsboot/stmsboot.sh (revision 023e71de9e5670cebc23dd51162833661d3d2d3b)
1#!/sbin/sh -p
2#
3# CDDL HEADER START
4#
5# The contents of this file are subject to the terms of the
6# Common Development and Distribution License (the "License").
7# You may not use this file except in compliance with the License.
8#
9# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10# or http://www.opensolaris.org/os/licensing.
11# See the License for the specific language governing permissions
12# and limitations under the License.
13#
14# When distributing Covered Code, include this CDDL HEADER in each
15# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16# If applicable, add the following below this CDDL HEADER, with the
17# fields enclosed by brackets "[]" replaced with your own identifying
18# information: Portions Copyright [yyyy] [name of copyright owner]
19#
20# CDDL HEADER END
21#
22#
23# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
24# Use is subject to license terms.
25#
26#
27PATH=/usr/bin:/usr/sbin:$PATH; export PATH
28STMSBOOTUTIL=/lib/mpxio/stmsboot_util
29STMSMETHODSCRIPT=/lib/svc/method/mpxio-upgrade
30KDRVCONF=
31DRVCONF=
32TMPDRVCONF=
33TMPDRVCONF_MPXIO_ENTRY=
34TMPDRVCONF_SATA_ENTRY=
35DRVLIST=
36GUID=
37VFSTAB=/etc/vfstab
38SAVEDIR=/etc/mpxio
39BOOTDEVICES=$SAVEDIR/boot-devices
40RECOVERFILE=$SAVEDIR/recover_instructions
41SVCCFG_RECOVERY=$SAVEDIR/svccfg_recover
42SUPPORTED_DRIVERS="fp|mpt|mpt_sas|pmcs"
43USAGE=`gettext "Usage: stmsboot [-D $SUPPORTED_DRIVERS] -e | -d | -u | -L | -l controller_number"`
44TEXTDOMAIN=SUNW_OST_OSCMD
45export TEXTDOMAIN
46STMSINSTANCE=svc:system/device/mpxio-upgrade:default
47STMSBOOT=/usr/sbin/stmsboot
48BOOTADM=/sbin/bootadm
49MOUNT=/usr/sbin/mount
50EEPROM=/usr/sbin/eeprom
51EGREP=/usr/bin/egrep
52GREP=/usr/bin/grep
53AWK=/usr/bin/awk
54CP=/usr/bin/cp
55DF=/usr/bin/df
56LS=/usr/bin/ls
57MV=/usr/bin/mv
58RM=/usr/bin/rm
59SORT=/usr/bin/sort
60UNIQ=/usr/bin/uniq
61EXPR=/usr/bin/expr
62MKDIR=/usr/bin/mkdir
63REBOOT=/usr/sbin/reboot
64SED=/usr/bin/sed
65SVCPROP=/usr/bin/svcprop
66SVCCFG=/usr/sbin/svccfg
67SVCS=/usr/bin/svcs
68SVCADM=/usr/sbin/svcadm
69
70NOW=`/usr/bin/date +%G%m%d_%H%M`
71MACH=`/usr/bin/uname -p`
72BOOTENV_FILE=bootenv.rc
73reboot_needed=0
74new_bootpath=""
75CLIENT_TYPE_PHCI=""
76CLIENT_TYPE_VHCI="/scsi_vhci"
77new_rootdev=""
78svm_md_device=""
79
80#
81# Copy all entries (including comments) from source driver.conf
82# to destination driver.conf except those entries which contain
83# the mpxio-disable property.
84# Take into consideration entries that spawn more than one line.
85#
86# $1	source driver.conf file
87# $2	destination driver.conf file
88#
89# Returns 0 on success, non zero on failure.
90#
91delete_mpxio_disable_entries()
92{
93	# be careful here, we've got embedded \t characters
94	# in sed's pattern space.
95	$SED '
96		/^[ 	]*#/{ p
97			      d
98			    }
99		s/[ 	]*$//
100		/^$/{ p
101		      d
102		    }
103		/mpxio-disable[ 	]*=.*;$/{ w '$3'
104						  d
105						}
106		/disable-sata-mpxio[ 	]*=.*;$/{ w '$4'
107						  d
108						}
109		/;$/{ p
110		      d
111		    }
112		:rdnext
113		N
114		s/[ 	]*$//
115		/[^;]$/b rdnext
116		/mpxio-disable[ 	]*=/{ s/\n/ /g
117					      w '$3'
118					      d
119					    }
120		' $1 > $2
121
122	return $?
123}
124
125#
126# backup the last saved copy of the specified files.
127# $*	files to backup
128#
129backup_lastsaved()
130{
131	for file in $*
132	do
133		newfile=`basename $file`
134		$CP $file $SAVEDIR/$newfile.$cmd.$NOW
135	done
136}
137
138#
139# build recover instructions
140#
141# $1	1 to include boot script in the instructions
142#	0 otherwise
143#
144build_recover()
145{
146	gettext "Instructions to recover your previous STMS configuration (if in case the system does not boot):\n\n" > $RECOVERFILE
147	echo "\tboot net \c"  >> $RECOVERFILE
148	gettext "(or from a cd/dvd/another disk)\n" >> $RECOVERFILE
149	echo "\tfsck <your-root-device>" >> $RECOVERFILE
150	echo "\tmount <your-root-device> /mnt" >> $RECOVERFILE
151
152	if [ "$cmd" = "update" ]; then
153		gettext "\tUndo the modifications you made to STMS configuration.\n\tFor example undo any changes you made to " >> $RECOVERFILE
154		echo "/mnt$KDRVCONF." >> $RECOVERFILE
155	else
156		echo "\tcp /mnt${SAVEDIR}/$DRVCONF.$cmd.$NOW /mnt$KDRVCONF" >> $RECOVERFILE
157	fi
158
159	if [ $1 -eq 1 ]; then
160		echo "\tcp /mnt${SAVEDIR}/vfstab.$cmd.$NOW /mnt$VFSTAB" >> $RECOVERFILE
161
162		echo "repository /mnt/etc/svc/repository.db" > $SVCCFG_RECOVERY
163		echo "select $STMSINSTANCE" >> $SVCCFG_RECOVERY
164		echo "setprop general/enabled=false" >> $SVCCFG_RECOVERY
165		echo "exit" >> $SVCCFG_RECOVERY
166
167		echo "\t$SVCCFG -f /mnt$SVCCFG_RECOVERY" >> $RECOVERFILE
168
169		if [ -n "$new_bootpath" -a "$MACH" = "i386" ]; then
170			echo "\tcp /mnt${SAVEDIR}/bootenv.rc.$cmd.$NOW /mnt/boot/solaris/$BOOTENV_FILE" >> $RECOVERFILE
171		fi
172	fi
173
174	rootdisk=`$MOUNT | $GREP "/ on " | cut -f 3 -d " "`
175	echo "\tumount /mnt\n\treboot\n\n${rootdisk} \c" >> $RECOVERFILE
176	gettext "was your root device,\nbut it could be named differently after you boot net.\n" >> $RECOVERFILE
177}
178
179
180#
181# Arrange for /etc/vfstab and dump configuration to be updated
182# during the next reboot. If the cmd is "enable" or "disable", copy
183# $TMPDRVCONF to $KDRVCONF.
184#
185# Returns 0 on success, 1 on failure.
186#
187update_sysfiles()
188{
189
190	gettext "WARNING: This operation will require a reboot.\n"
191	gettext "Do you want to continue ? [y/n] (default: y) "
192	read response
193
194	if [ -n "$response" -a "$response" != "y" -a \
195	    "$response" != "Y" ]; then
196		for d in $DRVLIST; do
197			TMPDRVCONF=/var/run/tmp.$d.conf.$$
198			$RM -f $TMPDRVCONF > /dev/null 2>&1
199		done;
200		return 0;
201	fi
202
203	# set need_bootscript to the number of drivers that
204	# we support.
205	need_bootscript=`echo $SUPPORTED_DRIVERS|$AWK -F"|" '{print NF}'`
206
207	if [ "$cmd" = "enable" -o "$cmd" = "disable" ]; then
208
209		for d in $DRVLIST; do
210			DRVCONF=$d.conf
211			KDRVCONF=/kernel/drv/$d.conf
212			TMPDRVCONF=/var/run/tmp.$d.conf.$$
213
214			$CP $KDRVCONF $SAVEDIR/`basename $KDRVCONF`.$cmd.$NOW
215			if [ -f $TMPDRVCONF ]; then
216				$CP $TMPDRVCONF $KDRVCONF
217				$RM -f $TMPDRVCONF
218			else
219				# if $TMPDRVCONF doesn't exist, then we
220				# haven't made any changes to it
221				continue;
222			fi
223
224			#
225			# there is no need to update the system files in the following
226			# cases:
227			# - we are enabling mpxio and the system has no configured
228			#   disks accessible by phci paths.
229			# - we are disabling mpxio and the system has no configured
230			#   disks accessible by vhci paths.
231			#
232
233			# Function to setup the CLIENT_TYPE_PHCI string based on
234			# the list of drivers that we're operating on. The variable
235			# depends upon the pathname of the parent node in the
236			# device tree, which can be different on x86/x64 and sparc.
237
238			CLIENT_TYPE_PHCI=`$STMSBOOTUTIL -D $d -N`;
239
240			if [ -z "$CLIENT_TYPE_PHCI" ]; then
241				continue;
242			fi
243
244			if [ "$cmd" = "enable" ]; then
245				$LS -l /dev/dsk/*s2 2> /dev/null | \
246				    $EGREP -s "$CLIENT_TYPE_PHCI"
247			else
248				$LS -l /dev/dsk/*s2 2> /dev/null | \
249				    $EGREP -s "$CLIENT_TYPE_VHCI"
250			fi
251
252			if [ $? -ne 0 ]; then
253				need_bootscript=`$EXPR $need_bootscript - 1`
254			fi
255		done
256	fi
257
258	if [ $need_bootscript -gt 0 ]; then
259		need_bootscript=1
260		if [  -n "$new_bootpath" -a "$MACH" = "i386" ]; then
261			#only update bootpath for x86.
262			$CP /boot/solaris/$BOOTENV_FILE $SAVEDIR/$BOOTENV_FILE.$cmd.$NOW
263			$EEPROM bootpath="$new_bootpath"
264		fi
265
266		if [ "$svm_md_device" != "NOT_MAPPED" ]; then
267			# Enable the mpxio-upgrade service for the reboot
268			$SVCADM disable -t $STMSINSTANCE
269			$SVCCFG -s $STMSINSTANCE "setprop general/enabled=true"
270		fi
271	else
272		need_bootscript=0
273	fi
274
275	build_recover $need_bootscript
276
277	if [ "$MACH" = "i386" ]; then
278		$BOOTADM update-archive
279	fi
280
281	gettext "The changes will come into effect after rebooting the system.\nReboot the system now ? [y/n] (default: y) "
282	read response
283
284	if [ -z "$response" -o "$response" = "y" -o \
285	    "$response" = "Y" ]; then
286		$REBOOT
287	fi
288
289	return 0
290}
291
292
293#
294# Enable or disable mpxio as specified by the cmd.
295# Returns 0 on success, 1 on failure.
296#
297# Args: $cmd = {enable | disable}
298#	$d = {fp | mpt | mpt_sas | pmcs}
299#
300# the global variable $DRVLIST is used
301#
302configure_mpxio()
303{
304	# be careful here, we've got embedded \t characters
305	# in sed's pattern space.
306	mpxiodisableno='mpxio-disable[ 	]*=[ 	]*"no"[ 	]*;'
307	mpxiodisableyes='mpxio-disable[ 	]*=[ 	]*"yes"[ 	]*;'
308	satadisableno='disable-sata-mpxio[ 	]*=[ 	]*"no"[ 	]*;'
309	satadisableyes='disable-sata-mpxio[ 	]*=[ 	]*"yes"[ 	]*;'
310
311	if [ "$cmd" = "enable" ]; then
312		mpxiodisable_cur_entry=$mpxiodisableyes
313		satadisable_cur_entry=$satadisableyes
314		propval=no
315		msg=`gettext "STMS already enabled"`
316	else
317		mpxiodisable_cur_entry=$mpxiodisableno
318		satadisable_cur_entry=$satadisableno
319		propval=yes
320		msg=`gettext "STMS already disabled"`
321	fi
322
323	DRVCONF=$d.conf
324	KDRVCONF=/kernel/drv/$d.conf
325	TMPDRVCONF=/var/run/tmp.$d.conf.$$
326	TMPDRVCONF_MPXIO_ENTRY=/var/run/tmp.$d.conf.mpxioentry.$$;
327	TMPDRVCONF_SATA_ENTRY=/var/run/tmp.$d.conf.sataentry.$$;
328
329	if delete_mpxio_disable_entries $KDRVCONF $TMPDRVCONF $TMPDRVCONF_MPXIO_ENTRY $TMPDRVCONF_SATA_ENTRY; then
330
331		if [ -s $TMPDRVCONF_MPXIO_ENTRY ]; then
332			# $DRVCONF does have mpxiodisable entries
333			$EGREP -s "$mpxiodisable_cur_entry" $TMPDRVCONF_MPXIO_ENTRY
334			if [ $? -eq 0 ]; then
335				reboot_needed=`$EXPR $reboot_needed + 1`
336			else
337				# if all mpxiodisable entries are no/yes for
338				# enable/disable mpxio, notify the user
339				$EGREP -s "$satadisable_cur_entry" $TMPDRVCONF_SATA_ENTRY
340				if [ $? -eq 0 -a "$d" = "mpt" ]; then
341					reboot_needed=`$EXPR $reboot_needed + 1`
342				else
343					$RM -f $TMPDRVCONF $TMPDRVCONF_MPXIO_ENTRY $TMPDRVCONF_SATA_ENTRY > /dev/null 2>&1
344					return 0;
345				fi
346			fi
347
348			# If mpxiodisable entries do not exist, always continue update
349		fi
350	else
351		$RM -f $TMPDRVCONF $TMPDRVCONF_MPXIO_ENTRY $TMPDRVCONF_SATA_ENTRY > /dev/null 2>&1
352		gettext "failed to update " 1>&2
353		echo "$KDRVCONF." 1>&2
354		gettext "No changes were made to your STMS configuration.\n" 1>&2
355		return 1
356	fi
357
358	rm $TMPDRVCONF_MPXIO_ENTRY $TMPDRVCONF_SATA_ENTRY > /dev/null 2>&1
359	echo "mpxio-disable=\"${propval}\";" >> $TMPDRVCONF
360	if [ "$d" = "mpt" ]; then
361		echo "disable-sata-mpxio=\"${propval}\";" >> $TMPDRVCONF
362	fi
363
364}
365
366setcmd()
367{
368	if [ "$cmd" = "none" ]; then
369		cmd=$1
370	else
371		echo "$USAGE" 1>&2
372		exit 2
373	fi
374}
375
376#
377# Need to update bootpath on x86 if boot system from FC disk
378# Only update bootpath here when mpxio is enabled
379# If mpxio is currently disabled, then we'll update bootpath in the
380# mpxio-upgrade service method on reboot.
381#
382
383get_newbootpath_for_stmsdev() {
384	if [ "$cmd" = "enable" ]; then
385		return 0
386	fi
387
388	cur_bootpath=`$STMSBOOTUTIL -b`
389	if [ $? != 0 ]; then
390		return 1
391	fi
392
393	# Since on x64 platforms the eeprom command doesn't update the
394	# kernel, the file /boot/solaris/bootenv.rc and the kernel's
395	# bootpath variable have a good chance of differing. We do some
396	# extra handwaving to get the correct bootpath variable setting.
397
398	ONDISKVER=`$AWK '/bootpath/ {print $3}' /boot/solaris/bootenv.rc|\
399		$SED -e"s,',,g"`
400	if [ "$ONDISKVER" != "$cur_bootpath" ]; then
401		cur_bootpath="$ONDISKVER"
402	fi
403
404	NEWBOOTPATH=""
405	for path in $cur_bootpath; do
406		mapped=`$STMSBOOTUTIL -p $path`
407		if [ "$mapped" != "NOT_MAPPED" ]; then
408			if [ "$mapped" != "$path" ]; then
409				NEWBOOTPATH=`echo "$path " | \
410				   $SED -e"s|$path|$mapped|"`" $NEWBOOTPATH"
411			else
412				NEWBOOTPATH="$NEWBOOTPATH $path"
413			fi
414		fi
415	done
416	# now strip off leading and trailing space chars
417	new_bootpath=`echo $NEWBOOTPATH`
418	return 0
419}
420
421#
422# Emit a warning message to the user that by default we
423# operate on all multipath-capable controllers that are
424# attached to the system, and that if they want to operate
425# on only a specific controller type (fp|mpt|mpt_sas|pmcs|....) then
426# they need to re-invoke stmsboot with "-D $driver" in
427# their argument list
428#
429
430emit_driver_warning_msg() {
431
432	# for each driver that we support, grab the list
433	# of controllers attached to the system.
434
435	echo ""
436	gettext "WARNING: stmsboot operates on each supported multipath-capable controller\n"
437	gettext "         detected in a host. In your system, these controllers are\n\n"
438
439	for WARNDRV in `echo $SUPPORTED_DRIVERS| $SED -e"s,|, ,g"`; do
440		$STMSBOOTUTIL -D $WARNDRV -n
441	done;
442
443	echo ""
444	gettext "If you do NOT wish to operate on these controllers, please quit stmsboot\n"
445	gettext "and re-invoke with -D { fp | mpt | mpt_sas | pmcs} to specify which controllers you wish\n"
446	gettext "to modify your multipathing configuration for.\n"
447
448	echo ""
449	gettext "Do you wish to continue? [y/n] (default: y) "
450	read response
451
452	if [ -n "$response" -a "$response" != "Y" -a \
453	    "$response" != "y" ]; then
454		exit
455	fi
456}
457
458
459#
460#
461# main starts here
462#
463
464cmd=none
465# process options
466while getopts D:geduLl: c
467do
468	case $c in
469	e)	setcmd enable;;
470	d)	setcmd disable;;
471	u)	setcmd update;;
472	L)	setcmd listall;;
473	l)	setcmd list
474		controller=$OPTARG;;
475	D)	DRV=$OPTARG;;
476	g)	GUID="-g";;
477	\?)	echo "$USAGE" 1>&2
478		exit 2;;
479	esac
480done
481
482if [ "$cmd" = "none" ]; then
483	echo "$USAGE" 1>&2
484	exit 2
485fi
486
487if [ -z "$DRV" ]; then
488	DRVLIST="fp mpt mpt_sas pmcs"
489else
490	DRVLIST=$DRV
491fi
492
493USERID=`id | $EGREP "uid=0"`
494if [ -z "$USERID" ]; then
495	gettext "You must be super-user to run this script.\n" 1>&2
496	exit 1
497fi
498
499# just a sanity check
500if [ ! -f $STMSBOOTUTIL -o ! -f $STMSMETHODSCRIPT ]; then
501	fmt=`gettext "Can't find %s and/or %s"`
502	printf "$fmt\n" "$STMSBOOTUTIL" "$STMSMETHODSCRIPT" 1>&2
503	exit 1
504fi
505
506# If the old sun4u-specific SMF method is found, remove it
507$SVCCFG -s "platform/sun4u/mpxio-upgrade:default" < /dev/null > /dev/null 2>&1
508if [ $? -eq 0 ]; then
509	$SVCCFG delete "platform/sun4u/mpxio-upgrade:default" > /dev/null 2>&1
510fi
511
512# now import the new service, if necessary
513$SVCPROP -q $STMSINSTANCE < /dev/null > /dev/null 2>&1
514if [ $? -ne 0 ]; then
515	if [ -f /var/svc/manifest/system/device/mpxio-upgrade.xml ]; then
516		$SVCCFG import /var/svc/manifest/system/device/mpxio-upgrade.xml
517		if [ $? -ne 0 ]; then
518
519			fmt=`gettext "Unable to import the %s service"`
520			printf "$fmt\n" "$STMSINSTANCE" 1>&2
521			exit 1
522		else
523			fmt=`gettext "Service %s imported successfully, continuing"`
524			printf "$fmt\n" "$STMSINSTANCE" 1>&2
525		fi
526	else
527		fmt=`gettext "Service %s does not exist on this host"`
528 		printf "$fmt\n" "$STMSINSTANCE" 1>&2
529		exit 1
530	fi
531fi
532
533
534# make sure we can stash our data somewhere private
535if [ ! -d $SAVEDIR ]; then
536	$MKDIR -p $SAVEDIR
537fi
538# prime the cache
539$STMSBOOTUTIL -i
540
541
542if [ "$cmd" = "enable" -o "$cmd" = "disable" -o "$cmd" = "update" ]; then
543	#
544	# The bootup script doesn't work on cache-only-clients as the script
545	# is executed before the plumbing for cachefs mounting of root is done.
546	#
547	if $MOUNT -v | $EGREP -s " on / type (nfs|cachefs) "; then
548		gettext "This command option is not supported on systems with an nfs or cachefs mounted root filesystem.\n" 1>&2
549		exit 1
550	fi
551
552	# if the user has left the system with the mpxio-upgrade service
553	# in a temporarily disabled state (ie, service is armed for the next
554	# reboot), then let them know. We need to ensure that the system is
555	# is in a sane state before allowing any further invocations, so
556	# try to get the system admin to do so
557
558	ISARMED=`$SVCS -l $STMSINSTANCE|$GREP "enabled.*false.*temporary"`
559	if [ ! $? ]; then
560		echo ""
561		gettext "You need to reboot the system in order to complete\n"
562		gettext "the previous invocation of stmsboot.\n"
563		echo ""
564		gettext "Do you wish to reboot the system now? (y/n, default y) "
565		read response
566
567		if [ -z "$response" -o "x$response" = "Y" -o \
568		    "$response" = "y" ]; then
569			$REBOOT
570		else
571			echo ""
572			gettext "Please reboot this system before continuing\n"
573			echo ""
574			exit 1
575		fi
576	fi
577
578	#
579	# keep a copy of the last saved files, useful for manual
580	# recovery in case of a problem.
581	#
582	for d in $DRVLIST; do
583		DRVCONF=$d.conf
584		KDRVCONF=/kernel/drv/$d.conf
585		TMPDRVCONF=/var/run/tmp.$d.conf.$$
586		TMPDRVCONF_MPXIO_ENTRY=/var/run/tmp.$d.conf.mpxioentry.$$;
587		if [ "$MACH" = "sparc" ]; then
588			backup_lastsaved $KDRVCONF $VFSTAB
589		else
590			backup_lastsaved $KDRVCONF $VFSTAB /boot/solaris/$BOOTENV_FILE
591		fi
592	done
593fi
594
595if [ "$cmd" = "enable" -o "$cmd" = "disable" ]; then
596
597	msgneeded=`echo "$DRVLIST" |grep " "`
598	if [ -n "$msgneeded" ]; then
599		emit_driver_warning_msg
600	fi
601	for d in $DRVLIST; do
602		configure_mpxio $cmd $d
603	done
604
605	if [ $reboot_needed -ne 0 ]; then
606		# Need to update bootpath on x86 if our boot device is
607		# now accessed through mpxio.
608		# Only update bootpath before reboot when mpxio is enabled
609		# If mpxio is currently disabled, we will update bootpath
610		# on reboot in the mpxio-upgrade service
611
612		if [ "$cmd" = "disable" ]; then
613			if [ "$MACH" = "i386" ]; then
614				get_newbootpath_for_stmsdev
615				if [ $? -ne 0 ]; then
616					$RM -f $TMPDRVCONF > /dev/null 2>&1
617					gettext "failed to update bootpath.\n" 1>&2
618					gettext "No changes were made to your STMS configuration.\n" 1>&2
619					return 1
620				fi
621			fi
622			# If we're not using ZFS root then we need
623			# to keep track of what / maps to in case
624			# it's an active-active device and we boot from
625			# the other path
626			ROOTSCSIVHCI=`$DF /|$AWK -F":" '{print $1}' | \
627			    $AWK -F"(" '{print $2}'| \
628			    $SED -e"s,dsk,rdsk," -e"s,s.[ ]*),,"`
629			$STMSBOOTUTIL -L | $GREP $ROOTSCSIVHCI | \
630			    $AWK '{print $1}' | $SED -e"s,rdsk,dsk,g" \
631			    >$BOOTDEVICES
632		fi
633		new_rootdev=`$DF /|$AWK -F":" '{print $1}' | \
634			$AWK -F"(" '{print $2}'| \
635			$SED -e"s,dsk,rdsk," -e"s,[ ]*),,"`
636		svm_md_device=`$STMSBOOTUTIL -m $new_rootdev`
637		update_sysfiles
638	else
639		echo "STMS is already ${cmd}d. No changes or reboots needed"
640	fi
641
642
643elif [ "$cmd" = "update" ]; then
644	if [ "$MACH" = "i386" ]; then
645	# In this case we always change the bootpath to phci-based
646	# path first. bootpath will later be modified in mpxio-upgrade
647	# to the vhci-based path if mpxio is enabled on root.
648		get_newbootpath_for_stmsdev
649		if [ $? -ne 0 ]; then
650			gettext "failed to update bootpath.\n" 1>&2
651			return 1
652		fi
653	fi
654	update_sysfiles
655
656elif [ "$cmd" = "list" ]; then
657		$STMSBOOTUTIL $GUID -l $controller
658else
659		$STMSBOOTUTIL $GUID -L
660fi
661
662exit $?
663