From: Patrick M. <ume...@us...> - 2006-11-30 02:03:46
|
Update of /cvsroot/radmind/radmind In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv12400 Modified Files: Tag: radmind-1-7-1-branch ra.sh Log Message: Added ra.sh revision 1.34 from main trunk for 1.7.2 release. Includes fixes for using TMPDIR (1.34), exiting on EOF (1.33 & 1.32 ), an infinite loop (1.32) and processing postapply scripts (1.32). Index: ra.sh =================================================================== RCS file: /cvsroot/radmind/radmind/ra.sh,v retrieving revision 1.31 retrieving revision 1.31.2.1 diff -C2 -d -r1.31 -r1.31.2.1 *** ra.sh 19 Jul 2006 20:17:51 -0000 1.31 --- ra.sh 30 Nov 2006 02:03:41 -0000 1.31.2.1 *************** *** 26,29 **** --- 26,30 ---- EDITOR=${EDITOR:-vi} USER=${SUDO_USER:-$USER} + TMPDIR="${TMPDIR:=/tmp}" DEFAULTS="/etc/defaults/radmind" FSDIFFROOT="." *************** *** 41,47 **** MKTEMP="_RADMIND_MKTEMP" TEMPFILES=FALSE ! TMPDIR="/tmp/.ra.$$" ! if [ -f "${MKTEMP}" ]; then ! TMPDIR=`${MKTEMP} -qd /tmp/.ra.$$.XXXXXX` if [ $? -ne 0 ]; then echo "mktemp failed" --- 42,48 ---- MKTEMP="_RADMIND_MKTEMP" TEMPFILES=FALSE ! RASHTMP="${TMPDIR}/.ra.$$" ! if [ -f "${MKTEMP}" ]; then ! RASHTMP=`${MKTEMP} -qd "${TMPDIR}/.ra.$$.XXXXXX"` if [ $? -ne 0 ]; then echo "mktemp failed" *************** *** 49,54 **** fi fi ! LTMP="${TMPDIR}/lapply.out" ! FTMP="${TMPDIR}/fsdiff.out" # different systems use different default dirs --- 50,55 ---- fi fi ! LTMP="${RASHTMP}/lapply.out" ! FTMP="${RASHTMP}/fsdiff.out" # different systems use different default dirs *************** *** 63,66 **** --- 64,70 ---- echo -n "$*" "[Yn] " read ans + if [ $? -ne 0 ]; then + return 0 + fi if [ -z "$ans" -o X"$ans" = Xy -o X"$ans" = XY -o X"$ans" = Xyes ]; then return 1 *************** *** 84,91 **** cleanup() { if [ "$TEMPFILES" = FALSE ]; then ! rm -fr "${TMPDIR}" fi } dopreapply() { if [ -d ${PREAPPLY} ]; then --- 88,100 ---- cleanup() { if [ "$TEMPFILES" = FALSE ]; then ! rm -fr "${RASHTMP}" fi } + cleanup_and_exit() { + cleanup + exit 1 + fi + dopreapply() { if [ -d ${PREAPPLY} ]; then *************** *** 199,202 **** --- 208,215 ---- read ans + if [ $? -ne 0 ]; then + cleanup_and_exit + fi + case "${ans}" in a|A) *************** *** 219,222 **** --- 232,236 ---- *) ;; + esac done *************** *** 245,249 **** Yn "Run post-apply scripts on difference transcript?" if [ $? -eq 1 ]; then ! dopostapply ${FMTP} fi elif [ x"$opt" != x"interactive" ]; then --- 259,263 ---- Yn "Run post-apply scripts on difference transcript?" if [ $? -eq 1 ]; then ! dopostapply ${FTMP} fi elif [ x"$opt" != x"interactive" ]; then *************** *** 311,318 **** cd / ! if [ ! -d ${TMPDIR} ]; then ! mkdir -m 700 ${TMPDIR} if [ $? -ne 0 ]; then ! echo "Cannot create temporary directory $TMPDIR" exit 1 fi --- 325,332 ---- cd / ! if [ ! -d "${RASHTMP}" ]; then ! mkdir -m 700 "${RASHTMP}" if [ $? -ne 0 ]; then ! echo "Cannot create temporary directory $RASHTMP" exit 1 fi *************** *** 320,324 **** # Trap meaningful signals ! trap cleanup HUP INT PIPE QUIT TERM TRAP XCPU XFSZ case "$1" in --- 334,338 ---- # Trap meaningful signals ! trap cleanup_and_exit HUP INT PIPE QUIT TERM TRAP XCPU XFSZ case "$1" in *************** *** 394,398 **** TNAME=`hostname | cut -d. -f1`-`date +%Y%m%d`-${USER}.T fi ! FTMP="${TMPDIR}/${TNAME}" fsdiff -C ${CASE} ${FPROGRESS} ${CHECKSUM} -o ${FTMP} ${FSDIFFROOT} if [ $? -ne 0 ]; then --- 408,412 ---- TNAME=`hostname | cut -d. -f1`-`date +%Y%m%d`-${USER}.T fi ! FTMP="${RASHTMP}/${TNAME}" fsdiff -C ${CASE} ${FPROGRESS} ${CHECKSUM} -o ${FTMP} ${FSDIFFROOT} if [ $? -ne 0 ]; then |