tags #411823 confirmed thanks On Wed, Feb 21, 2007 at 09:48:54AM +0100, P.M. van Aalten wrote: > When running /etc/cron.daily/aide from the command line as root, I get: > ./aide: line 342: CHANGES: unbound variable
Ouch. Can you please try the attached patch against the cron script? Greetings Marc -- ----------------------------------------------------------------------------- Marc Haber | "I don't trust Computers. They | Mailadresse im Header Mannheim, Germany | lose things." Winona Ryder | Fon: *49 621 72739834 Nordisch by Nature | How to make an American Quilt | Fax: *49 621 72739835
Index: debian/cron.daily/aide =================================================================== --- debian/cron.daily/aide (revision 628) +++ debian/cron.daily/aide (working copy) @@ -5,6 +5,13 @@ # trap handler +FQDN="$(hostname -f)" +if [ -z "$FQDN" ]; then + echo >&2 "error determining FQDN: hostname -f does not give output" + hostname -f >&2 + exit 1 +fi + traphandler() { trap - INT ERR if [ -n "${LOCKED:-}" ]; then @@ -34,7 +41,6 @@ TMPDIRIN="$TMPBASE/cron.daily" AIDEARGS="-V4" -FQDN="$(hostname -f)" MAILSUBJ="Daily AIDE report for $FQDN" DATE="$(date +"%Y-%m-%d %H:%M")" @@ -163,7 +169,7 @@ if [ -n "${ARETVAL:-}" ]; then ARETEXPL="" ARETERR="" - PREFIX="$(printf "AIDE returned with a %d exit code. " "$ARETVAL")" + PREFIX="$(printf "AIDE returned with exit code %d. " "$ARETVAL")" case "$ARETVAL" in -1) PREFIX="" @@ -211,6 +217,7 @@ unset PREFIX else ARETEXPL="ARETVAL not initialized. cron job was aborted prematurely." + ARETVAL=255 echo $ARETEXPL | frame >> "$LOGFILE" echo $ARETEXPL | frame >> "$MAILFILE" unset ARETEXPL @@ -339,7 +346,7 @@ printf >> "$LOGFILE" "End of AIDE daily cron job at %s, run time %d seconds\n" "$(date +"at %Y-%m-%d %H:%M")" "$(( $(date +%s) - $BEGINTIME ))" # send mail if changes or errors were detected or quiet reports not requested - if [ "$QUIETREPORTS" = "no" ] || [ "$CHANGES" != "0" ] || [ $(< "$ERRORLOG" wc -l) -ne 0 ]; then + if [ "$QUIETREPORTS" = "no" ] || [ "$ARETVAL" != "0" ] || [ $(< "$ERRORLOG" wc -l) -ne 0 ]; then < "$MAILFILE" /usr/bin/mail -s "$MAILSUBJ" "$MAILTO" fi Index: debian/aide.conf.d/31_aide_apt =================================================================== --- debian/aide.conf.d/31_aide_apt (revision 628) +++ debian/aide.conf.d/31_aide_apt (working copy) @@ -34,9 +34,12 @@ echo "$LISTSDIR/${HOST}${HOSTPATH}_dists_${dist}_${c}_binary-@@{ARCH}_Packages(\.IndexDiff)?$ VarFile" # this is a compatibility hack for sarge if dpkg --compare-versions $APT_VERS gt 0.5.28.6; then + # > sarge echo "$LISTSDIR/${HOST}${HOSTPATH}_dists_${dist}_Release(\.gpg)?$ VarFile" else + # sarge echo "$LISTSDIR/${HOST}${HOSTPATH}_dists_${dist}_${c}_binary-@@{ARCH}_Release(\.gpg)?$ VarFile" + echo "$ARCHIVESDIR/lock$ VarDir" fi done elif [ "$deb" = "deb-src" ]; then