diff --git a/interface/ri_inst_cli.py b/interface/ri_inst_cli.py index 133399c..aae48ee 100644 --- a/interface/ri_inst_cli.py +++ b/interface/ri_inst_cli.py @@ -16,10 +16,9 @@ # Ling Fen 2010-09-04 create # -import time import ri_progress from ri_oper import language, Rate -import dialog +from snack import * def set_task(task_name): ri_progress.i_operation = task_name @@ -34,18 +33,32 @@ def set_task_over(): cmdline = f.readline() f.close() instmode = cmdline.split(' ')[0].split('=')[1] + 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 ?') + elabel = Label('') + bb = ButtonBar(screen, (('Ok','ok'),('Cancel','cancel'))) + g.add(elabel, 0, 1) if instmode == 'Auto' or instmode == 'StateGrid': - print 'The system will reboot in 10 seconds ......' - time.sleep(10) + g.add(txt1, 0, 1) + g.setTimer(10000) + g.runOnce() + screen.finish() return True else: - ifreboot=dialog.Dialog() - ret=ifreboot.yesno("Rocky system installation successfully, do you want to reboot?") - if ret == 0: + g.add(txt2, 0, 0) + g.add(bb, 0, 2) + res = g.run() + screen.refresh() + if bb.buttonPressed(res) == 'ok': + screen.finish() return True else: + screen.finish() return False - return False def root_destroy(): pass diff --git a/interface/ri_install.py b/interface/ri_install.py index cb46418..7f35be5 100644 --- a/interface/ri_install.py +++ b/interface/ri_install.py @@ -22,10 +22,13 @@ import ri_oper import os import os.path import ri_data -import time import dialog import ri_progress import thread +import time +from snack import * +from time import sleep + sys.path.append('../new_partition/') import partition_data as p_d @@ -37,16 +40,25 @@ def install_over(ret): else: display.root_destroy() -def show_progress(): - d = dialog.Dialog() - d.add_persistent_args(["--backtitle","Installing Rocky4.2 ...."]) - d.gauge_start("Progress: %0", title = "installing") +def show_progress(): + screen = SnackScreen() + screen.drawRootText(0, 0, 'Rocky Security OS Install') + screen.pushHelpLine(" ") + g = GridForm(screen,"Rocky Install",1,2) + txt = Label("Start Install...") + progress = Scale(90,100) + g.add(txt, 0, 0, anchorLeft=1) + g.add(progress, 0, 1) while True: - if ri_progress.i_percent >= 98: + if ri_progress.i_percent >= 98 : break - d.gauge_update(ri_progress.i_percent, "%s" % ri_progress.i_operation, update_text=1) - time.sleep(0.1) - d.gauge_stop() + screen.finish() + progress.set(ri_progress.i_percent) + txt.setText(ri_progress.i_operation) + g.draw() + screen.refresh() + time.sleep(0.1) + def main(): global has_run @@ -66,8 +78,7 @@ def main(): has_run = False -def print_usages(): - print 'Usages: %s [-l|--language language] [-d|--display display-mode] [install_xml_file]' %sys.argv[0] +def print_usages(): print 'Usages: %s [-l|--language language] [-d|--display display-mode] [install_xml_file]' %sys.argv[0] try: opts, args = getopt.getopt(sys.argv[1:], "l:d:", ["language=", "display="]) @@ -99,6 +110,18 @@ ri_oper.display_sub_operation = display.set_sub_task ri_oper.display_scale = display.set_task_scale #oper_list = [ri_oper.MakePartitions(5),ri_oper.MakeRaid(3),ri_oper.Format(7),ri_oper.Mount(3),ri_oper.InstallPkg(49),ri_oper.MakeRaidConfigure(2),ri_oper.ConfigureFstab(5),ri_oper.GenerateIssue(3),ri_oper.ConfigureNetwork(2),ri_oper.MakeServiceAutoBoot(5),ri_oper.CopyKernel(7),ri_oper.ConfigureBootloader(5),ri_oper.BootLoader(2),ri_oper.ExecFinishInstall(2)] -oper_list = [ri_oper.MakePartitions(5),ri_oper.MakeRaid(4),ri_oper.Format(7),ri_oper.Mount(4),ri_oper.InstallPkg(49),ri_oper.MakeRaidConfigure(3),ri_oper.ConfigureFstab(5),ri_oper.GenerateIssue(4),ri_oper.ConfigureNetwork(3),ri_oper.MakeServiceAutoBoot(5),ri_oper.ConfigureBootloader(5),ri_oper.BootLoader(3),ri_oper.ExecFinishInstall(3)] +oper_list = [ri_oper.MakePartitions(5), + ri_oper.MakeRaid(4), + ri_oper.Format(7), + ri_oper.Mount(4), + ri_oper.InstallPkg(49), + ri_oper.MakeRaidConfigure(3), + ri_oper.ConfigureFstab(5), + ri_oper.GenerateIssue(4), + ri_oper.ConfigureNetwork(3), + ri_oper.MakeServiceAutoBoot(5), + ri_oper.ConfigureBootloader(5), + ri_oper.BootLoader(3), + ri_oper.ExecFinishInstall(3)] display.start(main) diff --git a/operation/exec_finish_install.sh b/operation/exec_finish_install.sh index b5faa30..2b07a06 100755 --- a/operation/exec_finish_install.sh +++ b/operation/exec_finish_install.sh @@ -44,6 +44,16 @@ prep () done } +clean_mp () +{ + local mp + + for mp in /dev /proc /sys + do + umount $mp + done +} + main () { local base @@ -64,12 +74,15 @@ main () fi done info "Running finish install success" - [ ! -c "$LOG_FILE" ] && cp $LOG_FILE "$TARGET/var/log" - [ ! -c "/var/install/install.xml" ] && cp "/var/install/install.xml" "$TARGET/var/log" - [ ! -c "$DEV_LOG" ] && cp $DEV_LOG "$TARGET/var/log" || true + [ ! -c "$LOG_FILE" ] && cp $LOG_FILE "$TARGET/var/log" + [ ! -c "/var/install/install.xml" ] && cp "/var/install/install.xml" "$TARGET/var/log" + [ ! -c "$DEV_LOG" ] && cp $DEV_LOG "$TARGET/var/log" || true + + clean_mp } FINISH_INSTALL_DIR="/usr/lib/new_install/operation/finish_install" main "$@" + diff --git a/operation/functions b/operation/functions index e7f64c7..1840c7c 100644 --- a/operation/functions +++ b/operation/functions @@ -99,7 +99,7 @@ reumount () else # delete last "/" in mountpoint # mountpoint in /proc/mounts don't have "/" at last - multi_mountpoint=$(echo arg|sed "s%/$%%") + multi_mountpoint=$(echo $arg|sed "s%/$%%") fi # may be a device has been mounted in multi-mountpoint. diff --git a/operation/partition_disks.sh b/operation/partition_disks.sh index bf382f4..eac3fd4 100755 --- a/operation/partition_disks.sh +++ b/operation/partition_disks.sh @@ -21,9 +21,9 @@ source ./functions - main () { + reumount /mnt/ while read line;do info "$line" stdout [ -z "$line" ] && continue @@ -38,6 +38,7 @@ main () done } + main "$@"