summaryrefslogtreecommitdiff
path: root/setup
diff options
context:
space:
mode:
authorIgor Pashev <pashev.igor@gmail.com>2012-06-16 13:36:30 +0000
committerIgor Pashev <pashev.igor@gmail.com>2012-06-16 13:36:30 +0000
commitc9c9207a3e73a2ce67c3b3c59505675fadc76628 (patch)
treee903ae51849b5458818c0781b4e887ed932d57dd /setup
parent18d913298f40405dcc49f074bed5de8d53b05840 (diff)
downloadlive-c9c9207a3e73a2ce67c3b3c59505675fadc76628.tar.gz
Use Python + Dialog
Diffstat (limited to 'setup')
-rwxr-xr-xsetup81
1 files changed, 44 insertions, 37 deletions
diff --git a/setup b/setup
index b91829b..8e53bbd 100755
--- a/setup
+++ b/setup
@@ -1,37 +1,44 @@
-#!/usr/bin/bash
-
-set -e
-set -u
-
-DRIVES=()
-
-
-dialog --backtitle 'Dyson Installer' \
---title "Dyson Installer" --yesno \
-'
-Dyson is an operating system derived from Debian and based on Illumos core (kernel and libc). To learn more visit http://osdyson.org
-
-This installer will guide you though disk paritioning, filesystem creation, installation of base system and minimal configuration.
-
-Please note, this system IS VERY EXPERIMENTAL. You can LOOSE ALL YOUR DATA which this system can reach ;-)
-
-Whould you like to continue?
-
-' 20 60
-
-
-fdisk_dialog()
-{
- while read -r id desc; do
- DRIVES+=("$id")
- DRIVES+=("$desc")
- done << drives
- $(format </dev/null | grep -E ' [0-9]+\. ' | sed -r 's, *([0-9]+)\. (\w+) *<(.+)> *,\2 \3,')
-drives
- cmd=(dialog --title 'Drive Partitioning' --menu "Available drives:" 22 76 16)
- "${cmd[@]}" "${DRIVES[@]+${DRIVES[@]}}"
-}
-
-
-fdisk_dialog
-
+#!/usr/bin/python
+
+import dialog
+import subprocess
+import sys
+import re
+
+d = dialog.Dialog()
+d.setBackgroundTitle('Dyson Installer')
+
+
+HDD = []
+
+def get_hdd():
+ pat = re.compile('\d+\.\s+(\S+)\s+<(.+)>')
+ out = subprocess.Popen('format </dev/null', shell=True, stdout=subprocess.PIPE).stdout
+ for line in out:
+ match = pat.search(line)
+ if match:
+ HDD.append({'name': match.group(1), 'desc': match.group(2), 'use': 0})
+ # if there is only one disk, use it by default:
+ if len(HDD) == 1:
+ HDD[0]['use'] = 1
+ if len(HDD) == 0:
+ d.msgbox(width=50, title='Error: no disks found',
+ text='\nSorry, no hard disks found on your system. Installation is not possible.')
+ sys.exit(1)
+
+
+
+def choose_hdd():
+ while True:
+ choices = []
+ for hdd in HDD:
+ choices.append((hdd['name'], hdd['desc'], hdd['use']))
+ res = d.checklist(choices=choices,
+ title='Choose disks to use for root zpool',
+ text='''
+ ''')
+ break
+
+
+get_hdd()
+choose_hdd()