From 74d178f9b3cb8915a98ef327d68bf157b7dd40e4 Mon Sep 17 00:00:00 2001 From: Jan Lindemann Date: Thu, 27 Apr 2017 13:05:50 +0000 Subject: [PATCH] integrate-distro.sh: Add support for options -i and -x, fix ini-tools.sh - Add support for -i ssh-identity-file -x trace shell - Ini-tools.sh had to be in $PATH, now it has to be in the same directory as integrate-distro.sh. This is better for invocation from cron daemon, as it has practically no PATH set. Signed-off-by: Jan Lindemann --- scripts/integrate-distro.sh | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/scripts/integrate-distro.sh b/scripts/integrate-distro.sh index 89e91435..2d391c1f 100644 --- a/scripts/integrate-distro.sh +++ b/scripts/integrate-distro.sh @@ -451,7 +451,7 @@ usage() get_opts() { local p - eval set -- `getopt -o 'hd:n:a:p:k:u:w:s:r:fc:P:' -l config-file:,non-interactive -- "$@"` + eval set -- `getopt -o 'hd:n:a:p:k:u:w:s:r:fc:P:xi:' -l config-file:,non-interactive -- "$@"` while [ "$1" != -- ] ; do case "$1" in -h) @@ -511,6 +511,13 @@ get_opts() done shift ;; + -x) + trace=-x + ;; + -i) + ssh_identity="-i $2" + shift + ;; *) usage 1 ;; @@ -1415,14 +1422,19 @@ cmd_install() # -- here we go -myname=`basename $0` +exe="$0" +myname=`basename $exe` +mydir=`dirname $exe` + zypper_global_opts="--non-interactive --gpg-auto-import-keys --no-gpg-checks" date=`date` host_files="" declare -A hooks get_opts "$@" -. ini-tools.sh +[ "$trace" ] && set -x + +. $mydir/ini-tools.sh case $arch in i386|i586|i686) @@ -1478,14 +1490,14 @@ if [ `whoami` != root -o "$l32" ]; then [ "$env_ssh_auth_sock" ] && opt_ssh_auth_sock="-s $env_ssh_auth_sock" opts="" [ "$config_file" ] && opts="$opts --config-file $config_file" - #debug="/bin/bash -x" ssh=ssh [ "$CVS_RSH" ] && ssh="$CVS_RSH" [ "$GIT_SSH" ] && ssh="$GIT_SSH" ssh=`which $ssh` [ -x "$ssh" ] || fatal "SSH executable \"$ssh\" not found" - $ssh -l root localhost $l32 $debug /bin/bash $exe $@ -p $root_password_file -u $scm_user -w $cwd $opt_ssh_auth_sock -P "$PATH" $opts + ssh="$ssh $ssh_identity" + $ssh -l root localhost $l32 /bin/bash $trace $exe $@ $trace -p $root_password_file -u $scm_user -w $cwd $opt_ssh_auth_sock -P "$PATH" $opts exit $? fi