1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
#!/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
def welcome():
rc = d.yesno(width=60, height=20, title='Welcome to Dyson installer',
text='''
Dyson is an operating system derived from Debian and based on Illumos core.\
It uses Illumos unix kernel, illumos libc, ZFS file system and SMF to manage system startup.\
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?''')
if rc:
sys.exit(1)
welcome()
get_hdd()
choose_hdd()
|