xref: /illumos-gate/usr/src/cmd/boot/scripts/boot-archive-update.ksh (revision 986fd29a0dc13f7608ef7f508f6e700bd7bc2720)
158091fd8Ssetje#!/sbin/sh
258091fd8Ssetje#
358091fd8Ssetje# CDDL HEADER START
458091fd8Ssetje#
558091fd8Ssetje# The contents of this file are subject to the terms of the
658091fd8Ssetje# Common Development and Distribution License (the "License").
758091fd8Ssetje# You may not use this file except in compliance with the License.
858091fd8Ssetje#
958091fd8Ssetje# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
1058091fd8Ssetje# or http://www.opensolaris.org/os/licensing.
1158091fd8Ssetje# See the License for the specific language governing permissions
1258091fd8Ssetje# and limitations under the License.
1358091fd8Ssetje#
1458091fd8Ssetje# When distributing Covered Code, include this CDDL HEADER in each
1558091fd8Ssetje# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
1658091fd8Ssetje# If applicable, add the following below this CDDL HEADER, with the
1758091fd8Ssetje# fields enclosed by brackets "[]" replaced with your own identifying
1858091fd8Ssetje# information: Portions Copyright [yyyy] [name of copyright owner]
1958091fd8Ssetje#
2058091fd8Ssetje# CDDL HEADER END
2158091fd8Ssetje#
2258091fd8Ssetje#
23*986fd29aSsetje# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
2458091fd8Ssetje# Use is subject to license terms.
2558091fd8Ssetje#
2658091fd8Ssetje# ident	"%Z%%M%	%I%	%E% SMI"
2758091fd8Ssetje
2858091fd8Ssetje. /lib/svc/share/smf_include.sh
2958091fd8Ssetje. /lib/svc/share/fs_include.sh
3058091fd8Ssetje
3158091fd8SsetjeUPDATEFILE=/etc/svc/volatile/boot_archive_needs_update
3258091fd8Ssetje
3358091fd8Ssetjesmf_is_globalzone || exit $SMF_EXIT_OK
3458091fd8Ssetje
35*986fd29aSsetje# on x86 get rid of transient reboot entry in the GRUB menu
3658091fd8Ssetje#
37*986fd29aSsetjeif [ `uname -p` = "i386" ]; then
3858091fd8Ssetje	if [ -f /stubboot/boot/grub/menu.lst ]; then
3958091fd8Ssetje		/sbin/bootadm -m update_temp -R /stubboot
4058091fd8Ssetje	else
4158091fd8Ssetje		/sbin/bootadm -m update_temp
4258091fd8Ssetje	fi
43*986fd29aSsetjefi
4458091fd8Ssetje
4558091fd8Ssetjeif [ -f $UPDATEFILE ] || [ -f /reconfigure ]; then
4658091fd8Ssetje	/usr/sbin/rtc -c > /dev/null 2>&1
4758091fd8Ssetje	/sbin/bootadm update-archive
4858091fd8Ssetje	rm -f $UPDATEFILE
4958091fd8Ssetjefi
5058091fd8Ssetje
5158091fd8Ssetjeexit $SMF_EXIT_OK
52