ack/TakeAction
ceriel 91b39c7df7 Replaced comment char '#' with '!'.
Some shells use # as a comment char.
1987-03-23 21:01:36 +00:00

110 lines
2 KiB
Plaintext
Executable file

case $# in
0) PAR=install ; CMD=Action ;;
1) PAR="$1" ; CMD=Action ;;
2) PAR="$1" ; CMD="$2" ;;
*) echo Syntax: "$0" [param [file]] ; exit 1 ;;
esac
if test -r "$CMD"
then :
else
case "$CMD" in
Action) echo No Action file present ;;
*) echo No Action file "($CMD)" present ;;
esac
fi
THISFILE=`pwd`/$0
SYS=
RETC=0
{ while read LINE
do
eval set $LINE
case x"$1" in
x!*) ;;
xname) SYS="$2"
ACTION='make $PAR'
DIR=.
FM=no
FAIL='Failed for $SYS, see $DIR/Out'
SUCC='$SYS -- done'
ATYPE=
FATAL=no
DOIT=yes
;;
xfatal) FATAL=yes ;;
xaction|xindir) case x$ATYPE in
x) ACTION=$2 ; ATYPE=$1
case $ATYPE$FM in
indirno) FAIL='Failed for $SYS' ;;
esac
;;
*) echo Already specified an $ATYPE for this name
RETC=65 ;;
esac ;;
xfailure) FM=yes
FAIL="$2" ;;
xsuccess) SUCC="$2" ;;
xdir) DIR="$2" ;;
xsystem) case `ack_sys` in
$2) ;;
*) echo "Sorry, $SYS can only be made on $2 systems"
DOIT=no
;;
esac ;;
xend) case $DOIT in
no) continue ;;
esac
case x$SYS in
x) echo Missing name line; RETC=65 ;;
*) if test -d $DIR
then (
cd $DIR
X=
case $ATYPE in
indir)
if sh $THISFILE $PAR $ACTION
then eval echo $SUCC
else RETC=2 ; eval echo $FAIL
fi ;;
*)
if eval "$ACTION >Out 2>&1 </dev/null"
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
RETC=66
fi ;;
esac
case $FATAL$RETC in
yes0) ;;
yes*) echo Fatal error, installation stopped.
exit $RETC ;;
esac
SYS=
;;
*) echo Unknown keyword "$1"
RETC=67 ;;
esac
done
exit $RETC
} <$CMD
RETX=$?
case $RETX in
0) exit $RETC ;;
*) exit $RETX ;;
esac