From 484d96bb1e32097689adda0e8162b9c435d1115a Mon Sep 17 00:00:00 2001 From: Igor Pashev Date: Wed, 4 Sep 2013 00:33:03 +0400 Subject: Install profiles --- install | 52 ++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 40 insertions(+), 12 deletions(-) (limited to 'install') diff --git a/install b/install index 115cc3c..6dafdc6 100755 --- a/install +++ b/install @@ -26,6 +26,8 @@ import sys import math import shutil import traceback +import apt +import apt_pkg # Snack screen screen = None @@ -88,13 +90,14 @@ profiles = [ { 'name': 'Basic', 'desc' : 'Basic system without X', - 'packages' : 'locales vim bash-completion mc sudo lynx mutt wget curl openssh-server illumos-grub illumos-kernel', + 'packages' : '''locales vim bash-completion mc sudo lynx mutt wget curl openssh-server''', }, { 'name': 'Desktop', 'desc' : 'Install X, XFCE and some graphical applications', - 'packages' : 'mc illumos-grub illumos-kernel locales bash-completion vim-gtk xfce4 synaptic abiword dillo gnumeric' - 'sylpheed geany lightdm pidgin evince sudo', + 'packages' : '''mc locales bash-completion vim-gtk synaptic abiword dillo gnumeric + sylpheed geany lightdm pidgin evince sudo + xorg xfce4 xfce4-terminal dbus curl wget''', }, ] @@ -769,10 +772,27 @@ def install_minimal(): umount_in_bootenv() # debootstrap mounts required FS for us call(['zfs', 'rollback', '-r', bootenv + '@empty']) -def install(): - choose_profile() - install_minimal() - install_profile() +def install_profile(): + logfile = rootdir + '/root/apt-get.log' + apt_pkg.config.set('Dpkg::Chroot-Directory', rootdir) + cache = apt.Cache(rootdir=rootdir) + + update_progress = DownloadProgress(screen, title='Please wait', text='Updating APT cache ...') + cache.update(update_progress) + + open_progress = OpenProgress(screen, title='Please wait', text='Reading package list ...') + cache.open(open_progress) + + download_progress = DownloadProgress(screen, title='Downloading packages', text='Please wait ...') + install_progress = InstallProgress(screen, + title='Installing packages', text='Please wait ...', + logfile=logfile) + + for p in profiles[profile]['packages'].split(): + cache[p].mark_install() + + cache.commit(download_progress, install_progress) + def umount_in_bootenv(): '''unmount all FS mounted in BE on final cleanup. @@ -958,19 +978,26 @@ def create_user(): def configure_bootenv(): write_vfstab() mount_in_bootenv() + + if profile != 0: + install_profile() + in_bootenv(['/usr/sbin/devfsadm']) open(rootdir + '/reconfigure', 'w').close() - configure_packages() - configure_nodename() + configure_nodename() + set_root_password() # quick and dirty: if network is configured on livecd, copy config into boot env try: shutil.copy2('/etc/ipadm/ipadm.conf', rootdir+'/etc/ipadm/ipadm.conf') except: pass - set_root_password() - create_user() + + if profile != 0: + create_user() + configure_packages() + create_bootarchive() configure_smf() @@ -1128,7 +1155,8 @@ while True: find_hdds() configure_rpool() configure_zfs() - install() + choose_profile() + install_minimal() configure_bootenv() configure_grub() goodbye() -- cgit v1.2.3