/[gli]/trunk/src/fe/dialog/newdialogfe.py
Gentoo

Contents of /trunk/src/fe/dialog/newdialogfe.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 567 - (show annotations) (download) (as text)
Tue May 10 21:41:03 2005 UTC (15 years, 5 months ago) by codeman
File MIME type: text/x-python
File size: 5144 byte(s)
updated both for new filename.
  date changes. 2004->2005.

1 #!/usr/bin/python
2
3 import sys
4 sys.path.append("../..")
5
6 import dialog
7 import GLIException
8 import GLIInstallProfile
9 import GLIClientConfiguration
10 import GLIClientController
11 import GLIUtility
12 import GLIStorageDevice
13 from GLIGenDialog import GLIGenCF,GLIGenIP
14 import string
15 import copy
16 import time
17 import re
18 import glob
19 import os
20 import platform
21
22 class CFDialog(GLIGenCF):
23 def __init__(self):
24 GLIGenCF.__init__(self)
25 self._set_arch_template()
26 self._set_logfile()
27 self._set_root_mount_point()
28 self._set_client_networking()
29 self._set_livecd_password()
30 self._set_enable_ssh()
31 self._set_client_kernel_modules()
32 self.client_config_xml_file = None
33 if d.yesno("Do you want to save the ClientConfiguration XML file?") == DLG_YES:
34 self.client_config_xml_file = self._save_client_profile()
35
36 class IPDialog(GLIGenIP):
37 def __init__(self, local_install):
38 GLIGenIP.__init__(self, local_install)
39 self.install_profile_xml_file = None
40 if d.yesno("Do you want to save the InstallProfile XML file?") == DLG_YES:
41 self.install_profile_xml_file = self._save_install_profile()
42
43 # ------------------------------------------------------------------
44 if __name__ == '__main__':
45
46 d = dialog.Dialog()
47 client_profile = GLIClientConfiguration.ClientConfiguration()
48 install_profile = GLIInstallProfile.InstallProfile()
49 cc = GLIClientController.GLIClientController(pretend=True)
50 exception_waiting = None
51 next_step_waiting = False
52 install_done = False
53 local_install = True
54
55 DLG_OK = 0
56 DLG_YES = 0
57 DLG_CANCEL = 1
58 DLG_NO = 1
59 DLG_ESC = 2
60 DLG_ERROR = 3
61 DLG_EXTRA = 4
62 DLG_HELP = 5
63
64 d.setBackgroundTitle("Gentoo Linux Installer")
65 d.msgbox("Welcome to The Gentoo Linux Installer. This is a TESTING release. If your system dies a horrible, horrible death, don't come crying to us (okay, you can cry to klieber).", height=10, width=50, title="Welcome")
66
67 if d.yesno("Are we running in Pretend mode? Yes means safe, No means actually install!") == DLG_NO:
68 cc._pretend = False
69 else:
70 cc._pretend = True
71
72 if d.yesno("Are the profiles being generated to be used for an install on the current computer?") == DLG_NO:
73 local_install = False
74
75
76 if d.yesno("Do you want to use the ClientController? (if doing an install, say YES)") == DLG_YES:
77 client_config_xml_file = None
78 while 1:
79 if d.yesno("Do you have a previously generated XML file for the ClientConfiguration?") == DLG_YES:
80 code, client_config_xml_file = d.inputbox("Enter the filename of the XML file")
81 if code != DLG_OK:
82 break
83 if GLIUtility.is_file(client_config_xml_file):
84 break
85 d.msgbox("Cannot open file " + client_config_xml_file, height=7, width=50)
86 client_config_xml_file = None
87 continue
88 else:
89 break
90
91 if client_config_xml_file != None:
92 client_profile.parse(client_config_xml_file)
93 # code to actually run the client_controller functions
94 else:
95 gen_client_conf = CFDialog()
96 if gen_client_conf.client_config_xml_file:
97 client_profile.parse(gen_client_conf.client_config_xml_file)
98 else:
99 client_profile = gen_client_conf.client_profile()
100
101 d.msgbox("ClientController done")
102
103 client_profile.set_interactive(None, True, None)
104 cc.set_configuration(client_profile)
105
106 cc.start_pre_install()
107
108 install_profile_xml_file = None
109
110 while 1:
111 if d.yesno("Do you have a previously generated InstallProfile XML file?") == DLG_YES:
112 code, install_profile_xml_file = d.inputbox("Enter the filename of the XML file")
113 if code != DLG_OK:
114 break
115 if GLIUtility.is_file(install_profile_xml_file):
116 break
117 d.msgbox("Cannot open file " + install_profile_xml_file, height=7, width=50)
118 install_profile_xml_file = None
119 else:
120 break
121
122 if install_profile_xml_file != None:
123 install_profile.parse(install_profile_xml_file)
124 else:
125 gen_install_profile = IPDialog(local_install)
126 if gen_install_profile.client_config_xml_file:
127 install_profile.parse(gen_install_profile.client_config_xml_file)
128 else:
129 install_profile = gen_install_profile.install_profile()
130
131 d.msgbox("InstallProfile done")
132
133 current_item = 0
134
135 while 1:
136 cc.set_install_profile(install_profile)
137 cc.start_install()
138 d.gauge_start("Installation Started!", title="Installation progress")
139 num_steps_completed = 1
140 while 1:
141 notification = cc.getNotification()
142 if notification == None:
143 time.sleep(1)
144 continue
145 type_r = notification.get_type()
146 data = notification.get_data()
147 if type_r == "exception":
148 print "Exception received:"
149 print data
150 elif type_r == "int":
151 if data == GLIClientController.NEXT_STEP_READY:
152 next_step_waiting = False
153 next_step = cc.get_next_step_info()
154 num_steps = cc.get_num_steps()
155 i = (num_steps_completed*100)/num_steps
156 d.gauge_update(i, "On step %d of %d. Current step: %s" % (num_steps_completed, num_steps, next_step), update_text=1)
157 num_steps_completed += 1
158 #print "Next step: " + next_step
159 if cc.has_more_steps():
160 cc.next_step()
161 continue
162 if data == GLIClientController.INSTALL_DONE:
163 d.gauge_update(100, "Install completed!", update_text=1)
164 d.gauge_stop()
165 print "Install done!"
166 sys.exit(0)

Properties

Name Value
svn:eol-style native

  ViewVC Help
Powered by ViewVC 1.1.20