summaryrefslogtreecommitdiff
path: root/install
diff options
context:
space:
mode:
authorIgor Pashev <pashev.igor@gmail.com>2013-09-14 22:53:45 +0400
committerIgor Pashev <pashev.igor@gmail.com>2013-09-14 22:53:45 +0400
commitfa1fd858cab0a59d0191dd090a0d25bd3407d9c6 (patch)
tree1eafb69322f7f37e2b34ee1357caf52fbfdc5371 /install
parentd185d3e9cf50711e2f39b9b7acd1eb82ce443f02 (diff)
downloadlive-fa1fd858cab0a59d0191dd090a0d25bd3407d9c6.tar.gz
Install extra packages with apt-get
Diffstat (limited to 'install')
-rwxr-xr-xinstall60
1 files changed, 49 insertions, 11 deletions
diff --git a/install b/install
index f02362b..5c79d82 100755
--- a/install
+++ b/install
@@ -26,6 +26,7 @@ import sys
import math
import shutil
import traceback
+import apt
# Snack screen
screen = None
@@ -78,6 +79,7 @@ mirrors = [
('http://mirror-ru.osdyson.org/apt/', 'Russia'),
]
+apt_cache = None # APT cache, used to check if package exists, updated after 'apt-get update'
profile = None
profiles = [
{
@@ -95,8 +97,8 @@ profiles = [
'name': 'Desktop',
'desc' : 'Install X, XFCE and some graphical applications',
'packages' : '''mc locales bash-completion vim-gtk synaptic abiword dillo gnumeric
- sylpheed geany lightdm pidgin evince sudo
- xorg xfce4 xfce4-terminal dbus curl wget''',
+ sylpheed geany lightdm pidgin evince sudo gimp midori stardict mirage
+ xorg xfce4 xfce4-terminal dbus curl wget transmission-gtk xarchiver''',
},
]
@@ -773,6 +775,7 @@ def install_minimal():
def apt_get_update(log):
+ global apt_cache
progress = ProgressBar(screen, title='Updating APT cache', text='Please wait ...')
read, write = os.pipe()
pid = os.fork()
@@ -802,11 +805,20 @@ def apt_get_update(log):
progress.text = text
status = os.wait()[1]
+ if 0 == status:
+ progress.text = "Reading files ..."
+ apt_cache = apt.Cache(rootdir=rootdir)
return os.WEXITSTATUS(status)
-
-def apt_get_install(log, packages):
+def apt_get_install(log):
+ global profile
+ global profiles
progress = ProgressBar(screen, title='Installing packages', text='Please wait ...')
+ packages = [pkg for pkg in profiles[profile]["packages"] if pkg in apt_cache]
+ missed = [pkg for pkg in profiles[profile]["packages"] if not pkg in apt_cache]
+ for p in missed:
+ os.write(log, "WARNING: missing package `{}'".format(p))
+
read, write = os.pipe()
pid = os.fork()
if pid == 0:
@@ -849,11 +861,37 @@ def apt_get_install(log, packages):
def install_profile():
- logfile = rootdir + '/root/apt-get.log'
- log = os.open(logfile, os.O_WRONLY + os.O_CREAT)
- code = apt_get_update(log)
- code = apt_get_install(log, ['abiword', 'sylpheed'])
- os.close(log)
+ global profile
+ while True:
+ if not profile:
+ return
+ logfile = rootdir + '/root/dyson-install.log'
+ log = os.open(logfile, os.O_WRONLY + os.O_CREAT)
+ rc = apt_get_update(log)
+ if 0 == rc:
+ rc = apt_get_install(log)
+ os.close(log)
+ if 0 == rc:
+ return
+
+ while True:
+ choice = ButtonChoiceWindow(screen, title='Installation failed',
+ text='Something went wrong. This is not fatal, because minimal system'
+ ' is installed. You can search log for failures, fix them'
+ ' (if it was, for example, a network failure) and try again.'
+ ' Or give up and stay with minimal system.',
+ buttons=[('View log', 'log'), ('Try again', 'again'), ('Give up', 'skip')],
+ width=50)
+ if choice == 'log':
+ screen.suspend()
+ call(['less', logfile])
+ screen.resume()
+ continue
+ if choice == 'again':
+ break
+ if choice == 'skip':
+ profile = None
+ break
def umount_in_bootenv():
@@ -1041,7 +1079,7 @@ def configure_bootenv():
write_vfstab()
mount_in_bootenv()
- if profile != 0:
+ if profile:
install_profile()
in_bootenv(['/usr/sbin/devfsadm'])
@@ -1056,7 +1094,7 @@ def configure_bootenv():
except:
pass
- if profile != 0:
+ if profile:
create_user()
configure_packages()