diff options
author | Eugeni Dodonov <eugeni@mandriva.org> | 2009-06-26 19:20:26 +0000 |
---|---|---|
committer | Eugeni Dodonov <eugeni@mandriva.org> | 2009-06-26 19:20:26 +0000 |
commit | 3a9bf59ac1e16b1c4a954488e7daa6804a0f7832 (patch) | |
tree | b2284a9297a770bd9e181cd2d54e0597f16efd05 /cron-sh/functions.sh | |
parent | d9bf87b0e6b62b1aee9c2d2e89a7db7cd58a52d3 (diff) | |
download | msec-3a9bf59ac1e16b1c4a954488e7daa6804a0f7832.tar msec-3a9bf59ac1e16b1c4a954488e7daa6804a0f7832.tar.gz msec-3a9bf59ac1e16b1c4a954488e7daa6804a0f7832.tar.bz2 msec-3a9bf59ac1e16b1c4a954488e7daa6804a0f7832.tar.xz msec-3a9bf59ac1e16b1c4a954488e7daa6804a0f7832.zip |
Improved diff checks.
Diffstat (limited to 'cron-sh/functions.sh')
-rw-r--r-- | cron-sh/functions.sh | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/cron-sh/functions.sh b/cron-sh/functions.sh index 594d703..43d0820 100644 --- a/cron-sh/functions.sh +++ b/cron-sh/functions.sh @@ -40,16 +40,16 @@ FILTER="\(`echo $EXCLUDEDIR | sed -e 's/ /\\\|/g'`\)" Diffcheck() { TODAY="$1" YESTERDAY="$2" - DIFF="$3" + DAY_DIFF="$3" MESSAGE="$4" if [[ -f ${YESTERDAY} ]]; then - if ! diff -u ${YESTERDAY} ${TODAY} > ${DIFF}; then + if ! diff -u ${YESTERDAY} ${TODAY} > ${DAY_DIFF}; then printf "\nSecurity Warning: change in $MESSAGE found :\n" >> ${DIFF} - grep '^+' ${DIFF} | grep -vw "^+++ " | sed 's|^.||'|sed -e 's/%/%%/g' | while read file; do - printf "\t\t- Newly added $MESSAGE : ${file}\n" + grep '^+' ${DAY_DIFF} | grep -vw "^+++ " | sed 's|^.||'|sed -e 's/%/%%/g' | while read file; do + printf "\t\t- Added $MESSAGE : ${file}\n" done >> ${DIFF} - grep '^-' ${DIFF} | grep -vw "^--- " | sed 's|^.||'|sed -e 's/%/%%/g' | while read file; do - printf "\t\t- No longer present $MESSAGE : ${file}\n" + grep '^-' ${DAY_DIFF} | grep -vw "^--- " | sed 's|^.||'|sed -e 's/%/%%/g' | while read file; do + printf "\t\t- Removed $MESSAGE : ${file}\n" done >> ${DIFF} fi fi |