Files
new_install/operation/finish_install/98state_grid_custom.py
Peng Zhihui 9c1fbe799e exchange the running order of state_grid_custom and run_post_add script
renamed:    operation/finish_install/98run_post_add.sh ->
		    operation/finish_install/95run_post_add.sh
	renamed:    operation/finish_install/95state_grid_custom.py ->
		    operation/finish_install/98state_grid_custom.py
2014-04-15 17:31:24 +08:00

30 lines
748 B
Python
Executable File

#!/usr/bin/env python
# run finish_install scripts
#
import os,sys,re
sys.path.append('../interface')
import ri_data
# get data from install.xml
ri_data.init_from_xml()
username = ri_data.StateGrid.username
homedir = ri_data.StateGrid.home_dir
shell = ri_data.StateGrid.shell
# run state grid custom scripts
f = open('/proc/cmdline', 'r')
cmdline = f.readline().strip()
f.close()
#instmode = cmdline.split(' ')[0].split('=')[1]
for i in cmdline.split(' '):
if re.match('instmode=',i):
instmode = i.split('=')[1]
break
if instmode == 'StateGrid':
os.system("cp -r /usr/lib/StateGrid /mnt/opt/")
os.system("chroot /mnt /opt/StateGrid/setup.sh %s %s %s" %(username, homedir, shell))
os.system("rm -rf /mnt/opt/StateGrid")