Correct the problem of reumount operation
Text mode uses python-newt to show install progress modified: interface/ri_inst_cli.py modified: interface/ri_install.py modified: operation/exec_finish_install.sh modified: operation/functions modified: operation/partition_disks.sh
This commit is contained in:
@@ -16,10 +16,9 @@
|
|||||||
# Ling Fen 2010-09-04 create
|
# Ling Fen 2010-09-04 create
|
||||||
#
|
#
|
||||||
|
|
||||||
import time
|
|
||||||
import ri_progress
|
import ri_progress
|
||||||
from ri_oper import language, Rate
|
from ri_oper import language, Rate
|
||||||
import dialog
|
from snack import *
|
||||||
def set_task(task_name):
|
def set_task(task_name):
|
||||||
ri_progress.i_operation = task_name
|
ri_progress.i_operation = task_name
|
||||||
|
|
||||||
@@ -34,18 +33,32 @@ def set_task_over():
|
|||||||
cmdline = f.readline()
|
cmdline = f.readline()
|
||||||
f.close()
|
f.close()
|
||||||
instmode = cmdline.split(' ')[0].split('=')[1]
|
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':
|
if instmode == 'Auto' or instmode == 'StateGrid':
|
||||||
print 'The system will reboot in 10 seconds ......'
|
g.add(txt1, 0, 1)
|
||||||
time.sleep(10)
|
g.setTimer(10000)
|
||||||
|
g.runOnce()
|
||||||
|
screen.finish()
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
ifreboot=dialog.Dialog()
|
g.add(txt2, 0, 0)
|
||||||
ret=ifreboot.yesno("Rocky system installation successfully, do you want to reboot?")
|
g.add(bb, 0, 2)
|
||||||
if ret == 0:
|
res = g.run()
|
||||||
|
screen.refresh()
|
||||||
|
if bb.buttonPressed(res) == 'ok':
|
||||||
|
screen.finish()
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
|
screen.finish()
|
||||||
return False
|
return False
|
||||||
return False
|
|
||||||
|
|
||||||
def root_destroy():
|
def root_destroy():
|
||||||
pass
|
pass
|
||||||
|
|||||||
@@ -22,10 +22,13 @@ import ri_oper
|
|||||||
import os
|
import os
|
||||||
import os.path
|
import os.path
|
||||||
import ri_data
|
import ri_data
|
||||||
import time
|
|
||||||
import dialog
|
import dialog
|
||||||
import ri_progress
|
import ri_progress
|
||||||
import thread
|
import thread
|
||||||
|
import time
|
||||||
|
from snack import *
|
||||||
|
from time import sleep
|
||||||
|
|
||||||
sys.path.append('../new_partition/')
|
sys.path.append('../new_partition/')
|
||||||
import partition_data as p_d
|
import partition_data as p_d
|
||||||
|
|
||||||
@@ -37,16 +40,25 @@ def install_over(ret):
|
|||||||
else:
|
else:
|
||||||
display.root_destroy()
|
display.root_destroy()
|
||||||
|
|
||||||
def show_progress():
|
def show_progress():
|
||||||
d = dialog.Dialog()
|
screen = SnackScreen()
|
||||||
d.add_persistent_args(["--backtitle","Installing Rocky4.2 ...."])
|
screen.drawRootText(0, 0, 'Rocky Security OS Install')
|
||||||
d.gauge_start("Progress: %0", title = "installing")
|
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:
|
while True:
|
||||||
if ri_progress.i_percent >= 98:
|
if ri_progress.i_percent >= 98 :
|
||||||
break
|
break
|
||||||
d.gauge_update(ri_progress.i_percent, "%s" % ri_progress.i_operation, update_text=1)
|
screen.finish()
|
||||||
time.sleep(0.1)
|
progress.set(ri_progress.i_percent)
|
||||||
d.gauge_stop()
|
txt.setText(ri_progress.i_operation)
|
||||||
|
g.draw()
|
||||||
|
screen.refresh()
|
||||||
|
time.sleep(0.1)
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
global has_run
|
global has_run
|
||||||
@@ -66,8 +78,7 @@ def main():
|
|||||||
|
|
||||||
has_run = False
|
has_run = False
|
||||||
|
|
||||||
def print_usages():
|
def print_usages(): print 'Usages: %s [-l|--language language] [-d|--display display-mode] [install_xml_file]' %sys.argv[0]
|
||||||
print 'Usages: %s [-l|--language language] [-d|--display display-mode] [install_xml_file]' %sys.argv[0]
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
opts, args = getopt.getopt(sys.argv[1:], "l:d:", ["language=", "display="])
|
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
|
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(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)
|
display.start(main)
|
||||||
|
|||||||
@@ -44,6 +44,16 @@ prep ()
|
|||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
clean_mp ()
|
||||||
|
{
|
||||||
|
local mp
|
||||||
|
|
||||||
|
for mp in /dev /proc /sys
|
||||||
|
do
|
||||||
|
umount $mp
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
main ()
|
main ()
|
||||||
{
|
{
|
||||||
local base
|
local base
|
||||||
@@ -64,12 +74,15 @@ main ()
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
info "Running finish install success"
|
info "Running finish install success"
|
||||||
[ ! -c "$LOG_FILE" ] && cp $LOG_FILE "$TARGET/var/log"
|
[ ! -c "$LOG_FILE" ] && cp $LOG_FILE "$TARGET/var/log"
|
||||||
[ ! -c "/var/install/install.xml" ] && cp "/var/install/install.xml" "$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 "$DEV_LOG" ] && cp $DEV_LOG "$TARGET/var/log" || true
|
||||||
|
|
||||||
|
clean_mp
|
||||||
}
|
}
|
||||||
|
|
||||||
FINISH_INSTALL_DIR="/usr/lib/new_install/operation/finish_install"
|
FINISH_INSTALL_DIR="/usr/lib/new_install/operation/finish_install"
|
||||||
|
|
||||||
main "$@"
|
main "$@"
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ reumount ()
|
|||||||
else
|
else
|
||||||
# delete last "/" in mountpoint
|
# delete last "/" in mountpoint
|
||||||
# mountpoint in /proc/mounts don't have "/" at last
|
# mountpoint in /proc/mounts don't have "/" at last
|
||||||
multi_mountpoint=$(echo arg|sed "s%/$%%")
|
multi_mountpoint=$(echo $arg|sed "s%/$%%")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# may be a device has been mounted in multi-mountpoint.
|
# may be a device has been mounted in multi-mountpoint.
|
||||||
|
|||||||
@@ -21,9 +21,9 @@
|
|||||||
|
|
||||||
source ./functions
|
source ./functions
|
||||||
|
|
||||||
|
|
||||||
main ()
|
main ()
|
||||||
{
|
{
|
||||||
|
reumount /mnt/
|
||||||
while read line;do
|
while read line;do
|
||||||
info "$line" stdout
|
info "$line" stdout
|
||||||
[ -z "$line" ] && continue
|
[ -z "$line" ] && continue
|
||||||
@@ -38,6 +38,7 @@ main ()
|
|||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
main "$@"
|
main "$@"
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user