summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Pashev <pashev.igor@gmail.com>2013-04-09 20:19:00 +0000
committerIgor Pashev <pashev.igor@gmail.com>2013-04-09 20:19:00 +0000
commitadd8a12071206b344f8a19b42bdac37007599d30 (patch)
tree048ec7f856f07cbeeede80f1a1971d4300edb957
parent62180244337da57d876229379913d0c670c8f204 (diff)
downloadlive-add8a12071206b344f8a19b42bdac37007599d30.tar.gz
Improve creating of fs
-rwxr-xr-xinstall116
-rw-r--r--lib/snack/__init__.py4
2 files changed, 68 insertions, 52 deletions
diff --git a/install b/install
index 48d1ae3..a7ccb5c 100755
--- a/install
+++ b/install
@@ -45,6 +45,43 @@ mirrors = [
('http://mirror-us.osdyson.org/apt/', 'USA'),
]
+
+# FS to be created in boot environment.
+# Order is important.
+befs = [
+ {'name':'/usr', 'options':{}},
+ {'name':'/usr/local', 'options':{
+ 'compression':'on',
+ }},
+ {'name':'/usr/src', 'options':{
+ 'compression':'on',
+ }},
+ {'name':'/var', 'options':{}},
+ {'name':'/var/cache', 'options':{}},
+ {'name':'/var/lib', 'options':{}},
+ {'name':'/var/lib/dpkg', 'options':{
+ 'compression' : 'on',
+ 'setuid' : 'off',
+ 'devices' : 'off',
+ }},
+ {'name':'/var/log', 'options':{
+ 'compression' : 'on',
+ 'setuid' : 'off',
+ 'devices' : 'off',
+ }},
+ {'name':'/var/mail', 'options':{
+ 'compression' : 'on',
+ 'setuid' : 'off',
+ 'devices' : 'off',
+ }},
+ {'name':'/var/spool', 'options':{
+ 'compression' : 'on',
+ 'setuid' : 'off',
+ 'devices' : 'off',
+ }},
+ {'name':'/var/tmp', 'options':{}},
+ ]
+
class Abort(Exception):
''' User clicked "Cancel" '''
pass
@@ -218,12 +255,29 @@ def zfs_create(fs, zvol=None, options={}):
def configure_zfs():
global bootenv
- progress = ProgressBar(screen, title='Creating ZFS filesystems')
+ progress = ProgressBar(screen,
+ title='Creating ZFS filesystems',
+ top = 4 + len(befs), # 4 for ROOT, /swap, /home, and BE
+ width = 70,
+ )
root = rpool + '/ROOT'
if not zfs_exists(root):
progress.text = 'Creating ' + root
zfs_create(root, options={'canmount':'off'})
- progress.progress = 10
+ progress.advance()
+
+ swap = rpool + '/swap'
+ if not zfs_exists(swap):
+ progress.text = 'Creating ' + swap
+ zfs_create(swap, zvol='2G')
+ progress.advance()
+
+ home = rpool + '/home'
+ if not zfs_exists(home):
+ progress.text = 'Creating ' + home
+ zfs_create(home, options={'mountpoint':'/home', 'compression':'on',
+ 'devices':'off', 'setuid':'off'})
+ progress.advance()
# Make sure we are creating new boot environment
bootenv = None
@@ -233,58 +287,16 @@ def configure_zfs():
break
else:
bootenv = None
- progress.progress = 20
progress.text = 'Creating ' + bootenv
zfs_create(bootenv, options={'canmount':'noauto'})
- progress.progress = 30
-
- fs = bootenv + '/usr'
- progress.text = 'Creating ' + fs
- zfs_create(fs)
- progress.progress = 50
-
- fs = bootenv + '/usr/local'
- progress.text = 'Creating ' + fs
- zfs_create(fs, options={'compression':'on'})
- progress.progress = 55
-
- fs = bootenv + '/usr/src'
- progress.text = 'Creating ' + fs
- zfs_create(fs, options={'compression':'on'})
- progress.progress = 60
-
- fs = bootenv + '/var'
- progress.text = 'Creating ' + fs
- zfs_create(fs)
- progress.progress = 65
-
- fs = bootenv + '/var/log'
- progress.text = 'Creating ' + fs
- zfs_create(fs)
- progress.progress = 70
-
- fs = bootenv + '/var/lib'
- progress.text = 'Creating ' + fs
- zfs_create(fs)
- progress.progress = 75
-
- fs = bootenv + '/var/cache'
- progress.text = 'Creating ' + fs
- zfs_create(fs)
- progress.progress = 80
-
- fs = bootenv + '/var/tmp'
- progress.text = 'Creating ' + fs
- zfs_create(fs)
- progress.progress = 90
-
- home = root + '/home'
- if not zfs_exists(home):
- progress.text = 'Creating ' + home
- zfs_create(home, options={'mountpoint':'/home', 'compression':'on',
- 'devices':'off', 'setuid':'off'})
- progress.progress = 100
+ progress.advance()
+
+ for fs in befs:
+ p = bootenv + fs['name']
+ progress.text = 'Creating ' + p
+ zfs_create(p, options=fs['options'])
+ progress.advance()
def choose_hdd(number_of_zpools = 0):
hdd_items = map(lambda x: '{}: {} {}'.format(x.name, x.capacity, x.description), hdds)
@@ -318,7 +330,7 @@ def choose_hdd(number_of_zpools = 0):
if choice == 'zpool':
return None
raise Abort('HDD choosing')
-
+
def configure_partitions(hdd, number_of_disks = 1):
choice = None
top_text = 'For the root ZFS pool you need a disk containing a Solaris partition (id 0xbf). \
diff --git a/lib/snack/__init__.py b/lib/snack/__init__.py
index 763a764..33b908e 100644
--- a/lib/snack/__init__.py
+++ b/lib/snack/__init__.py
@@ -72,6 +72,10 @@ class ProgressBar(object):
self._scale.set(self._progress)
self._refresh()
+ def advance(self, increment = 1):
+ self.progress = self._progress + increment
+
+
def _refresh(self):
self._form.draw()