summaryrefslogtreecommitdiff
path: root/install
diff options
context:
space:
mode:
authorIgor Pashev <pashev.igor@gmail.com>2013-04-21 21:10:23 +0000
committerIgor Pashev <pashev.igor@gmail.com>2013-04-21 21:10:23 +0000
commit4e939a3ab4cbc413e8a58123903359fab4d33cd0 (patch)
treed83748748f5df74dfa7a9f3865cba2fcf3a263db /install
parent2b17f4f7c892df67d5bfe4cce1dd96ef743abfdd (diff)
downloadlive-4e939a3ab4cbc413e8a58123903359fab4d33cd0.tar.gz
Try harder to install GRUB
Diffstat (limited to 'install')
-rwxr-xr-xinstall41
1 files changed, 38 insertions, 3 deletions
diff --git a/install b/install
index a1d8bb4..461dc50 100755
--- a/install
+++ b/install
@@ -183,6 +183,24 @@ Whould you like to continue?''',
if not welcome:
raise Abort('Installation canceled')
+def get_zpool_slice(pool_name):
+ result = []
+ ''' Returns slices/disks (e. g. c0t4d0s0) on which zpool exists '''
+ zpool_cmd = Popen(['zpool', 'status', pool_name], stderr=PIPE, stdout=PIPE)
+
+ # Skip till the header:
+ re_header = re.compile(r'NAME\s+STATE\s+READ\s+WRITE\s+CKSUM')
+ for line in zpool_cmd.stdout:
+ if re_header.search(line):
+ break
+
+ re_disk = re.compile(r'(\w+)\s+ONLINE(\s+\d+){3}')
+ for line in zpool_cmd.stdout:
+ m = re_disk.search(line)
+ if m and not m.group(1) in [pool_name, 'mirror']:
+ result.append(m.group(1))
+ return result
+
def find_zpools():
global zpools
progress = ProgressMessage(screen, title='Please wait', text='Searching for ZFS pools ...')
@@ -622,7 +640,7 @@ def debootstrap():
os.execl('/usr/sbin/debootstrap', 'debootstrap',
'--debian-installer', '--no-check-gpg',
'--exclude=gawk,aptitude,aptitude-common,libboost-iostreams1.48.0,libboost-iostreams1.49.0,libcwidget3',
- '--include=installgrub,illumos-grub,illumos-kernel,locales',
+ '--include=installgrub,illumos-grub,illumos-kernel,locales,bash-completion,vim',
codename, rootdir, mirror)
except EnvironmentError as e:
sys.exit(e.errno)
@@ -810,6 +828,7 @@ def configure_bootenv():
create_bootarchive()
def configure_grub():
+ global rslice
entry = grub_entry.format(rpool=rpool, bootenv=bootenv)
# write grub menu for references:
try:
@@ -823,14 +842,30 @@ def configure_grub():
except:
pass
+ # Zpool was not created during installation, trying
+ # to guess slice name:
+ if not rslice:
+ slices = get_zpool_slice(rpool)
+ if len(slices) == 1 and re.match(r'^\w+s\d+$', slices[0]):
+ rslice = slices[0]
+
items = []
text = ''
- if solaris_partition != None: # New installation:
+ if rslice:
items.append(('Install GRUB to MBR', 'mbr'))
text += 'Installing GRUB on the master boot sector (MBR) '
text += 'overrides any boot manager currently installed: '
text += 'the system will always boot the GRUB in the solaris partition'
- if not solaris_partition.logical:
+ if solaris_partition:
+ allow_non_mbr = not solaris_partition.logical
+ else:
+ # XXX trying to guess
+ installgrub_cmd = ['/usr/sbin/installgrub', '-n',
+ '/boot/grub/stage1', '/boot/grub/stage2',
+ '/dev/rdsk/' + rslice]
+ rc, out, err = in_bootenv(installgrub_cmd)
+ allow_non_mbr = out.find('stage1 written to master boot sector') == -1
+ if allow_non_mbr:
items.append(('Install GRUB to a partition only', 'partition'))
else:
text += 'It looks like root ZFS pool "{rpool}" was not created during this installation, '.format(rpool=rpool)