summaryrefslogtreecommitdiff
path: root/install
diff options
context:
space:
mode:
Diffstat (limited to 'install')
-rwxr-xr-xinstall85
1 files changed, 54 insertions, 31 deletions
diff --git a/install b/install
index 9271702..98035b6 100755
--- a/install
+++ b/install
@@ -546,34 +546,34 @@ def debootstrap():
read, write = os.pipe()
+ os.makedirs(rootdir + '/root')
+ log = os.open(rootdir + '/root/debootstrap.log', os.O_WRONLY + os.O_CREAT)
+
pid = os.fork()
if pid == 0:
os.close(read)
os.dup2(write, 3)
- stdo = os.open('/root/stdout', os.O_WRONLY + os.O_CREAT)
- stde = os.open('/root/stderr', os.O_WRONLY + os.O_CREAT)
- os.dup2(stdo, 1)
- os.dup2(stde, 2)
- os.close(stdo)
- os.close(stde)
+ os.dup2(log, 1)
+ os.dup2(log, 2)
+ os.close(log)
os.close(write)
try:
os.execl('/usr/sbin/debootstrap', 'debootstrap',
- '--exclude=locales,gawk,aptitude,aptitude-common,libboost-iostreams1.48.0,libboost-iostreams1.49.0,libcwidget3',
+ '--exclude=gawk,aptitude,aptitude-common,libboost-iostreams1.48.0,libboost-iostreams1.49.0,libcwidget3',
'--debian-installer', '--no-check-gpg',
- '--include=illumos-grub,illumos-kernel',
+ '--include=illumos-grub,illumos-kernel,locales',
codename, rootdir, mirror)
except OSError as e:
sys.exit(e.errno)
else:
os.close(write)
di = os.fdopen(read, 'r', 1)
- log = open('/root/di.log', 'w')
info_re = re.compile(' +')
m = 'START'
IA = [] # Arguments for IF, cleaned after each IF
PA = [] # Arguments for PF, cleaned after each PF
EA = [] # Arguments for EF, cleaned after each EF
+ WA = [] # Arguments for WF, cleaned after each WF
while True:
line = di.readline()
if not line:
@@ -584,7 +584,7 @@ def debootstrap():
continue
cmd = line[:colon]
info = line[colon+1:].strip()
-
+ text = None
if cmd == 'P': # "P: 23 454 XYZ" or "P: 123 3445"
p = info_re.split(info)
if len(p) == 3:
@@ -596,16 +596,24 @@ def debootstrap():
PA.append(info)
elif cmd == 'EA':
EA.append(info)
+ elif cmd == 'WA':
+ WA.append(info)
elif cmd == 'IF':
- progress.text = (info % tuple(IA))
+ text = (info % tuple(IA))
IA = []
elif cmd == 'PF':
- progress.text = (info % tuple(PA))
+ text = (info % tuple(PA))
PA = []
elif cmd == 'EF':
- progress.text = (info % tuple(EA))
+ text = (info % tuple(EA))
EA = []
- sleep(1)
+ elif cmd == 'WF':
+ text = (info % tuple(WA))
+ WA = []
+ if text:
+ progress.text = text
+ os.write(log, text)
+ os.write(log, '\n')
except:
pass
status = os.wait()[1]
@@ -617,13 +625,21 @@ def install():
code = debootstrap()
if code == 0:
return
- choice = ButtonChoiceWindow(screen, title='Installation failed',
- text='Debootstrap failed.',
- buttons=[('Try again', 'again'), ('Cancel', 'cancel')],
- width=40)
- if choice == 'cancel':
- raise Abort('debootstrap failed')
- p = ProgressMessage(screen, title='Please, wait...', text='Undoing previous try...')
+ while True:
+ choice = ButtonChoiceWindow(screen, title='Installation failed',
+ text='Debootstrap failed.',
+ buttons=[('View log', 'log'), ('Try again', 'again'), ('Cancel', 'cancel')],
+ width=40)
+ if choice == 'log':
+ screen.suspend()
+ call(['less', rootdir + '/root/debootstrap.log'])
+ screen.resume()
+ continue
+ if choice == 'again':
+ break
+ if choice == 'cancel':
+ raise Abort('debootstrap failed')
+ p = ProgressMessage(screen, title='Please, wait', text='Undoing previous try ...')
umount_in_bootenv()
call(['zfs', 'rollback', '-r', bootenv + '@empty'])
@@ -654,6 +670,7 @@ def destroy_bootenv():
umount_in_bootenv()
progress = ProgressMessage(screen, title='Destroying boot environment',
text='Destroying "{}", please wait...'.format(bootenv))
+ call(['zfs', 'unmount', bootenv], stdout=PIPE, stderr=PIPE)
call(['zfs', 'destroy', '-r', bootenv], stdout=PIPE, stderr=PIPE)
bootenv = None
try:
@@ -692,7 +709,7 @@ def isValidNodename(hostname):
return all(allowed.match(x) for x in hostname)
def configure_nodename():
- nodename = 'sphere'
+ nodename = 'frontier'
while True:
choice, entry = EntryWindow(screen, title='Set hostname',
text='Please enter the hostname for this system',
@@ -714,21 +731,28 @@ def configure_nodename():
def configure_network():
configure_nodename()
-def configure_bootenv():
- progress = ProgressMessage(screen, title='Configuring Dyson boot environment', width=50)
+def configure_packages():
+ screen.suspend()
+ call(['chroot', rootdir, '/usr/sbin/dpkg-reconfigure', 'tzdata', 'locales'], stderr=PIPE)
+ screen.resume()
- write_vfstab()
+def create_bootarchive():
+ progress = ProgressMessage(screen, title='Please, wait')
+ progress.text = 'Creating boot archive, please wait ...'
+ in_bootenv(['/sbin/bootadm', 'update-archive'])
- progress.text = 'Preparing chroot ...'
+def mount_in_bootenv():
call(['mount', '-F' , 'lofs', '/devices', rootdir + '/devices'], stdout=PIPE, stderr=PIPE)
call(['mount', '-F' , 'fd', '-', rootdir + '/dev/fd'], stdout=PIPE, stderr=PIPE)
call(['mount', '-F' , 'proc', '-', rootdir + '/proc'], stdout=PIPE, stderr=PIPE)
- progress.text = 'Updating devices ...'
+def configure_bootenv():
+ write_vfstab()
+ mount_in_bootenv()
in_bootenv(['/sbin/devfsadm'])
-
- progress.text = 'Creating boot archive, please wait ...'
- in_bootenv(['/sbin/bootadm', 'update-archive'])
+ configure_packages()
+ configure_network()
+ create_bootarchive()
def cleanup():
@@ -764,7 +788,6 @@ try:
configure_zfs()
install()
configure_bootenv()
- configure_network()
cleanup()
goodbye()