author | Sue Sohn <Susan.Sohn@Oracle.COM> |
Fri, 20 Aug 2010 11:31:18 -0600 | |
changeset 862 | e9f31f2f2f2d |
parent 707 | 2274294287c2 |
child 877 | 289fa7bf1a6b |
permissions | -rw-r--r-- |
242
ded531107d87
3635 Auto Installer (AI) SMF service is required by AI project
Jan Damborsky <jan.damborsky@sun.com>
parents:
diff
changeset
|
1 |
#!/sbin/sh |
ded531107d87
3635 Auto Installer (AI) SMF service is required by AI project
Jan Damborsky <jan.damborsky@sun.com>
parents:
diff
changeset
|
2 |
# |
ded531107d87
3635 Auto Installer (AI) SMF service is required by AI project
Jan Damborsky <jan.damborsky@sun.com>
parents:
diff
changeset
|
3 |
# CDDL HEADER START |
ded531107d87
3635 Auto Installer (AI) SMF service is required by AI project
Jan Damborsky <jan.damborsky@sun.com>
parents:
diff
changeset
|
4 |
# |
ded531107d87
3635 Auto Installer (AI) SMF service is required by AI project
Jan Damborsky <jan.damborsky@sun.com>
parents:
diff
changeset
|
5 |
# The contents of this file are subject to the terms of the |
ded531107d87
3635 Auto Installer (AI) SMF service is required by AI project
Jan Damborsky <jan.damborsky@sun.com>
parents:
diff
changeset
|
6 |
# Common Development and Distribution License (the "License"). |
ded531107d87
3635 Auto Installer (AI) SMF service is required by AI project
Jan Damborsky <jan.damborsky@sun.com>
parents:
diff
changeset
|
7 |
# You may not use this file except in compliance with the License. |
ded531107d87
3635 Auto Installer (AI) SMF service is required by AI project
Jan Damborsky <jan.damborsky@sun.com>
parents:
diff
changeset
|
8 |
# |
ded531107d87
3635 Auto Installer (AI) SMF service is required by AI project
Jan Damborsky <jan.damborsky@sun.com>
parents:
diff
changeset
|
9 |
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE |
ded531107d87
3635 Auto Installer (AI) SMF service is required by AI project
Jan Damborsky <jan.damborsky@sun.com>
parents:
diff
changeset
|
10 |
# or http://www.opensolaris.org/os/licensing. |
ded531107d87
3635 Auto Installer (AI) SMF service is required by AI project
Jan Damborsky <jan.damborsky@sun.com>
parents:
diff
changeset
|
11 |
# See the License for the specific language governing permissions |
ded531107d87
3635 Auto Installer (AI) SMF service is required by AI project
Jan Damborsky <jan.damborsky@sun.com>
parents:
diff
changeset
|
12 |
# and limitations under the License. |
ded531107d87
3635 Auto Installer (AI) SMF service is required by AI project
Jan Damborsky <jan.damborsky@sun.com>
parents:
diff
changeset
|
13 |
# |
ded531107d87
3635 Auto Installer (AI) SMF service is required by AI project
Jan Damborsky <jan.damborsky@sun.com>
parents:
diff
changeset
|
14 |
# When distributing Covered Code, include this CDDL HEADER in each |
ded531107d87
3635 Auto Installer (AI) SMF service is required by AI project
Jan Damborsky <jan.damborsky@sun.com>
parents:
diff
changeset
|
15 |
# file and include the License file at usr/src/OPENSOLARIS.LICENSE. |
ded531107d87
3635 Auto Installer (AI) SMF service is required by AI project
Jan Damborsky <jan.damborsky@sun.com>
parents:
diff
changeset
|
16 |
# If applicable, add the following below this CDDL HEADER, with the |
ded531107d87
3635 Auto Installer (AI) SMF service is required by AI project
Jan Damborsky <jan.damborsky@sun.com>
parents:
diff
changeset
|
17 |
# fields enclosed by brackets "[]" replaced with your own identifying |
ded531107d87
3635 Auto Installer (AI) SMF service is required by AI project
Jan Damborsky <jan.damborsky@sun.com>
parents:
diff
changeset
|
18 |
# information: Portions Copyright [yyyy] [name of copyright owner] |
ded531107d87
3635 Auto Installer (AI) SMF service is required by AI project
Jan Damborsky <jan.damborsky@sun.com>
parents:
diff
changeset
|
19 |
# |
ded531107d87
3635 Auto Installer (AI) SMF service is required by AI project
Jan Damborsky <jan.damborsky@sun.com>
parents:
diff
changeset
|
20 |
# CDDL HEADER END |
ded531107d87
3635 Auto Installer (AI) SMF service is required by AI project
Jan Damborsky <jan.damborsky@sun.com>
parents:
diff
changeset
|
21 |
# |
ded531107d87
3635 Auto Installer (AI) SMF service is required by AI project
Jan Damborsky <jan.damborsky@sun.com>
parents:
diff
changeset
|
22 |
# |
862
e9f31f2f2f2d
16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents:
707
diff
changeset
|
23 |
# Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. |
242
ded531107d87
3635 Auto Installer (AI) SMF service is required by AI project
Jan Damborsky <jan.damborsky@sun.com>
parents:
diff
changeset
|
24 |
# |
ded531107d87
3635 Auto Installer (AI) SMF service is required by AI project
Jan Damborsky <jan.damborsky@sun.com>
parents:
diff
changeset
|
25 |
|
461
c51e3b699738
6556 AI should provide an option for automatic reboot after an install
Jan Damborsky <jan.damborsky@sun.com>
parents:
408
diff
changeset
|
26 |
# Use tee(1) when posting messages to both console and log file |
c51e3b699738
6556 AI should provide an option for automatic reboot after an install
Jan Damborsky <jan.damborsky@sun.com>
parents:
408
diff
changeset
|
27 |
TEE_LOGTOCONSOLE="/usr/bin/tee /dev/msglog" |
242
ded531107d87
3635 Auto Installer (AI) SMF service is required by AI project
Jan Damborsky <jan.damborsky@sun.com>
parents:
diff
changeset
|
28 |
# Auto installer |
ded531107d87
3635 Auto Installer (AI) SMF service is required by AI project
Jan Damborsky <jan.damborsky@sun.com>
parents:
diff
changeset
|
29 |
AI_ENGINE=/usr/bin/auto-install |
461
c51e3b699738
6556 AI should provide an option for automatic reboot after an install
Jan Damborsky <jan.damborsky@sun.com>
parents:
408
diff
changeset
|
30 |
# AI Engine exit codes |
c51e3b699738
6556 AI should provide an option for automatic reboot after an install
Jan Damborsky <jan.damborsky@sun.com>
parents:
408
diff
changeset
|
31 |
# failure |
c51e3b699738
6556 AI should provide an option for automatic reboot after an install
Jan Damborsky <jan.damborsky@sun.com>
parents:
408
diff
changeset
|
32 |
AI_ENGINE_EXIT_FAILURE=1 |
495
a0961490f883
7415 'slim_install' is left on system when Automated Installer is used for the installation
Jan Damborsky <jan.damborsky@sun.com>
parents:
468
diff
changeset
|
33 |
# invalid or incompatible manifest specified |
a0961490f883
7415 'slim_install' is left on system when Automated Installer is used for the installation
Jan Damborsky <jan.damborsky@sun.com>
parents:
468
diff
changeset
|
34 |
AI_ENGINE_EXIT_FAILURE_INVALID_MANIFEST=2 |
461
c51e3b699738
6556 AI should provide an option for automatic reboot after an install
Jan Damborsky <jan.damborsky@sun.com>
parents:
408
diff
changeset
|
35 |
# success - do not reboot |
c51e3b699738
6556 AI should provide an option for automatic reboot after an install
Jan Damborsky <jan.damborsky@sun.com>
parents:
408
diff
changeset
|
36 |
AI_ENGINE_EXIT_SUCCESS=0 |
c51e3b699738
6556 AI should provide an option for automatic reboot after an install
Jan Damborsky <jan.damborsky@sun.com>
parents:
408
diff
changeset
|
37 |
# success - auto reboot |
c51e3b699738
6556 AI should provide an option for automatic reboot after an install
Jan Damborsky <jan.damborsky@sun.com>
parents:
408
diff
changeset
|
38 |
AI_ENGINE_EXIT_REBOOT=64 |
c51e3b699738
6556 AI should provide an option for automatic reboot after an install
Jan Damborsky <jan.damborsky@sun.com>
parents:
408
diff
changeset
|
39 |
|
660
d87123ecef4a
10039 Blocker for AI Bootable Media
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
514
diff
changeset
|
40 |
# Auto install and System configuration combined manifest |
281
00280241e3ad
3928 auto-install ovewrites provided AI manifest
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
251
diff
changeset
|
41 |
AISC_MANIFEST=/tmp/ai_combined_manifest.xml |
660
d87123ecef4a
10039 Blocker for AI Bootable Media
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
514
diff
changeset
|
42 |
|
d87123ecef4a
10039 Blocker for AI Bootable Media
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
514
diff
changeset
|
43 |
ISA_INFO=`/usr/bin/uname -p` |
d87123ecef4a
10039 Blocker for AI Bootable Media
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
514
diff
changeset
|
44 |
PRTCONF=/usr/sbin/prtconf |
707
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
695
diff
changeset
|
45 |
SVCPROP=/usr/bin/svcprop |
862
e9f31f2f2f2d
16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents:
707
diff
changeset
|
46 |
SED=/usr/bin/sed |
242
ded531107d87
3635 Auto Installer (AI) SMF service is required by AI project
Jan Damborsky <jan.damborsky@sun.com>
parents:
diff
changeset
|
47 |
|
ded531107d87
3635 Auto Installer (AI) SMF service is required by AI project
Jan Damborsky <jan.damborsky@sun.com>
parents:
diff
changeset
|
48 |
. /lib/svc/share/smf_include.sh |
ded531107d87
3635 Auto Installer (AI) SMF service is required by AI project
Jan Damborsky <jan.damborsky@sun.com>
parents:
diff
changeset
|
49 |
|
ded531107d87
3635 Auto Installer (AI) SMF service is required by AI project
Jan Damborsky <jan.damborsky@sun.com>
parents:
diff
changeset
|
50 |
# |
292
4153346c943e
4013 svc:/auto-installer:default has to be disabled outside of AI environment
Jan Damborsky <jan.damborsky@sun.com>
parents:
285
diff
changeset
|
51 |
# Exit with SMF_EXIT_ERR_CONFIG if not invoked from Automated Installer |
4153346c943e
4013 svc:/auto-installer:default has to be disabled outside of AI environment
Jan Damborsky <jan.damborsky@sun.com>
parents:
285
diff
changeset
|
52 |
# environment |
4153346c943e
4013 svc:/auto-installer:default has to be disabled outside of AI environment
Jan Damborsky <jan.damborsky@sun.com>
parents:
285
diff
changeset
|
53 |
# |
4153346c943e
4013 svc:/auto-installer:default has to be disabled outside of AI environment
Jan Damborsky <jan.damborsky@sun.com>
parents:
285
diff
changeset
|
54 |
if [ ! -f /.autoinstall ] ; then |
468
78cbeb8904af
6320 'No valid AI service found' error if AI client and server are on different subnets
Jan Damborsky <jan.damborsky@sun.com>
parents:
461
diff
changeset
|
55 |
echo "Not running in Automated Installer environment. The service can" \ |
78cbeb8904af
6320 'No valid AI service found' error if AI client and server are on different subnets
Jan Damborsky <jan.damborsky@sun.com>
parents:
461
diff
changeset
|
56 |
" only be enabled in Automated Installer environment" | |
78cbeb8904af
6320 'No valid AI service found' error if AI client and server are on different subnets
Jan Damborsky <jan.damborsky@sun.com>
parents:
461
diff
changeset
|
57 |
$TEE_LOGTOCONSOLE |
292
4153346c943e
4013 svc:/auto-installer:default has to be disabled outside of AI environment
Jan Damborsky <jan.damborsky@sun.com>
parents:
285
diff
changeset
|
58 |
|
4153346c943e
4013 svc:/auto-installer:default has to be disabled outside of AI environment
Jan Damborsky <jan.damborsky@sun.com>
parents:
285
diff
changeset
|
59 |
exit $SMF_EXIT_ERR_CONFIG |
4153346c943e
4013 svc:/auto-installer:default has to be disabled outside of AI environment
Jan Damborsky <jan.damborsky@sun.com>
parents:
285
diff
changeset
|
60 |
fi |
4153346c943e
4013 svc:/auto-installer:default has to be disabled outside of AI environment
Jan Damborsky <jan.damborsky@sun.com>
parents:
285
diff
changeset
|
61 |
|
4153346c943e
4013 svc:/auto-installer:default has to be disabled outside of AI environment
Jan Damborsky <jan.damborsky@sun.com>
parents:
285
diff
changeset
|
62 |
# |
309
eb5a5bba60c6
4029 auto-install should log install start/finish to the console
Jan Damborsky <jan.damborsky@sun.com>
parents:
292
diff
changeset
|
63 |
# Call AI engine to carry out real installation and inform the user |
eb5a5bba60c6
4029 auto-install should log install start/finish to the console
Jan Damborsky <jan.damborsky@sun.com>
parents:
292
diff
changeset
|
64 |
# that installation was kicked off |
242
ded531107d87
3635 Auto Installer (AI) SMF service is required by AI project
Jan Damborsky <jan.damborsky@sun.com>
parents:
diff
changeset
|
65 |
# |
ded531107d87
3635 Auto Installer (AI) SMF service is required by AI project
Jan Damborsky <jan.damborsky@sun.com>
parents:
diff
changeset
|
66 |
|
ded531107d87
3635 Auto Installer (AI) SMF service is required by AI project
Jan Damborsky <jan.damborsky@sun.com>
parents:
diff
changeset
|
67 |
if [ ! -x $AI_ENGINE ] ; then |
468
78cbeb8904af
6320 'No valid AI service found' error if AI client and server are on different subnets
Jan Damborsky <jan.damborsky@sun.com>
parents:
461
diff
changeset
|
68 |
echo "Couldn't find Auto Installer engine" | $TEE_LOGTOCONSOLE |
242
ded531107d87
3635 Auto Installer (AI) SMF service is required by AI project
Jan Damborsky <jan.damborsky@sun.com>
parents:
diff
changeset
|
69 |
exit $SMF_EXIT_ERR_FATAL |
ded531107d87
3635 Auto Installer (AI) SMF service is required by AI project
Jan Damborsky <jan.damborsky@sun.com>
parents:
diff
changeset
|
70 |
fi |
ded531107d87
3635 Auto Installer (AI) SMF service is required by AI project
Jan Damborsky <jan.damborsky@sun.com>
parents:
diff
changeset
|
71 |
|
660
d87123ecef4a
10039 Blocker for AI Bootable Media
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
514
diff
changeset
|
72 |
# |
d87123ecef4a
10039 Blocker for AI Bootable Media
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
514
diff
changeset
|
73 |
# Set the auto shutdown upon a successful install flag |
d87123ecef4a
10039 Blocker for AI Bootable Media
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
514
diff
changeset
|
74 |
# if specified on the grub line |
d87123ecef4a
10039 Blocker for AI Bootable Media
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
514
diff
changeset
|
75 |
# |
d87123ecef4a
10039 Blocker for AI Bootable Media
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
514
diff
changeset
|
76 |
if [ "$ISA_INFO" = "i386" ]; then |
d87123ecef4a
10039 Blocker for AI Bootable Media
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
514
diff
changeset
|
77 |
AI_AUTO_SHUTDOWN=`$PRTCONF -v | /usr/bin/sed -n \ |
d87123ecef4a
10039 Blocker for AI Bootable Media
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
514
diff
changeset
|
78 |
'/auto-shutdown/{;n;p;}'| cut -f 2 -d\'` |
d87123ecef4a
10039 Blocker for AI Bootable Media
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
514
diff
changeset
|
79 |
if [ "$AI_AUTO_SHUTDOWN" = "enable" ]; then |
d87123ecef4a
10039 Blocker for AI Bootable Media
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
514
diff
changeset
|
80 |
echo "Shutdown requested. The system will be shutdown " \ |
d87123ecef4a
10039 Blocker for AI Bootable Media
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
514
diff
changeset
|
81 |
"after install" |
d87123ecef4a
10039 Blocker for AI Bootable Media
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
514
diff
changeset
|
82 |
fi |
707
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
695
diff
changeset
|
83 |
fi |
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
695
diff
changeset
|
84 |
|
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
695
diff
changeset
|
85 |
# |
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
695
diff
changeset
|
86 |
# Make sure the required manifest is in place, exit with failure otherwise. |
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
695
diff
changeset
|
87 |
# |
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
695
diff
changeset
|
88 |
if [ ! -f $AISC_MANIFEST ]; then |
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
695
diff
changeset
|
89 |
echo "" | $TEE_LOGTOCONSOLE |
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
695
diff
changeset
|
90 |
echo "Couldn't find manifest file at <$AISC_MANIFEST>" | |
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
695
diff
changeset
|
91 |
$TEE_LOGTOCONSOLE |
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
695
diff
changeset
|
92 |
exit $SMF_EXIT_ERR_FATAL |
660
d87123ecef4a
10039 Blocker for AI Bootable Media
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
514
diff
changeset
|
93 |
fi |
d87123ecef4a
10039 Blocker for AI Bootable Media
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
514
diff
changeset
|
94 |
|
707
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
695
diff
changeset
|
95 |
# |
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
695
diff
changeset
|
96 |
# Copy files required by XML validator to the same directory where AI manifest |
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
695
diff
changeset
|
97 |
# is stored. This is just temporary solution, better approach should be to |
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
695
diff
changeset
|
98 |
# point XML validator to where these file are. |
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
695
diff
changeset
|
99 |
# |
862
e9f31f2f2f2d
16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents:
707
diff
changeset
|
100 |
for dtd_file in "ai.dtd" "configuration.dtd" "software.dtd" "target.dtd" ; do |
e9f31f2f2f2d
16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents:
707
diff
changeset
|
101 |
if [ ! -f "/usr/share/auto_install/$dtd_file" ] ; then |
e9f31f2f2f2d
16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents:
707
diff
changeset
|
102 |
echo "Couldn't find /usr/share/auto_install/$dtd_file" |
e9f31f2f2f2d
16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents:
707
diff
changeset
|
103 |
exit $SMF_EXIT_ERR_FATAL |
e9f31f2f2f2d
16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents:
707
diff
changeset
|
104 |
fi |
e9f31f2f2f2d
16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents:
707
diff
changeset
|
105 |
/usr/bin/cp "/usr/share/auto_install/$dtd_file" /tmp/ |
e9f31f2f2f2d
16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents:
707
diff
changeset
|
106 |
done |
707
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
695
diff
changeset
|
107 |
|
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
695
diff
changeset
|
108 |
echo "" | $TEE_LOGTOCONSOLE |
468
78cbeb8904af
6320 'No valid AI service found' error if AI client and server are on different subnets
Jan Damborsky <jan.damborsky@sun.com>
parents:
461
diff
changeset
|
109 |
echo "Automated Installation started" | $TEE_LOGTOCONSOLE |
707
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
695
diff
changeset
|
110 |
echo "The progress of the Automated Installation can be followed by viewing" | |
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
695
diff
changeset
|
111 |
$TEE_LOGTOCONSOLE |
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
695
diff
changeset
|
112 |
echo "the logfile at /tmp/install_log" | $TEE_LOGTOCONSOLE |
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
695
diff
changeset
|
113 |
echo "" | $TEE_LOGTOCONSOLE |
309
eb5a5bba60c6
4029 auto-install should log install start/finish to the console
Jan Damborsky <jan.damborsky@sun.com>
parents:
292
diff
changeset
|
114 |
|
514
517a34f61a54
4443 Automated Installer needs support for better observability
Jan Damborsky <jan.damborsky@sun.com>
parents:
495
diff
changeset
|
115 |
# |
517a34f61a54
4443 Automated Installer needs support for better observability
Jan Damborsky <jan.damborsky@sun.com>
parents:
495
diff
changeset
|
116 |
# Enable the installer to be run in debug mode if requested. |
517a34f61a54
4443 Automated Installer needs support for better observability
Jan Damborsky <jan.damborsky@sun.com>
parents:
495
diff
changeset
|
117 |
# |
707
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
695
diff
changeset
|
118 |
AI_DEBUG_MODE=`$SVCPROP -c -p general/install_debug $SMF_FMRI` |
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
695
diff
changeset
|
119 |
if [ $? -eq 0 -a "$AI_DEBUG_MODE" = "enable" ] ; then |
514
517a34f61a54
4443 Automated Installer needs support for better observability
Jan Damborsky <jan.damborsky@sun.com>
parents:
495
diff
changeset
|
120 |
echo "Installer will be run in debug mode" | $TEE_LOGTOCONSOLE |
517a34f61a54
4443 Automated Installer needs support for better observability
Jan Damborsky <jan.damborsky@sun.com>
parents:
495
diff
changeset
|
121 |
|
517a34f61a54
4443 Automated Installer needs support for better observability
Jan Damborsky <jan.damborsky@sun.com>
parents:
495
diff
changeset
|
122 |
# set verbose mode for invoked beadm(1M) commands |
517a34f61a54
4443 Automated Installer needs support for better observability
Jan Damborsky <jan.damborsky@sun.com>
parents:
495
diff
changeset
|
123 |
export BE_PRINT_ERR=true |
517a34f61a54
4443 Automated Installer needs support for better observability
Jan Damborsky <jan.damborsky@sun.com>
parents:
495
diff
changeset
|
124 |
|
517a34f61a54
4443 Automated Installer needs support for better observability
Jan Damborsky <jan.damborsky@sun.com>
parents:
495
diff
changeset
|
125 |
# enable verbose mode for logging service and ICT |
517a34f61a54
4443 Automated Installer needs support for better observability
Jan Damborsky <jan.damborsky@sun.com>
parents:
495
diff
changeset
|
126 |
export LS_DBG_LVL=4 |
517a34f61a54
4443 Automated Installer needs support for better observability
Jan Damborsky <jan.damborsky@sun.com>
parents:
495
diff
changeset
|
127 |
$AI_ENGINE -v -p $AISC_MANIFEST |
517a34f61a54
4443 Automated Installer needs support for better observability
Jan Damborsky <jan.damborsky@sun.com>
parents:
495
diff
changeset
|
128 |
else |
517a34f61a54
4443 Automated Installer needs support for better observability
Jan Damborsky <jan.damborsky@sun.com>
parents:
495
diff
changeset
|
129 |
$AI_ENGINE -p $AISC_MANIFEST |
517a34f61a54
4443 Automated Installer needs support for better observability
Jan Damborsky <jan.damborsky@sun.com>
parents:
495
diff
changeset
|
130 |
fi |
517a34f61a54
4443 Automated Installer needs support for better observability
Jan Damborsky <jan.damborsky@sun.com>
parents:
495
diff
changeset
|
131 |
|
285
69496f25c2eb
3977 /lib/svc/method/auto-installer exits with $SMF_EXIT_OK even if AI engine fails
Jan Damborsky <jan.damborsky@sun.com>
parents:
281
diff
changeset
|
132 |
ret=$? |
242
ded531107d87
3635 Auto Installer (AI) SMF service is required by AI project
Jan Damborsky <jan.damborsky@sun.com>
parents:
diff
changeset
|
133 |
|
461
c51e3b699738
6556 AI should provide an option for automatic reboot after an install
Jan Damborsky <jan.damborsky@sun.com>
parents:
408
diff
changeset
|
134 |
# Process exit code returned from AI engine |
c51e3b699738
6556 AI should provide an option for automatic reboot after an install
Jan Damborsky <jan.damborsky@sun.com>
parents:
408
diff
changeset
|
135 |
|
c51e3b699738
6556 AI should provide an option for automatic reboot after an install
Jan Damborsky <jan.damborsky@sun.com>
parents:
408
diff
changeset
|
136 |
case $ret in |
309
eb5a5bba60c6
4029 auto-install should log install start/finish to the console
Jan Damborsky <jan.damborsky@sun.com>
parents:
292
diff
changeset
|
137 |
# |
461
c51e3b699738
6556 AI should provide an option for automatic reboot after an install
Jan Damborsky <jan.damborsky@sun.com>
parents:
408
diff
changeset
|
138 |
# Automated Installer finished successfully. Pass the control |
c51e3b699738
6556 AI should provide an option for automatic reboot after an install
Jan Damborsky <jan.damborsky@sun.com>
parents:
408
diff
changeset
|
139 |
# to the user |
309
eb5a5bba60c6
4029 auto-install should log install start/finish to the console
Jan Damborsky <jan.damborsky@sun.com>
parents:
292
diff
changeset
|
140 |
# |
461
c51e3b699738
6556 AI should provide an option for automatic reboot after an install
Jan Damborsky <jan.damborsky@sun.com>
parents:
408
diff
changeset
|
141 |
$AI_ENGINE_EXIT_SUCCESS) |
468
78cbeb8904af
6320 'No valid AI service found' error if AI client and server are on different subnets
Jan Damborsky <jan.damborsky@sun.com>
parents:
461
diff
changeset
|
142 |
echo "Automated Installation finished successfully" | |
78cbeb8904af
6320 'No valid AI service found' error if AI client and server are on different subnets
Jan Damborsky <jan.damborsky@sun.com>
parents:
461
diff
changeset
|
143 |
$TEE_LOGTOCONSOLE |
78cbeb8904af
6320 'No valid AI service found' error if AI client and server are on different subnets
Jan Damborsky <jan.damborsky@sun.com>
parents:
461
diff
changeset
|
144 |
echo "The system can be rebooted now" | $TEE_LOGTOCONSOLE |
461
c51e3b699738
6556 AI should provide an option for automatic reboot after an install
Jan Damborsky <jan.damborsky@sun.com>
parents:
408
diff
changeset
|
145 |
echo "Please refer to /tmp/install_log file " \ |
468
78cbeb8904af
6320 'No valid AI service found' error if AI client and server are on different subnets
Jan Damborsky <jan.damborsky@sun.com>
parents:
461
diff
changeset
|
146 |
"for details" | $TEE_LOGTOCONSOLE |
461
c51e3b699738
6556 AI should provide an option for automatic reboot after an install
Jan Damborsky <jan.damborsky@sun.com>
parents:
408
diff
changeset
|
147 |
|
c51e3b699738
6556 AI should provide an option for automatic reboot after an install
Jan Damborsky <jan.damborsky@sun.com>
parents:
408
diff
changeset
|
148 |
echo "After reboot it will be located at " \ |
468
78cbeb8904af
6320 'No valid AI service found' error if AI client and server are on different subnets
Jan Damborsky <jan.damborsky@sun.com>
parents:
461
diff
changeset
|
149 |
"/var/sadm/system/logs/install_log" | $TEE_LOGTOCONSOLE |
461
c51e3b699738
6556 AI should provide an option for automatic reboot after an install
Jan Damborsky <jan.damborsky@sun.com>
parents:
408
diff
changeset
|
150 |
|
660
d87123ecef4a
10039 Blocker for AI Bootable Media
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
514
diff
changeset
|
151 |
if [ "$AI_AUTO_SHUTDOWN" = "enable" ]; then |
d87123ecef4a
10039 Blocker for AI Bootable Media
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
514
diff
changeset
|
152 |
echo "Shutdown requested. Shutting down the system" | \ |
d87123ecef4a
10039 Blocker for AI Bootable Media
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
514
diff
changeset
|
153 |
$TEE_LOGTOCONSOLE |
d87123ecef4a
10039 Blocker for AI Bootable Media
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
514
diff
changeset
|
154 |
/usr/sbin/shutdown -y -g 1 -i 5 & |
d87123ecef4a
10039 Blocker for AI Bootable Media
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
514
diff
changeset
|
155 |
fi |
d87123ecef4a
10039 Blocker for AI Bootable Media
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
514
diff
changeset
|
156 |
|
461
c51e3b699738
6556 AI should provide an option for automatic reboot after an install
Jan Damborsky <jan.damborsky@sun.com>
parents:
408
diff
changeset
|
157 |
exit $SMF_EXIT_OK |
c51e3b699738
6556 AI should provide an option for automatic reboot after an install
Jan Damborsky <jan.damborsky@sun.com>
parents:
408
diff
changeset
|
158 |
;; |
309
eb5a5bba60c6
4029 auto-install should log install start/finish to the console
Jan Damborsky <jan.damborsky@sun.com>
parents:
292
diff
changeset
|
159 |
|
461
c51e3b699738
6556 AI should provide an option for automatic reboot after an install
Jan Damborsky <jan.damborsky@sun.com>
parents:
408
diff
changeset
|
160 |
# |
c51e3b699738
6556 AI should provide an option for automatic reboot after an install
Jan Damborsky <jan.damborsky@sun.com>
parents:
408
diff
changeset
|
161 |
# Automated Installer finished successfully. |
c51e3b699738
6556 AI should provide an option for automatic reboot after an install
Jan Damborsky <jan.damborsky@sun.com>
parents:
408
diff
changeset
|
162 |
# Automated reboot was enabled in AI manifest, reboot now. |
309
eb5a5bba60c6
4029 auto-install should log install start/finish to the console
Jan Damborsky <jan.damborsky@sun.com>
parents:
292
diff
changeset
|
163 |
# |
461
c51e3b699738
6556 AI should provide an option for automatic reboot after an install
Jan Damborsky <jan.damborsky@sun.com>
parents:
408
diff
changeset
|
164 |
$AI_ENGINE_EXIT_REBOOT) |
468
78cbeb8904af
6320 'No valid AI service found' error if AI client and server are on different subnets
Jan Damborsky <jan.damborsky@sun.com>
parents:
461
diff
changeset
|
165 |
echo "Automated Installation finished successfully" | |
78cbeb8904af
6320 'No valid AI service found' error if AI client and server are on different subnets
Jan Damborsky <jan.damborsky@sun.com>
parents:
461
diff
changeset
|
166 |
$TEE_LOGTOCONSOLE |
78cbeb8904af
6320 'No valid AI service found' error if AI client and server are on different subnets
Jan Damborsky <jan.damborsky@sun.com>
parents:
461
diff
changeset
|
167 |
echo "Automated reboot enabled. The system will be " \ |
78cbeb8904af
6320 'No valid AI service found' error if AI client and server are on different subnets
Jan Damborsky <jan.damborsky@sun.com>
parents:
461
diff
changeset
|
168 |
"rebooted now" | $TEE_LOGTOCONSOLE |
78cbeb8904af
6320 'No valid AI service found' error if AI client and server are on different subnets
Jan Damborsky <jan.damborsky@sun.com>
parents:
461
diff
changeset
|
169 |
echo "Log files will be available in /var/sadm/system/logs/ " \ |
78cbeb8904af
6320 'No valid AI service found' error if AI client and server are on different subnets
Jan Damborsky <jan.damborsky@sun.com>
parents:
461
diff
changeset
|
170 |
"directory after reboot" | $TEE_LOGTOCONSOLE |
461
c51e3b699738
6556 AI should provide an option for automatic reboot after an install
Jan Damborsky <jan.damborsky@sun.com>
parents:
408
diff
changeset
|
171 |
|
c51e3b699738
6556 AI should provide an option for automatic reboot after an install
Jan Damborsky <jan.damborsky@sun.com>
parents:
408
diff
changeset
|
172 |
/usr/sbin/reboot |
c51e3b699738
6556 AI should provide an option for automatic reboot after an install
Jan Damborsky <jan.damborsky@sun.com>
parents:
408
diff
changeset
|
173 |
exit $SMF_EXIT_OK |
c51e3b699738
6556 AI should provide an option for automatic reboot after an install
Jan Damborsky <jan.damborsky@sun.com>
parents:
408
diff
changeset
|
174 |
;; |
c51e3b699738
6556 AI should provide an option for automatic reboot after an install
Jan Damborsky <jan.damborsky@sun.com>
parents:
408
diff
changeset
|
175 |
|
c51e3b699738
6556 AI should provide an option for automatic reboot after an install
Jan Damborsky <jan.damborsky@sun.com>
parents:
408
diff
changeset
|
176 |
# |
495
a0961490f883
7415 'slim_install' is left on system when Automated Installer is used for the installation
Jan Damborsky <jan.damborsky@sun.com>
parents:
468
diff
changeset
|
177 |
# Invalid or incompatible AI configuration manifest specified |
a0961490f883
7415 'slim_install' is left on system when Automated Installer is used for the installation
Jan Damborsky <jan.damborsky@sun.com>
parents:
468
diff
changeset
|
178 |
# |
a0961490f883
7415 'slim_install' is left on system when Automated Installer is used for the installation
Jan Damborsky <jan.damborsky@sun.com>
parents:
468
diff
changeset
|
179 |
$AI_ENGINE_EXIT_FAILURE_INVALID_MANIFEST) |
a0961490f883
7415 'slim_install' is left on system when Automated Installer is used for the installation
Jan Damborsky <jan.damborsky@sun.com>
parents:
468
diff
changeset
|
180 |
echo "Invalid or incompatible manifest provided" | |
a0961490f883
7415 'slim_install' is left on system when Automated Installer is used for the installation
Jan Damborsky <jan.damborsky@sun.com>
parents:
468
diff
changeset
|
181 |
$TEE_LOGTOCONSOLE |
a0961490f883
7415 'slim_install' is left on system when Automated Installer is used for the installation
Jan Damborsky <jan.damborsky@sun.com>
parents:
468
diff
changeset
|
182 |
echo "Please refer to "\ |
a0961490f883
7415 'slim_install' is left on system when Automated Installer is used for the installation
Jan Damborsky <jan.damborsky@sun.com>
parents:
468
diff
changeset
|
183 |
"/var/svc/log/application-auto-installer:default.log "\ |
a0961490f883
7415 'slim_install' is left on system when Automated Installer is used for the installation
Jan Damborsky <jan.damborsky@sun.com>
parents:
468
diff
changeset
|
184 |
"file for details" | $TEE_LOGTOCONSOLE |
a0961490f883
7415 'slim_install' is left on system when Automated Installer is used for the installation
Jan Damborsky <jan.damborsky@sun.com>
parents:
468
diff
changeset
|
185 |
|
a0961490f883
7415 'slim_install' is left on system when Automated Installer is used for the installation
Jan Damborsky <jan.damborsky@sun.com>
parents:
468
diff
changeset
|
186 |
exit $SMF_EXIT_ERR_FATAL |
a0961490f883
7415 'slim_install' is left on system when Automated Installer is used for the installation
Jan Damborsky <jan.damborsky@sun.com>
parents:
468
diff
changeset
|
187 |
;; |
a0961490f883
7415 'slim_install' is left on system when Automated Installer is used for the installation
Jan Damborsky <jan.damborsky@sun.com>
parents:
468
diff
changeset
|
188 |
|
a0961490f883
7415 'slim_install' is left on system when Automated Installer is used for the installation
Jan Damborsky <jan.damborsky@sun.com>
parents:
468
diff
changeset
|
189 |
# |
461
c51e3b699738
6556 AI should provide an option for automatic reboot after an install
Jan Damborsky <jan.damborsky@sun.com>
parents:
408
diff
changeset
|
190 |
# Automated installation failed. |
309
eb5a5bba60c6
4029 auto-install should log install start/finish to the console
Jan Damborsky <jan.damborsky@sun.com>
parents:
292
diff
changeset
|
191 |
# |
461
c51e3b699738
6556 AI should provide an option for automatic reboot after an install
Jan Damborsky <jan.damborsky@sun.com>
parents:
408
diff
changeset
|
192 |
$AI_ENGINE_EXIT_FAILURE) |
468
78cbeb8904af
6320 'No valid AI service found' error if AI client and server are on different subnets
Jan Damborsky <jan.damborsky@sun.com>
parents:
461
diff
changeset
|
193 |
echo "Automated Installation failed" | $TEE_LOGTOCONSOLE |
461
c51e3b699738
6556 AI should provide an option for automatic reboot after an install
Jan Damborsky <jan.damborsky@sun.com>
parents:
408
diff
changeset
|
194 |
echo "Please refer to /tmp/install_log file for " \ |
468
78cbeb8904af
6320 'No valid AI service found' error if AI client and server are on different subnets
Jan Damborsky <jan.damborsky@sun.com>
parents:
461
diff
changeset
|
195 |
"details" | $TEE_LOGTOCONSOLE |
461
c51e3b699738
6556 AI should provide an option for automatic reboot after an install
Jan Damborsky <jan.damborsky@sun.com>
parents:
408
diff
changeset
|
196 |
|
c51e3b699738
6556 AI should provide an option for automatic reboot after an install
Jan Damborsky <jan.damborsky@sun.com>
parents:
408
diff
changeset
|
197 |
exit $SMF_EXIT_ERR_FATAL |
c51e3b699738
6556 AI should provide an option for automatic reboot after an install
Jan Damborsky <jan.damborsky@sun.com>
parents:
408
diff
changeset
|
198 |
;; |
309
eb5a5bba60c6
4029 auto-install should log install start/finish to the console
Jan Damborsky <jan.damborsky@sun.com>
parents:
292
diff
changeset
|
199 |
|
461
c51e3b699738
6556 AI should provide an option for automatic reboot after an install
Jan Damborsky <jan.damborsky@sun.com>
parents:
408
diff
changeset
|
200 |
# |
c51e3b699738
6556 AI should provide an option for automatic reboot after an install
Jan Damborsky <jan.damborsky@sun.com>
parents:
408
diff
changeset
|
201 |
# Automated installation failed with unknown exit code |
c51e3b699738
6556 AI should provide an option for automatic reboot after an install
Jan Damborsky <jan.damborsky@sun.com>
parents:
408
diff
changeset
|
202 |
# |
c51e3b699738
6556 AI should provide an option for automatic reboot after an install
Jan Damborsky <jan.damborsky@sun.com>
parents:
408
diff
changeset
|
203 |
*) |
468
78cbeb8904af
6320 'No valid AI service found' error if AI client and server are on different subnets
Jan Damborsky <jan.damborsky@sun.com>
parents:
461
diff
changeset
|
204 |
echo "Automated Installation failed" | $TEE_LOGTOCONSOLE |
78cbeb8904af
6320 'No valid AI service found' error if AI client and server are on different subnets
Jan Damborsky <jan.damborsky@sun.com>
parents:
461
diff
changeset
|
205 |
echo "Unknown exit code $ret returned" | $TEE_LOGTOCONSOLE |
461
c51e3b699738
6556 AI should provide an option for automatic reboot after an install
Jan Damborsky <jan.damborsky@sun.com>
parents:
408
diff
changeset
|
206 |
|
c51e3b699738
6556 AI should provide an option for automatic reboot after an install
Jan Damborsky <jan.damborsky@sun.com>
parents:
408
diff
changeset
|
207 |
exit $SMF_EXIT_ERR_FATAL |
c51e3b699738
6556 AI should provide an option for automatic reboot after an install
Jan Damborsky <jan.damborsky@sun.com>
parents:
408
diff
changeset
|
208 |
;; |
c51e3b699738
6556 AI should provide an option for automatic reboot after an install
Jan Damborsky <jan.damborsky@sun.com>
parents:
408
diff
changeset
|
209 |
esac |