ack/TakeAction

126 lines
2.3 KiB
Plaintext
Raw Normal View History

1985-02-15 22:53:13 +00:00
case $# in
0) PAR='make install && make clean' ; CMD=Action ;;
1985-02-15 22:53:13 +00:00
1) PAR="$1" ; CMD=Action ;;
2) PAR="$1" ; CMD="$2" ;;
*) echo Syntax: "$0" [command [file]] ; exit 1 ;;
1985-02-15 22:53:13 +00:00
esac
if test -r "$CMD"
then :
else
case "$CMD" in
Action) echo No Action file present ;;
*) echo No Action file "($CMD)" present ;;
esac
fi
1991-10-16 13:36:54 +00:00
case $0 in
/*) THISFILE=$0
;;
*) THISFILE=`pwd`/$0
;;
esac
1985-02-15 22:53:13 +00:00
SYS=
RETC=0
{ while read LINE
do
eval set $LINE
case x"$1" in
x!*) ;;
1985-02-15 22:53:13 +00:00
xname) SYS="$2"
ACTION='$PAR'
1985-02-15 22:53:13 +00:00
DIR=.
1985-02-17 22:01:03 +00:00
FM=no
1985-02-15 22:53:13 +00:00
FAIL='Failed for $SYS, see $DIR/Out'
SUCC='$SYS -- done'
ATYPE=
FATAL=no
DOIT=yes
;;
xfatal) FATAL=yes ;;
xaction|xindir) case x$ATYPE in
1985-02-17 22:01:03 +00:00
x) ACTION=$2 ; ATYPE=$1
case $ATYPE$FM in
indirno) FAIL='Failed for $SYS' ;;
esac
;;
1985-02-15 22:53:13 +00:00
*) echo Already specified an $ATYPE for this name
1985-02-17 22:01:03 +00:00
RETC=65 ;;
1985-02-15 22:53:13 +00:00
esac ;;
1985-02-17 22:01:03 +00:00
xfailure) FM=yes
FAIL="$2" ;;
1985-02-15 22:53:13 +00:00
xsuccess) SUCC="$2" ;;
xdir) DIR="$2" ;;
xsystem) PAT="$2"
oIFS=$IFS
IFS="|"
eval set $2
case x`ack_sys` in
x$1|x$2|x$3|x$4|x$5|x$6|x$7) ;;
*) echo "Sorry, $SYS can only be made on $PAT systems"
1985-02-15 22:53:13 +00:00
DOIT=no
;;
esac
IFS=$oIFS
;;
1985-02-15 22:53:13 +00:00
xend) case $DOIT in
no) continue ;;
esac
case x$SYS in
1985-02-17 22:01:03 +00:00
x) echo Missing name line; RETC=65 ;;
1985-02-15 22:53:13 +00:00
*) if test -d $DIR
then (
cd $DIR
X=
case $ATYPE in
indir)
1988-04-29 09:15:01 +00:00
if sh $THISFILE "$PAR" $ACTION
1985-02-15 22:53:13 +00:00
then eval echo $SUCC
else RETC=2 ; eval echo $FAIL
fi ;;
*)
case "$ACTION" in
'$PAR') ACTION="$PAR"
;;
*) ;;
esac
if eval "{ $ACTION ; } >Out 2>&1 </dev/null"
1985-02-15 22:53:13 +00:00
then eval echo $SUCC
else RETC=1 ; X=: ; eval echo $FAIL
fi
;;
esac
(echo ------- `pwd`
cat Out
$X rm -f Out
) 2>/dev/null 1>&- 1>&3
exit $RETC
)
case $? in
0) ;;
*) case $RETC in
0) RETC=$? ;;
esac ;;
esac
else
echo Directory $DIR for $SYS is inaccessible
1985-02-17 22:01:03 +00:00
RETC=66
1985-02-15 22:53:13 +00:00
fi ;;
esac
case $FATAL$RETC in
yes0) ;;
yes*) echo Fatal error, installation stopped.
exit $RETC ;;
esac
SYS=
;;
*) echo Unknown keyword "$1"
1985-02-17 22:01:03 +00:00
RETC=67 ;;
1985-02-15 22:53:13 +00:00
esac
done
1985-02-17 22:01:03 +00:00
exit $RETC
1985-02-15 22:53:13 +00:00
} <$CMD
RETX=$?
case $RETX in
0) exit $RETC ;;
*) exit $RETX ;;
esac