exec_finish_install will run all executable scripts in the
finish_install dir in turn.
Add support to ext4 in mount_partition.sh
move auto_install.py and state_grid.py to text dir
modified: operation/exec_finish_install.sh
new file: operation/finish_install/95state_grid_custom.py
modified: operation/finish_install/99finish_install.sh
new file: operation/finish_install/exec_post_add.sh
modified: operation/install.txt
modified: operation/mount_partition.sh
renamed: AutoInstall/auto_install.py -> text/auto_install.py
renamed: StateGrid/state_grid.py -> text/state_grid.py
86 lines
2.8 KiB
Python
Executable File
86 lines
2.8 KiB
Python
Executable File
#!/usr/bin/env python
|
|
from snack import *
|
|
from xml.dom import minidom
|
|
from xml.dom.ext import PrettyPrint
|
|
import sys
|
|
|
|
sys.path.append('../interface/')
|
|
sys.path.append('../text/')
|
|
|
|
import ri_newt
|
|
import ri_data
|
|
|
|
install_xml = '/var/install/install.xml'
|
|
|
|
class Username(ri_newt.Screen):
|
|
def __init__(self):
|
|
ri_newt.Screen.__init__(self, name='username',title='StateGrid custom install')
|
|
ri_newt.Screen.screen.pushHelpLine('<Tab> moves; <Space> selects; <Enter> activates buttons')
|
|
|
|
self.text = 'This username will use as State Grid user. Can not be a system user or reserver user. Please enter username:'
|
|
ri_newt.Screen.widget_textboxreflowed(80, self.text)
|
|
ri_newt.Screen.widget_buttonbar([('Continue','ok','F12')])
|
|
|
|
def set_data(self):
|
|
ri_newt.Screen.widget_entry(75, text='')
|
|
s = ri_newt.Screen.yesno('[!!] State Grid custom install', 1, 5, 'TextboxReflowed', 'eLabel', 'Entry', 'eLabel', 'ButtonBar')
|
|
if s == 0:
|
|
ri_data.StateGrid.username = ri_newt.Screen.entry.value()
|
|
return s
|
|
|
|
class HomeDirectory(ri_newt.Screen):
|
|
def __init__(self):
|
|
ri_newt.Screen.__init__(self, name='home_dir',title='StateGrid custom install')
|
|
ri_newt.Screen.screen.pushHelpLine('<Tab> moves; <Space> selects; <Enter> activates buttons')
|
|
|
|
self.text = 'This directory will use as State Grid user home directory. Can not be /home/{sysadmin,netadmin,secadmin,audadmin}.\n\nPlease enter home directory:'
|
|
ri_newt.Screen.widget_textboxreflowed(80, self.text)
|
|
ri_newt.Screen.widget_buttonbar([('Continue','ok','F12')])
|
|
|
|
def set_data(self):
|
|
ri_newt.Screen.widget_entry(75, text='')
|
|
s = ri_newt.Screen.yesno('[!!] State Grid custom install', 1, 5, 'TextboxReflowed', 'eLabel', 'Entry', 'eLabel', 'ButtonBar')
|
|
if s == 0:
|
|
ri_data.StateGrid.home_dir = ri_newt.Screen.entry.value()
|
|
return s
|
|
|
|
class Shell(ri_newt.Screen):
|
|
def __init__(self):
|
|
ri_newt.Screen.__init__(self, name='shell',title='StateGrid custom install')
|
|
ri_newt.Screen.screen.pushHelpLine('<Tab> moves; <Space> selects; <Enter> activates buttons')
|
|
|
|
self.text = 'This shell will use as State Grid user shell, Please enter user shell:'
|
|
ri_newt.Screen.widget_textboxreflowed(80, self.text)
|
|
ri_newt.Screen.widget_buttonbar([('Continue','ok','F12')])
|
|
|
|
def set_data(self):
|
|
ri_newt.Screen.widget_entry(75, text='')
|
|
s = ri_newt.Screen.yesno('[!!] State Grid custom install', 1, 5, 'TextboxReflowed', 'eLabel', 'Entry', 'eLabel', 'ButtonBar')
|
|
if s == 0:
|
|
ri_data.StateGrid.shell = ri_newt.Screen.entry.value()
|
|
|
|
if __name__ == "__main__":
|
|
Username()
|
|
ri_newt.Screen.dict['username'].set_data()
|
|
HomeDirectory()
|
|
ri_newt.Screen.dict['home_dir'].set_data()
|
|
Shell()
|
|
ri_newt.Screen.dict['shell'].set_data()
|
|
|
|
xmldoc = minidom.parse(install_xml)
|
|
root = xmldoc.firstChild
|
|
f = file(install_xml,'w')
|
|
ri_data.StateGrid.to_xml(xmldoc, root)
|
|
PrettyPrint(xmldoc, f)
|
|
f.close()
|
|
|
|
ri_newt.Screen.screen.finish()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|