From b01a58ecc55f7e9d43a34428a0d50c41f7f192f2 Mon Sep 17 00:00:00 2001 From: krempaska Date: Tue, 10 Mar 2009 17:25:45 +0000 Subject: [PATCH] now it works also for hipa, the call of chkslsbase.sh script was replaced by the awk call which does exectly like this script --- App/scripts/bootlink | 37 ++++++++++++++++++++++++++++--------- 1 file changed, 28 insertions(+), 9 deletions(-) diff --git a/App/scripts/bootlink b/App/scripts/bootlink index 3699c71..fdd96a5 100755 --- a/App/scripts/bootlink +++ b/App/scripts/bootlink @@ -1,11 +1,11 @@ #!/bin/sh ############################################################################### # $Author: krempaska $ -# $Date: 2009/01/16 13:41:02 $ -# $Id: bootlink,v 1.8 2009/01/16 13:41:02 krempaska Exp $ +# $Date: 2009/03/10 17:25:45 $ +# $Id: bootlink,v 1.9 2009/03/10 17:25:45 krempaska Exp $ # $Name: $ # $Source: /cvs/G/DRV/misc/App/scripts/bootlink,v $ -# $Revision: 1.8 $ +# $Revision: 1.9 $ ############################################################################### # File name: # Description: creates a new link to the IOC booting directory @@ -67,7 +67,7 @@ function do_slink () { ls -l /ioc/$ioc fi else - echo "Target directory \"$tdir\" does not exist" + echo "Target directory \"$tdir\" does not exist, no link has been done." fi done return @@ -144,7 +144,7 @@ function get_gw () { esac } -if [ "$1" = "-v" ];then echo "\$Header: /cvs/G/DRV/misc/App/scripts/bootlink,v 1.8 2009/01/16 13:41:02 krempaska Exp $";exit;fi +if [ "$1" = "-v" ];then echo "\$Header: /cvs/G/DRV/misc/App/scripts/bootlink,v 1.9 2009/03/10 17:25:45 krempaska Exp $";exit;fi #calling from the script $1=action: do_slink, $2=target, $3=bootpc, $4=ioc1, $5=ioc2,... if [ $# > 3 ] && [ "$1" = "do_slink" ] @@ -156,7 +156,7 @@ then #cut the domain part of the hname hname=$(echo $hname|awk 'BEGIN {FS="."} {print $1}') bootpc=$2 - echo $bootpc + #echo $bootpc #for slsbpc (slsbpc1/2) cluster exception if [ $hname = "slsbpc2" ] || [ $hname = "slsbpc1" ];then hname="slsbpc";fi @@ -183,8 +183,24 @@ fi targetbase=$1 #chkslsbase.sh checks if the bootdirectory specified in the $1 argument is valid #it has to be one of $SLSBASELIST or $INSTBASELIST -#to do: rename chkslsbase.sh, define $INSTBASE also in the SLS environment -if [ "$(chkslsbase.sh $targetbase)" = "" ] && [ "$targetbase" != "-" ] +#check if the requested directory is defined in one of the environment +#variables $*LIST +in_list=$(awk -vb="${*%/}" -vl="$SLSBASELIST $INSTBASELIST $PSIXFELBASELIST" ' + BEGIN{ + split(b,s) + for (j in s) { + split(l,f) + for (i in f) { + if (f[i] == s[j]) { + print f[i] + exit + } + } + } + }') + +#if [ "$(chkslsbase.sh $targetbase)" = "" ] && [ "$targetbase" != "-" ] +if [ $in_list = "" ] && [ "$targetbase" != "-" ] then echo -ne "first argument (\"$targetbase\") has to be one out of\n$SLSBASELIST\t$INSTBASELIST\n" exit @@ -325,7 +341,7 @@ case "$NET" in then do_slink $targetbase $* fi - echo "on work!"; + ssh $bootpc /hipa/prod/bin/bootlink do_slink $bootpc $targetbase $* ;; 129.129.153.*) echo "You are on PROSCAN subnet $NET"; @@ -350,6 +366,9 @@ exit ############################################################################### # # $Log: bootlink,v $ +# Revision 1.9 2009/03/10 17:25:45 krempaska +# now it works also for hipa, the call of chkslsbase.sh script was replaced by the awk call which does exectly like this script +# # Revision 1.8 2009/01/16 13:41:02 krempaska # fixed for SLS machine #