Files
new_install/operation/exec_finish_install.sh
lizhi-rocky 220e6bfe40 add Qin Bo's operating shell scripts in
rename directory 'python' to 'interface', for I think it is a better name for its included python scripts function.
2010-09-03 15:59:49 +08:00

84 lines
1.4 KiB
Bash
Executable File

#!/bin/bash
#
# DESCRIPTION: chroot $TARGET excute script under /var/finish_install/.
# copy 99finish_install to /var/finish_install/, then one
# by one copy the script in /var/finish_install/ to $TARGET
# with sequence, and then chroot $TARGET to execte it.
#
# SCRIPT NAME: exec_finish_install.sh
#
# Input: stdin
# 1. script name which need run after installation
#
# Output:
# 1
# 2
#
# AUTHOR: Qin Bo
#
# EMAIL: bqin@linx-info.com
#
# DATE: 2010-08-27
#
# HISTORY:
# REVISOR DATE MODIFICATION
# Qin Bo 2010-08-27 create
#
#
#
source ./functions
prep ()
{
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
}
exec_script ()
{
src="$1"
src_name=$(basename $src)
cp $src "$TARGET/opt"
chroot $TARGET "/opt/$src_name" >$dev_LOG 2>&1 && rm -f "$TARGET/opt/$src_name"
}
main ()
{
prep
while read line ;do
if [ -n "$line" ];then
cp $line $finish_install_dir/
else
break
fi
done
# run all the script in /var/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"
exec_script $script
erv
else
warn "Unable to execute $script"
fi
done
}
finish_install_dir="/var/finish_install"
main $@