author | Alasdair Lumsden <al@everycity.co.uk> |
Sun, 21 Aug 2011 19:36:01 +0000 | |
branch | oi_151a |
changeset 1423 | 186be1527fbd |
parent 1400 | 6c54a8b98066 |
permissions | -rw-r--r-- |
773
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
1 |
# |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
2 |
# CDDL HEADER START |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
3 |
# |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
4 |
# The contents of this file are subject to the terms of the |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
5 |
# Common Development and Distribution License (the "License"). |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
6 |
# You may not use this file except in compliance with the License. |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
7 |
# |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
8 |
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
9 |
# or http://www.opensolaris.org/os/licensing. |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
10 |
# See the License for the specific language governing permissions |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
11 |
# and limitations under the License. |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
12 |
# |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
13 |
# When distributing Covered Code, include this CDDL HEADER in each |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
14 |
# file and include the License file at usr/src/OPENSOLARIS.LICENSE. |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
15 |
# If applicable, add the following below this CDDL HEADER, with the |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
16 |
# fields enclosed by brackets "[]" replaced with your own identifying |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
17 |
# information: Portions Copyright [yyyy] [name of copyright owner] |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
18 |
# |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
19 |
# CDDL HEADER END |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
20 |
# |
861
ccd399d2c6f7
6973927 Installation fails if Primary Administrator rights profile is removed from the system
David Miner <dminer@opensolaris.org>
parents:
773
diff
changeset
|
21 |
# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. |
773
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
22 |
# |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
23 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
24 |
''' |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
25 |
Installation engine for Text Installer |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
26 |
''' |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
27 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
28 |
import os |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
29 |
import logging |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
30 |
import commands |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
31 |
import datetime |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
32 |
import platform |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
33 |
import shutil |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
34 |
import subprocess as sp |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
35 |
import osol_install.tgt as tgt |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
36 |
from osol_install.libzoneinfo import tz_isvalid |
863
5a915c215754
16813 Need to remove beadm and libbe from slim_source
Glenn Lagasse <glenn.lagasse@oracle.com>
parents:
861
diff
changeset
|
37 |
from libbe_py import beUnmount |
773
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
38 |
from osol_install.transfer_mod import tm_perform_transfer, tm_abort_transfer |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
39 |
from osol_install.transfer_defs import TM_ATTR_MECHANISM, \ |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
40 |
TM_PERFORM_CPIO, TM_CPIO_ACTION, TM_CPIO_ENTIRE, TM_CPIO_SRC_MNTPT, \ |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
41 |
TM_CPIO_DST_MNTPT, TM_UNPACK_ARCHIVE, TM_SUCCESS |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
42 |
from osol_install.install_utils import exec_cmd_outputs_to_log |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
43 |
from osol_install.profile.disk_info import PartitionInfo |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
44 |
from osol_install.profile.network_info import NetworkInfo |
872
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
863
diff
changeset
|
45 |
from osol_install.text_install import RELEASE |
773
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
46 |
import osol_install.text_install.ti_install_utils as ti_utils |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
47 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
48 |
# |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
49 |
# RTC command to run |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
50 |
# |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
51 |
RTC_CMD = "/usr/sbin/rtc" |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
52 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
53 |
# |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
54 |
# Program used for calling the C ICT functions. |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
55 |
# When all the C-based ICT functions are converted to Python (bug 6256), |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
56 |
# this can be removed. |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
57 |
# |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
58 |
ICT_PROG = "/opt/install-test/bin/ict_test" |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
59 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
60 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
61 |
# The following is defined for using the ICT program. It can be removed |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
62 |
# once the ict_test program is not used. |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
63 |
CPIO_TRANSFER = "0" |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
64 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
65 |
# The following 2 values, ICT_USER_UID and ICT_USER_GID are defined |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
66 |
# in the ICT C APIs. When those are ported to Python, these will |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
67 |
# probably be defined there. |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
68 |
ICT_USER_UID = "101" |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
69 |
ICT_USER_GID = "10" |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
70 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
71 |
INSTALL_FINISH_PROG = "/sbin/install-finish" |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
72 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
73 |
# Initial BE name |
1423
186be1527fbd
Branding: Changing default be name to openindiana in text-install/osol_install/text_install/ti_install.py
Alasdair Lumsden <al@everycity.co.uk>
parents:
1400
diff
changeset
|
74 |
INIT_BE_NAME = "openindiana" |
773
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
75 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
76 |
# definitions for ZFS pool |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
77 |
INSTALL_SNAPSHOT = "install" |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
78 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
79 |
INSTALLED_ROOT_DIR = "/a" |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
80 |
X86_BOOT_ARCHIVE_PATH = "/.cdrom/platform/i86pc/%s/boot_archive" |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
81 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
82 |
# these directories must be defined in this order, otherwise, |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
83 |
# "zfs unmount" fails |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
84 |
ZFS_SHARED_FS = ["/export/home", "/export"] |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
85 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
86 |
# |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
87 |
# Handle for accessing the InstallStatus class |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
88 |
# |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
89 |
INSTALL_STATUS = None |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
90 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
91 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
92 |
class InstallStatus(object): |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
93 |
'''Stores information on the installation progress, and provides a |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
94 |
hook for updating the screen. |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
95 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
96 |
''' |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
97 |
TI = "ti" |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
98 |
TM = "tm" |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
99 |
ICT = "ict" |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
100 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
101 |
def __init__(self, screen, update_status_func, quit_event): |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
102 |
'''screen and update_status_func are values passed in from |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
103 |
the main app |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
104 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
105 |
''' |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
106 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
107 |
# Relative ratio used for computing the overall progress of the |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
108 |
# installation. All numbers must add up to 100% |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
109 |
self.ratio = {InstallStatus.TI:0.05, |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
110 |
InstallStatus.TM:0.93, |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
111 |
InstallStatus.ICT:0.02} |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
112 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
113 |
self.screen = screen |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
114 |
self.update_status_func = update_status_func |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
115 |
self.quit_event = quit_event |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
116 |
self.previous_step_name = None |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
117 |
self.step_percent_completed = 0 |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
118 |
self.previous_overall_progress = 0 |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
119 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
120 |
def update(self, step_name, percent_completed, message): |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
121 |
'''Update the install status. Also checks the quit_event to see |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
122 |
if the installation should be aborted. |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
123 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
124 |
''' |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
125 |
if self.quit_event.is_set(): |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
126 |
logging.debug("User selected to quit") |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
127 |
raise ti_utils.InstallationError |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
128 |
if (self.previous_step_name is None): |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
129 |
self.previous_step_name = step_name |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
130 |
elif (self.previous_step_name != step_name): |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
131 |
self.previous_step_name = step_name |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
132 |
self.step_percent_completed = self.previous_overall_progress |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
133 |
overall_progress = (percent_completed * (self.ratio[step_name])) \ |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
134 |
+ self.step_percent_completed |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
135 |
self.update_status_func(self.screen, overall_progress, message) |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
136 |
self.previous_overall_progress = overall_progress |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
137 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
138 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
139 |
SYSID_FILE = "/etc/.sysIDtool.state" |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
140 |
SYSID_FILE_UMASK = 022 |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
141 |
SYSID_FILE_CONTENT = [["1", "# System previously configured?"], |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
142 |
["1", "# Bootparams succeeded?"], |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
143 |
["1", "# System is on a network?"], |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
144 |
["1", "# Extended network information gathered?"], |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
145 |
["1", "# Autobinder succeeded?"], |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
146 |
["1", "# Network has subnets?"], |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
147 |
["1", "# root password prompted for?"], |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
148 |
["1", "# locale and term prompted for?"], |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
149 |
["1", "# security policy in place"], |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
150 |
["1", "# NFSv4 domain configured"], |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
151 |
# term type must be the last entry |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
152 |
["sun", ""]] |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
153 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
154 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
155 |
def create_sysid_file(): |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
156 |
'''Create the /etc/.sysIDtool.state file''' |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
157 |
try: |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
158 |
with open(SYSID_FILE, "w") as sysid_file: |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
159 |
for entry in SYSID_FILE_CONTENT: |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
160 |
sysid_file.write(entry[0] + "\t" + entry[1] + "\n") |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
161 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
162 |
# set the umask on the file |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
163 |
os.chmod(SYSID_FILE, SYSID_FILE_UMASK) |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
164 |
except IOError, ioe: |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
165 |
logging.error("Unable to write to %s", SYSID_FILE) |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
166 |
logging.exception(ioe) |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
167 |
raise ti_utils.InstallationError |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
168 |
except OSError, ose: |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
169 |
logging.error("Unable to create %s", SYSID_FILE) |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
170 |
logging.exception(ose) |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
171 |
raise ti_utils.InstallationError |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
172 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
173 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
174 |
def transfer_mod_callback(percent, message): |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
175 |
'''Callback for transfer module to indicate percentage complete.''' |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
176 |
logging.debug("tm callback: %s: %s", percent, message) |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
177 |
try: |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
178 |
INSTALL_STATUS.update(InstallStatus.TM, percent, message) |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
179 |
except ti_utils.InstallationError: |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
180 |
# User selected to quit the transfer |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
181 |
tm_abort_transfer() |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
182 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
183 |
def exec_cmd(cmd, description): |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
184 |
''' Execute the given command. |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
185 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
186 |
Args: |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
187 |
cmd: Command to execute. The command and it's arguments |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
188 |
should be provided as a list, suitable for used |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
189 |
with subprocess.Popen(shell=False) |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
190 |
description: Description to use for printing errors. |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
191 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
192 |
Raises: |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
193 |
InstallationError |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
194 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
195 |
''' |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
196 |
logging.debug("Executing: %s", " ".join(cmd)) |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
197 |
if exec_cmd_outputs_to_log(cmd, logging) != 0: |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
198 |
logging.error("Failed to %s", description) |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
199 |
raise ti_utils.InstallationError |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
200 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
201 |
def cleanup_existing_install_target(install_profile, inst_device): |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
202 |
''' If installer was restarted after the failure, it is necessary |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
203 |
to destroy the pool previously created by the installer. |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
204 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
205 |
If there is a root pool manually imported by the user with |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
206 |
the same name which will be used by the installer |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
207 |
for target root pool, we don't want to destroy user's data. |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
208 |
So, we will log warning message and abort the installation. |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
209 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
210 |
''' |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
211 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
212 |
# Umount /var/run/boot_archive, which might be mounted by |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
213 |
# previous x86 installations. |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
214 |
# Error from this command is intentionally ignored, because the |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
215 |
# previous invocation of the transfer module might or might not have |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
216 |
# mounted on the mount point. |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
217 |
if platform.processor() == "i386": |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
218 |
with open("/dev/null", "w") as null_handle: |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
219 |
sp.Popen(["/usr/sbin/umount", "-f", "/var/run/boot_archive"], |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
220 |
stdout=null_handle, stderr=null_handle) |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
221 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
222 |
rootpool_name = install_profile.disk.get_install_root_pool() |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
223 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
224 |
cmd = "/usr/sbin/zpool list " + rootpool_name |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
225 |
logging.debug("Executing: %s", cmd) |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
226 |
status = commands.getstatusoutput(cmd)[0] |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
227 |
if status != 0: |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
228 |
logging.debug("Root pool %s does not exist", rootpool_name) |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
229 |
return # rpool doesn't exist, no need to clean up |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
230 |
|
1400
6c54a8b98066
imported patch oi-branding-cmd-text-install
Alasdair Lumsden <al@everycity.co.uk>
parents:
872
diff
changeset
|
231 |
# Check value of rpool's org.openindiana.caiman:install property |
773
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
232 |
# If it is busy, that means the pool is left over from an aborted install. |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
233 |
# If the property doesn't exist or has another value, we assume |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
234 |
# that the root pool contains valid Solaris instance. |
1400
6c54a8b98066
imported patch oi-branding-cmd-text-install
Alasdair Lumsden <al@everycity.co.uk>
parents:
872
diff
changeset
|
235 |
cmd = "/usr/sbin/zfs get -H -o value org.openindiana.caiman:install " + \ |
773
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
236 |
rootpool_name |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
237 |
logging.debug("Executing: %s", cmd) |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
238 |
(status, pool_status) = commands.getstatusoutput(cmd) |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
239 |
logging.debug("Return code: %s", status) |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
240 |
logging.debug("Pool status: %s", pool_status) |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
241 |
if (status != 0) or (pool_status != "busy"): |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
242 |
logging.error("Root pool %s exists.", rootpool_name) |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
243 |
logging.error("Installation can not proceed") |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
244 |
raise ti_utils.InstallationError |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
245 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
246 |
try: |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
247 |
rpool = tgt.Zpool(rootpool_name, inst_device) |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
248 |
tgt.release_zfs_root_pool(rpool) |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
249 |
logging.debug("Completed release_zfs_root_pool") |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
250 |
except TypeError, te: |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
251 |
logging.error("Failed to release existing rpool.") |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
252 |
logging.exception(te) |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
253 |
raise ti_utils.InstallationError |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
254 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
255 |
# clean up the target mount point |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
256 |
exec_cmd(["/usr/bin/rm", "-rf", INSTALLED_ROOT_DIR + "/*"], |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
257 |
"clean up existing mount point") |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
258 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
259 |
def do_ti(install_profile, swap_dump): |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
260 |
'''Call the ti module to create the disk layout, create a zfs root |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
261 |
pool, create zfs volumes for swap and dump, and to create a be. |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
262 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
263 |
''' |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
264 |
diskname = install_profile.disk.name |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
265 |
logging.debug("Diskname: %s", diskname) |
872
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
863
diff
changeset
|
266 |
mesg = "Preparing disk for %(release)s installation" % RELEASE |
773
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
267 |
try: |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
268 |
(inst_device, inst_device_size) = \ |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
269 |
install_profile.disk.get_install_dev_name_and_size() |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
270 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
271 |
# The installation size we provide already included the required |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
272 |
# swap size |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
273 |
(swap_type, swap_size, dump_type, dump_size) = \ |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
274 |
swap_dump.calc_swap_dump_size(ti_utils.get_minimum_size(swap_dump), |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
275 |
inst_device_size, swap_included=True) |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
276 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
277 |
tgt_disk = install_profile.disk.to_tgt() |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
278 |
tgt.create_disk_target(tgt_disk, False) |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
279 |
logging.debug("Completed create_disk_target") |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
280 |
INSTALL_STATUS.update(InstallStatus.TI, 20, mesg) |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
281 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
282 |
rootpool_name = install_profile.disk.get_install_root_pool() |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
283 |
rpool = tgt.Zpool(rootpool_name, inst_device) |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
284 |
tgt.create_zfs_root_pool(rpool) |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
285 |
logging.debug("Completed create_zfs_root_pool") |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
286 |
INSTALL_STATUS.update(InstallStatus.TI, 40, mesg) |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
287 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
288 |
create_swap = False |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
289 |
if (swap_type == ti_utils.SwapDump.ZVOL): |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
290 |
create_swap = True |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
291 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
292 |
create_dump = False |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
293 |
if (dump_type == ti_utils.SwapDump.ZVOL): |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
294 |
create_dump = True |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
295 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
296 |
logging.debug("Create swap %s Swap size: %s", create_swap, swap_size) |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
297 |
logging.debug("Create dump %s Dump size: %s", create_dump, dump_size) |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
298 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
299 |
tgt.create_zfs_volume(rootpool_name, create_swap, swap_size, |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
300 |
create_dump, dump_size) |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
301 |
logging.debug("Completed create swap and dump") |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
302 |
INSTALL_STATUS.update(InstallStatus.TI, 70, mesg) |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
303 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
304 |
zfs_datasets = () |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
305 |
for ds in reversed(ZFS_SHARED_FS): # must traverse it in reversed order |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
306 |
zd = tgt.ZFSDataset(mountpoint=ds) |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
307 |
zfs_datasets += (zd,) |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
308 |
tgt.create_be_target(rootpool_name, INIT_BE_NAME, INSTALLED_ROOT_DIR, |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
309 |
zfs_datasets) |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
310 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
311 |
logging.debug("Completed create_be_target") |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
312 |
INSTALL_STATUS.update(InstallStatus.TI, 100, mesg) |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
313 |
except TypeError, te: |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
314 |
logging.error("Failed to initialize disk") |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
315 |
logging.exception(te) |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
316 |
raise ti_utils.InstallationError |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
317 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
318 |
def do_transfer(): |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
319 |
'''Call libtransfer to transfer the bits to the system via cpio.''' |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
320 |
# transfer the bits |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
321 |
tm_argslist = [(TM_ATTR_MECHANISM, TM_PERFORM_CPIO), |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
322 |
(TM_CPIO_ACTION, TM_CPIO_ENTIRE), |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
323 |
(TM_CPIO_SRC_MNTPT, "/"), |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
324 |
(TM_CPIO_DST_MNTPT, INSTALLED_ROOT_DIR)] |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
325 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
326 |
# if it is running on x86, need to unpack the root archive from |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
327 |
# the architecture that's not booted from. |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
328 |
if platform.processor() == "i386": |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
329 |
(status, inst_set) = commands.getstatusoutput("/bin/isainfo -k") |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
330 |
if (status != 0): |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
331 |
logging.error("Unable to determine instruction set.") |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
332 |
raise ti_utils.InstallationError |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
333 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
334 |
if (inst_set == "amd64"): |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
335 |
# Running 64 bit kernel, need to unpack 32 bit archive |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
336 |
tm_argslist.extend([(TM_UNPACK_ARCHIVE, |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
337 |
X86_BOOT_ARCHIVE_PATH % "")]) |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
338 |
else: |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
339 |
# Running 32 bit kernel, need to unpack 64 bit archive |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
340 |
tm_argslist.extend([(TM_UNPACK_ARCHIVE, |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
341 |
X86_BOOT_ARCHIVE_PATH % "amd64")]) |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
342 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
343 |
logging.debug("Going to call TM with this list: %s", tm_argslist) |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
344 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
345 |
try: |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
346 |
status = tm_perform_transfer(tm_argslist, |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
347 |
callback=transfer_mod_callback) |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
348 |
except Exception, ex: |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
349 |
logging.exception(ex) |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
350 |
status = 1 |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
351 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
352 |
if status != TM_SUCCESS: |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
353 |
logging.error("Failed to transfer bits to the target") |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
354 |
raise ti_utils.InstallationError |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
355 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
356 |
def do_ti_install(install_profile, screen, update_status_func, quit_event, |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
357 |
time_change_event): |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
358 |
'''Installation engine for text installer. |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
359 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
360 |
Raises InstallationError for any error occurred during install. |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
361 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
362 |
''' |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
363 |
# |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
364 |
# The following information is needed for installation. |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
365 |
# Make sure they are provided before even starting |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
366 |
# |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
367 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
368 |
# locale |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
369 |
locale = install_profile.system.locale |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
370 |
logging.debug("default locale: %s", locale) |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
371 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
372 |
# timezone |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
373 |
timezone = install_profile.system.tz_timezone |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
374 |
logging.debug("time zone: %s", timezone) |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
375 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
376 |
# hostname |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
377 |
hostname = install_profile.system.hostname |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
378 |
logging.debug("hostname: %s", hostname) |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
379 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
380 |
ulogin = None |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
381 |
user_home_dir = "" |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
382 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
383 |
root_user = install_profile.users[0] |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
384 |
root_pass = root_user.password |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
385 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
386 |
reg_user = install_profile.users[1] |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
387 |
ureal_name = reg_user.real_name |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
388 |
ulogin = reg_user.login_name |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
389 |
upass = reg_user.password |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
390 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
391 |
logging.debug("Root password: %s", root_pass) |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
392 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
393 |
if ulogin: |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
394 |
user_home_dir = "/export/home/" + ulogin |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
395 |
ZFS_SHARED_FS.insert(0, user_home_dir) |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
396 |
logging.debug("User real name: %s", ureal_name) |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
397 |
logging.debug("User login: %s", ulogin) |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
398 |
logging.debug("User password: %s", upass) |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
399 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
400 |
(inst_device, inst_device_size) = \ |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
401 |
install_profile.disk.get_install_dev_name_and_size() |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
402 |
logging.debug("Installation Device Name: %s", inst_device) |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
403 |
logging.debug("Installation Device Size: %sMB", inst_device_size) |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
404 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
405 |
swap_dump = ti_utils.SwapDump() |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
406 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
407 |
min_inst_size = ti_utils.get_minimum_size(swap_dump) |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
408 |
logging.debug("Minimum required size: %sMB", min_inst_size) |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
409 |
if (inst_device_size < min_inst_size): |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
410 |
logging.error("Size of device specified for installation " |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
411 |
"is too small") |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
412 |
logging.error("Size of install device: %sMB", inst_device_size) |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
413 |
logging.error("Minimum required size: %sMB", min_inst_size) |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
414 |
raise ti_utils.InstallationError |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
415 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
416 |
recommended_size = ti_utils.get_recommended_size(swap_dump) |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
417 |
logging.debug("Recommended size: %sMB", recommended_size) |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
418 |
if (inst_device_size < recommended_size): |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
419 |
# Warn users that their install target size is not optimal |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
420 |
# Just log the warning, but continue with the installation. |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
421 |
logging.warning("Size of device specified for installation is " |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
422 |
"not optimal") |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
423 |
logging.warning("Size of install device: %sMB", inst_device_size) |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
424 |
logging.warning("Recommended size: %sMB", recommended_size) |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
425 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
426 |
# Validate the value specified for timezone |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
427 |
if not tz_isvalid(timezone): |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
428 |
logging.error("Timezone value specified (%s) is not valid", timezone) |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
429 |
raise ti_utils.InstallationError |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
430 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
431 |
# Compute the time to set here. It will be set after the rtc |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
432 |
# command is run, if on x86. |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
433 |
install_time = datetime.datetime.now() + install_profile.system.time_offset |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
434 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
435 |
if platform.processor() == "i386": |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
436 |
# |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
437 |
# At this time, the /usr/sbin/rtc command does not work in alternate |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
438 |
# root. It hard codes to use /etc/rtc_config. |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
439 |
# Therefore, we set the value for rtc_config in the live environment |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
440 |
# so it will get copied over to the alternate root. |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
441 |
# |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
442 |
exec_cmd([RTC_CMD, "-z", timezone], "set timezone") |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
443 |
exec_cmd([RTC_CMD, "-c"], "set timezone") |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
444 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
445 |
# |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
446 |
# Set the system time to the time specified by the user |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
447 |
# The value to set the time to is computed before the "rtc" commands. |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
448 |
# This is required because rtc will mess up the computation of the |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
449 |
# time to set. The rtc command must be run before the command |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
450 |
# to set time. Otherwise, the time that we set will be overwritten |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
451 |
# after running /usr/sbin/rtc. |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
452 |
# |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
453 |
cmd = ["/usr/bin/date", install_time.strftime("%m%d%H%M%y")] |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
454 |
exec_cmd(cmd, "set system time") |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
455 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
456 |
time_change_event.set() |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
457 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
458 |
global INSTALL_STATUS |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
459 |
INSTALL_STATUS = InstallStatus(screen, update_status_func, quit_event) |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
460 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
461 |
rootpool_name = install_profile.disk.get_install_root_pool() |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
462 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
463 |
cleanup_existing_install_target(install_profile, inst_device) |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
464 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
465 |
do_ti(install_profile, swap_dump) |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
466 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
467 |
do_transfer() |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
468 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
469 |
ict_mesg = "Completing transfer process" |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
470 |
INSTALL_STATUS.update(InstallStatus.ICT, 0, ict_mesg) |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
471 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
472 |
# Save the timezone in the installed root's /etc/default/init file |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
473 |
ti_utils.save_timezone_in_init(INSTALLED_ROOT_DIR, timezone) |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
474 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
475 |
# If swap was created, add appropriate entry to <target>/etc/vfstab |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
476 |
swap_device = swap_dump.get_swap_device(rootpool_name) |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
477 |
logging.debug("Swap device: %s", swap_device) |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
478 |
ti_utils.setup_etc_vfstab_for_swap(swap_device, INSTALLED_ROOT_DIR) |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
479 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
480 |
# |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
481 |
# The /etc/.sysIDtool.state file needs to be written before calling |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
482 |
# the ICTs, because it gets copied over by the ICTs into the installed |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
483 |
# system. |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
484 |
# |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
485 |
create_sysid_file() |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
486 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
487 |
try: |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
488 |
run_ICTs(install_profile, hostname, ict_mesg, inst_device, |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
489 |
locale, root_pass, ulogin, upass, ureal_name, |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
490 |
rootpool_name) |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
491 |
finally: |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
492 |
post_install_cleanup(install_profile, rootpool_name) |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
493 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
494 |
INSTALL_STATUS.update(InstallStatus.ICT, 100, ict_mesg) |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
495 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
496 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
497 |
def post_install_cleanup(install_profile, rootpool_name): |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
498 |
'''Do final cleanup to prep system for first boot, such as resetting |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
499 |
the ZFS dataset mountpoints |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
500 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
501 |
''' |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
502 |
# reset_zfs_mount_property |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
503 |
# Setup mountpoint property back to "/" from "/a" for |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
504 |
# /, /opt, /export, /export/home |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
505 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
506 |
# make sure we are not in the alternate root. |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
507 |
# Otherwise, be_unmount() fails |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
508 |
os.chdir("/root") |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
509 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
510 |
# since be_unmount() can not currently handle shared filesystems, |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
511 |
# it's necesary to manually set their mountpoint to the appropriate value |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
512 |
for fs in ZFS_SHARED_FS: |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
513 |
exec_cmd(["/usr/sbin/zfs", "unmount", rootpool_name + fs], |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
514 |
"unmount " + rootpool_name + fs) |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
515 |
exec_cmd(["/usr/sbin/zfs", "set", "mountpoint=" + fs, |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
516 |
rootpool_name + fs], "change mount point for " + |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
517 |
rootpool_name + fs) |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
518 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
519 |
# Transfer the log file |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
520 |
final_log_loc = INSTALLED_ROOT_DIR + install_profile.log_final |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
521 |
logging.debug("Copying %s to %s", install_profile.log_location, |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
522 |
final_log_loc) |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
523 |
try: |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
524 |
shutil.copyfile(install_profile.log_location, final_log_loc) |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
525 |
except (IOError, OSError), err: |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
526 |
logging.error("Failed to copy %s to %s", install_profile.log_location, |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
527 |
install_profile.log_final) |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
528 |
logging.exception(err) |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
529 |
raise ti_utils.InstallationError |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
530 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
531 |
# 0 for the 2nd argument because force-umount need to be 0 |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
532 |
if beUnmount(INIT_BE_NAME, 0) != 0: |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
533 |
logging.error("beUnmount failed for %s", INIT_BE_NAME) |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
534 |
raise ti_utils.InstallationError |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
535 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
536 |
# pylint: disable-msg=C0103 |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
537 |
def run_ICTs(install_profile, hostname, ict_mesg, inst_device, locale, |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
538 |
root_pass, ulogin, upass, ureal_name, rootpool_name): |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
539 |
'''Run all necessary ICTs. This function ensures that each ICT is run, |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
540 |
regardless of the success/failure of any others. After running all ICTs |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
541 |
(including those supplied by install-finish), if any of them failed, |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
542 |
an InstallationError is raised. |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
543 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
544 |
''' |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
545 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
546 |
failed_icts = 0 |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
547 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
548 |
# |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
549 |
# set the language locale |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
550 |
# |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
551 |
if (locale != ""): |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
552 |
try: |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
553 |
exec_cmd([ICT_PROG, "ict_set_lang_locale", INSTALLED_ROOT_DIR, |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
554 |
locale, CPIO_TRANSFER], |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
555 |
"execute ict_set_lang_locale() ICT") |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
556 |
except ti_utils.InstallationError: |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
557 |
failed_icts += 1 |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
558 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
559 |
# |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
560 |
# create user directory if needed |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
561 |
# |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
562 |
try: |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
563 |
exec_cmd([ICT_PROG, "ict_configure_user_directory", INSTALLED_ROOT_DIR, |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
564 |
ulogin], "execute ict_configure_user_directory() ICT") |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
565 |
except ti_utils.InstallationError: |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
566 |
failed_icts += 1 |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
567 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
568 |
# |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
569 |
# set host name |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
570 |
# |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
571 |
try: |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
572 |
exec_cmd([ICT_PROG, "ict_set_host_node_name", |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
573 |
INSTALLED_ROOT_DIR, hostname], |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
574 |
"execute ict_set_host_node_name() ICT") |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
575 |
except ti_utils.InstallationError: |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
576 |
failed_icts += 1 |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
577 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
578 |
try: |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
579 |
exec_cmd([ICT_PROG, "ict_set_user_profile", INSTALLED_ROOT_DIR, |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
580 |
ulogin], "execute ict_set_user_profile() ICT") |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
581 |
except ti_utils.InstallationError: |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
582 |
failed_icts += 1 |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
583 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
584 |
# Setup bootfs property so that newly created Solaris instance is booted |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
585 |
# appropriately |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
586 |
initial_be = rootpool_name + "/ROOT/" + INIT_BE_NAME |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
587 |
try: |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
588 |
exec_cmd(["/usr/sbin/zpool", "set", "bootfs=" + initial_be, |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
589 |
rootpool_name], "activate BE") |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
590 |
except ti_utils.InstallationError: |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
591 |
failed_icts += 1 |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
592 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
593 |
is_logical = "0" |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
594 |
part_info = install_profile.disk.get_solaris_data() |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
595 |
if isinstance(part_info, PartitionInfo) and part_info.is_logical(): |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
596 |
is_logical = "1" |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
597 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
598 |
try: |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
599 |
exec_cmd([ICT_PROG, "ict_installboot", INSTALLED_ROOT_DIR, inst_device, |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
600 |
is_logical], "execute ict_installboot() ICT") |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
601 |
except ti_utils.InstallationError: |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
602 |
failed_icts += 1 |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
603 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
604 |
INSTALL_STATUS.update(InstallStatus.ICT, 50, ict_mesg) |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
605 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
606 |
# Run the install-finish script |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
607 |
cmd = [INSTALL_FINISH_PROG, "-B", INSTALLED_ROOT_DIR, "-R", root_pass, |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
608 |
"-n", ureal_name, "-l", ulogin, "-p", upass, "-G", ICT_USER_GID, |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
609 |
"-U", ICT_USER_UID] |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
610 |
if (install_profile.nic.type == NetworkInfo.NONE): |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
611 |
cmd.append("-N") |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
612 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
613 |
try: |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
614 |
exec_cmd(cmd, "execute INSTALL_FINISH_PROG") |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
615 |
except ti_utils.InstallationError: |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
616 |
failed_icts += 1 |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
617 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
618 |
# Take a snapshot of the installation |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
619 |
try: |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
620 |
exec_cmd([ICT_PROG, "ict_snapshot", INIT_BE_NAME, INSTALL_SNAPSHOT], |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
621 |
"execute ict_snapshot() ICT") |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
622 |
except ti_utils.InstallationError: |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
623 |
failed_icts += 1 |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
624 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
625 |
# Mark ZFS root pool "ready" - it was successfully populated and contains |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
626 |
# valid Solaris instance |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
627 |
try: |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
628 |
exec_cmd([ICT_PROG, "ict_mark_root_pool_ready", rootpool_name], |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
629 |
"execute ict_mark_root_pool_ready() ICT") |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
630 |
except ti_utils.InstallationError: |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
631 |
failed_icts += 1 |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
632 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
633 |
if failed_icts != 0: |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
634 |
logging.error("One or more ICTs failed. See previous log messages") |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
635 |
raise ti_utils.InstallationError |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
636 |
else: |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
637 |
logging.info("All ICTs completed successfully") |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
638 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
639 |
def perform_ti_install(install_profile, screen, update_status_func, quit_event, |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
640 |
time_change_event): |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
641 |
'''Wrapper to call the do_ti_install() function. |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
642 |
Sets the variable indicating whether the installation is successful or |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
643 |
not. |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
644 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
645 |
''' |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
646 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
647 |
try: |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
648 |
do_ti_install(install_profile, screen, update_status_func, quit_event, |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
649 |
time_change_event) |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
650 |
install_profile.install_succeeded = True |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
651 |
except ti_utils.InstallationError: |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
652 |
install_profile.install_succeeded = False |