mirror of
ssh://git.janware.com/srv/git/janware/proj/jw-pkg
synced 2026-01-28 15:52:49 +01:00
integrate-distro.sh: Replace option -c copy-source-dir by -k hook
Signed-off-by: Jan Lindemann <jan@jannet.de>
This commit is contained in:
parent
fc9ec238e0
commit
77f7912c3f
1 changed files with 33 additions and 13 deletions
|
|
@ -6,6 +6,7 @@ arch=`uname -m`
|
||||||
suse_version=12.3
|
suse_version=12.3
|
||||||
o_name=suse-$suse_version
|
o_name=suse-$suse_version
|
||||||
cmd=install
|
cmd=install
|
||||||
|
cwd=`pwd`
|
||||||
|
|
||||||
initrd_modules="
|
initrd_modules="
|
||||||
via-rhine
|
via-rhine
|
||||||
|
|
@ -243,15 +244,27 @@ usage()
|
||||||
-n target-name
|
-n target-name
|
||||||
-p file with root password
|
-p file with root password
|
||||||
-a architecture
|
-a architecture
|
||||||
-c copy-source-dir
|
-k hook=command
|
||||||
-u user (for source-code-management login)
|
-u user (for source-code-management login)
|
||||||
|
|
||||||
|
known hooks are:
|
||||||
|
|
||||||
|
o fs-ready
|
||||||
|
o pkg-installed
|
||||||
|
|
||||||
|
during hook execution the following variables are filled
|
||||||
|
|
||||||
|
o \$hook : the name of the hook
|
||||||
|
o \$root : path to the root directory of the
|
||||||
|
distribution being integrated
|
||||||
|
|
||||||
"
|
"
|
||||||
[ "$1" ] && exit $1
|
[ "$1" ] && exit $1
|
||||||
}
|
}
|
||||||
|
|
||||||
get_opts()
|
get_opts()
|
||||||
{
|
{
|
||||||
set -- `getopt 'hd:n:a:p:c:u:' $*`
|
set -- `getopt 'hd:n:a:p:k:u:w:' $*`
|
||||||
while [ "$1" != -- ] ; do
|
while [ "$1" != -- ] ; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
-h)
|
-h)
|
||||||
|
|
@ -273,14 +286,18 @@ get_opts()
|
||||||
root_password_file=$2
|
root_password_file=$2
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
-c)
|
-k)
|
||||||
copy_source_dir=$2
|
hooks[${2%%=*}]="${2#*=}"
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
-u)
|
-u)
|
||||||
scm_user=$2
|
scm_user=$2
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
|
-w)
|
||||||
|
cwd=$2
|
||||||
|
shift
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
usage 1
|
usage 1
|
||||||
;;
|
;;
|
||||||
|
|
@ -365,6 +382,15 @@ run_chroot()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
run_hook()
|
||||||
|
{
|
||||||
|
hook="$1"
|
||||||
|
local cmd="${hooks[$hook]}"
|
||||||
|
[ "$cmd" ] || return
|
||||||
|
[ "${cmd:0:2}" = "./" ] && cmd=$cwd/${cmd:2}
|
||||||
|
. $cmd
|
||||||
|
}
|
||||||
|
|
||||||
run_parted()
|
run_parted()
|
||||||
{
|
{
|
||||||
while read cmd; do
|
while read cmd; do
|
||||||
|
|
@ -934,13 +960,7 @@ cmd_install()
|
||||||
make_home_ssh_conf > $root/root/.ssh/config
|
make_home_ssh_conf > $root/root/.ssh/config
|
||||||
chmod 600 $root/root/.ssh/config
|
chmod 600 $root/root/.ssh/config
|
||||||
|
|
||||||
[ "$copy_source_dir" ] && {
|
run_hook pkg-installed
|
||||||
echo "=== copying over dir $copy_source_dir"
|
|
||||||
cp -rLp $copy_source_dir/* $root/
|
|
||||||
chroot $root /sbin/mkinitrd_setup # TODO: remove this
|
|
||||||
touch $root/opt/ytools/bin/jcs # TODO: remove this
|
|
||||||
chroot $root /opt/ytools/bin/jcs init # TODO: remove this
|
|
||||||
}
|
|
||||||
|
|
||||||
export CVSROOT=:ext:$scm_user@cvs.jannet.de:/home/jannet/arc/cvs
|
export CVSROOT=:ext:$scm_user@cvs.jannet.de:/home/jannet/arc/cvs
|
||||||
if [ "$SSH_AUTH_SOCK" ]; then
|
if [ "$SSH_AUTH_SOCK" ]; then
|
||||||
|
|
@ -996,7 +1016,7 @@ myname=`basename $0`
|
||||||
zypper_global_opts="--non-interactive --gpg-auto-import-keys --no-gpg-checks"
|
zypper_global_opts="--non-interactive --gpg-auto-import-keys --no-gpg-checks"
|
||||||
date=`date`
|
date=`date`
|
||||||
host_files=""
|
host_files=""
|
||||||
|
declare -A hooks
|
||||||
get_opts "$@"
|
get_opts "$@"
|
||||||
|
|
||||||
init_root_password_file
|
init_root_password_file
|
||||||
|
|
@ -1025,7 +1045,7 @@ if [ `whoami` != root -o "$l32" ]; then
|
||||||
|
|
||||||
# preferring "ssh -l root localhost" over "sudo" to keep ssh-agent environment
|
# preferring "ssh -l root localhost" over "sudo" to keep ssh-agent environment
|
||||||
#sudo -i $exe $@ -p $root_password_file
|
#sudo -i $exe $@ -p $root_password_file
|
||||||
ssh -l root localhost $l32 $exe $@ -p $root_password_file -u $scm_user
|
ssh -l root localhost $l32 $exe $@ -p $root_password_file -u $scm_user -w $cwd
|
||||||
|
|
||||||
exit $?
|
exit $?
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue