Modify finish_install interface:
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
This commit is contained in:
@@ -32,26 +32,44 @@ source ./functions
|
||||
|
||||
prep ()
|
||||
{
|
||||
for mp in /dev /proc /sys
|
||||
do
|
||||
mount --bind -n $mp "$TARGET$mp"
|
||||
done
|
||||
local mp
|
||||
|
||||
# copy the script to $TARGET/opt
|
||||
cp -r /usr/lib/new_install/operation/finish_install $TARGET/opt
|
||||
if [ ! -d $FINISH_INSTALL_DIR ];then
|
||||
mkdir -p $FINISH_INSTALL_DIR
|
||||
fi
|
||||
|
||||
for mp in /dev /proc /sys
|
||||
do
|
||||
mount --bind -n $mp "$TARGET$mp"
|
||||
done
|
||||
}
|
||||
|
||||
main ()
|
||||
{
|
||||
prep
|
||||
info "Running finish install"
|
||||
/usr/bin/python finish_install.py >>$DEV_LOG 2>&1
|
||||
info "Running finish install success"
|
||||
local base
|
||||
local script
|
||||
|
||||
prep
|
||||
|
||||
# run all the script in /usr/lib/new_install/operation/finish_install,
|
||||
# execute sequence through number of script name
|
||||
for script in "$FINISH_INSTALL_DIR"/*; do
|
||||
base=$(basename $script | sed 's/[0-9]*//')
|
||||
if [ -x "$script" ];then
|
||||
info "Running $base"
|
||||
$script >>$LOG_FILE 2>&1
|
||||
erv
|
||||
else
|
||||
warn "Unable to execute $script"
|
||||
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
|
||||
}
|
||||
|
||||
#FINISH_INSTALL_DIR="/var/finish_install"
|
||||
FINISH_INSTALL_DIR="/usr/lib/new_install/operation/finish_install"
|
||||
|
||||
main "$@"
|
||||
|
||||
|
||||
25
operation/finish_install/95state_grid_custom.py
Executable file
25
operation/finish_install/95state_grid_custom.py
Executable file
@@ -0,0 +1,25 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
# run finish_install scripts
|
||||
#
|
||||
|
||||
import os,sys
|
||||
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()
|
||||
f.close()
|
||||
instmode = cmdline.split(' ')[0].split('=')[1]
|
||||
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")
|
||||
|
||||
@@ -2,12 +2,11 @@
|
||||
|
||||
# run post_add scripts
|
||||
#
|
||||
pkg_dir=/var/lib/pkg
|
||||
ls -rt ${pkg_dir}/*.post_add | while read pa_file
|
||||
do
|
||||
source ${pa_file}
|
||||
rm ${pa_file}
|
||||
done
|
||||
source ./functions
|
||||
|
||||
rm -f $pkg_dir/*-serv.conf
|
||||
cp /usr/lib/new_install/operation/finish_install/exec_post_add.sh $TARGET/opt/
|
||||
|
||||
chmod +x $TARGET/opt/exec_post_add.sh
|
||||
|
||||
chroot $TARGET /opt/exec_post_add.sh >>$LOG_FILE 2>&1 && rm -rf $TARGET/opt/exec_post_add.sh
|
||||
|
||||
|
||||
13
operation/finish_install/exec_post_add.sh
Normal file
13
operation/finish_install/exec_post_add.sh
Normal file
@@ -0,0 +1,13 @@
|
||||
#!/bin/bash
|
||||
|
||||
# run post_add scripts
|
||||
#
|
||||
pkg_dir=/var/lib/pkg
|
||||
ls -rt ${pkg_dir}/*.post_add | while read pa_file
|
||||
do
|
||||
source ${pa_file}
|
||||
rm ${pa_file}
|
||||
done
|
||||
|
||||
rm -f $pkg_dir/*-serv.conf
|
||||
|
||||
@@ -208,20 +208,23 @@ install_bootloader.sh
|
||||
|
||||
7.安装完成执行的脚本
|
||||
exec_finish_install.sh
|
||||
输入:
|
||||
stdin
|
||||
1)脚本的名字
|
||||
输出:
|
||||
无
|
||||
返回值:
|
||||
根据具体执行脚本的返回值来确定,0是成功
|
||||
Usage:
|
||||
单个处理:echo "99finish_install.sh"| ./exec_finish_install.sh
|
||||
批量处理:文件格式和单个处理一致
|
||||
说明:
|
||||
此脚本把99finish_install.sh拷贝到/var/finish_install目录下,
|
||||
然后根据/var/finish_install目录下面的脚本名字前面的数字顺序,从小
|
||||
到大依次拷贝到硬盘系统里面执行。
|
||||
#输入:
|
||||
# stdin
|
||||
# 1)脚本的名字
|
||||
#输出:
|
||||
# 无
|
||||
#返回值:
|
||||
# 根据具体执行脚本的返回值来确定,0是成功
|
||||
#Usage:
|
||||
#单个处理:echo "99finish_install.sh"| ./exec_finish_install.sh
|
||||
#批量处理:文件格式和单个处理一致
|
||||
#说明:
|
||||
# 此脚本把99finish_install.sh拷贝到/var/finish_install目录下,
|
||||
#然后根据/var/finish_install目录下面的脚本名字前面的数字顺序,从小
|
||||
#到大依次拷贝到硬盘系统里面执行。
|
||||
|
||||
99finish_install.sh
|
||||
原来的firstboot.sh
|
||||
#99finish_install.sh
|
||||
#原来的firstboot.sh
|
||||
|
||||
Usage:
|
||||
exec_finish_install.sh按照次序依次执行/usr/lib/new_install/operation/finish_install目录下的可执行脚本
|
||||
|
||||
@@ -61,7 +61,7 @@ mount_partition ()
|
||||
# after installation will set acl, so we use acl option mount here.
|
||||
# this configuration according old Rocky installer.
|
||||
case $fs_type in
|
||||
ext2|ext3|reiserfs)
|
||||
ext2|ext3|ext4|reiserfs)
|
||||
[ -z "$fs_mntops" ] && fs_mntops="acl" ;;
|
||||
*)
|
||||
[ -z "$fs_mntops" ] && fs_mntops="defaults" ;;
|
||||
|
||||
Reference in New Issue
Block a user