Fix bug 1987:

添加安装完成后的动作(重启/关机/待机)

    修改:      interface/ri_data.py
	修改:      interface/ri_inst_cli.py
	修改:      interface/ri_install.py
	修改:      main/setup
	修改:      text/ri_main.py
	修改:      text/ri_newt.py

Signed-off-by: sysadmin <zhihuipeng@linx-info.com>
This commit is contained in:
sysadmin
2014-08-19 10:23:13 +08:00
parent 3594ab8f9c
commit 918bf64ea5
6 changed files with 95 additions and 16 deletions

View File

@@ -19,6 +19,8 @@
import ri_progress,re,os
from ri_oper import language, Rate
from snack import *
import ri_data
def set_task(task_name):
ri_progress.i_operation = task_name
@@ -36,36 +38,47 @@ def set_task_over():
# if re.match('instmode=',i):
# instmode = i.split('=')[1]
# break
try:
instmode = os.environ["instmode"]
except:
instmode = 'Text'
#try:
# instmode = os.environ["instmode"]
#except:
# instmode = 'Text'
screen = SnackScreen()
screen.drawRootText(0, 0, 'Rocky Security OS Install')
screen.pushHelpLine(' ')
g = GridForm(screen, 'Rocky Install', 1, 3)
txt1 = Label('Automated Install Rocky OS successfully, and the OS will reboot in 10 seconds ......')
txt2 = Label('Install Rocky OS successfully, do you want to reboot ?')
txt2 = Label('Automated Install Rocky OS successfully, and the OS will shutdown in 10 seconds ......')
txt3 = Label('Install Rocky OS successfully, do you want to reboot ?')
elabel = Label('')
bb = ButtonBar(screen, (('Ok','ok'),('Cancel','cancel')))
g.add(elabel, 0, 1)
if instmode == 'Auto' or instmode == 'StateGrid':
#if instmode == 'Auto' or instmode == 'StateGrid':
if ri_data.FinishState.flag.strip() == 'reboot':
g.add(txt1, 0, 1)
g.setTimer(10000)
g.runOnce()
screen.finish()
return True
else:
g.add(txt2, 0, 0)
#return True
return 'reboot'
elif ri_data.FinishState.flag.strip() == 'shutdown':
g.add(txt2, 0, 1)
g.setTimer(10000)
g.runOnce()
screen.finish()
#return True
return 'shutdown'
elif ri_data.FinishState.flag.strip() == 'nothing':
g.add(txt3, 0, 0)
g.add(bb, 0, 2)
res = g.run()
screen.refresh()
if bb.buttonPressed(res) == 'ok':
screen.finish()
return True
#return True
return 'reboot'
else:
screen.finish()
return False
return 'nothing'
def root_destroy():
pass