| version 1.1, 2002/05/20 16:25:21 |
version 1.2, 2002/06/15 13:21:27 |
|
|
| #!/bin/bash |
#!/bin/bash |
| |
|
| # Author: Lubomir Host 'rajo' <host8 AT pauli.fmph.uniba.sk> |
# Author: Lubomir Host 'rajo' <host8 AT pauli.fmph.uniba.sk> |
| # Description: Use this script if you will be noticed about package |
# |
| # changes. E.g. put to your crontab appropiate line. |
# Description: Use this script if you will be noticed about changes |
| |
# in installation of packages in your system. |
| |
# You may put sufropiate line to your crontab. |
| |
# |
| |
# Usage: Use ./packages-log.sh --help to see help message |
| |
# |
| |
|
| # $Id$ |
# $Id$ |
| |
|
|
|
| fi |
fi |
| } |
} |
| |
|
| LOG="$HOME/crontab/packages/`previous 0`" |
directory="." |
| PREVIOUS_LOG="$HOME/crontab/packages/`previous 1`" |
suffix="" |
| OLD_LOG="$HOME/crontab/packages/`previous 2`" |
|
| DIFF_LOG="$HOME/crontab/packages/`previous 1`-`previous 0`.diff" |
# Cmdline parsing {{{ |
| |
for option |
| |
do |
| |
# If the previous option needs an argument, assign it. |
| |
if test -n "$prev"; then |
| |
eval "$prev=\$option" |
| |
prev= |
| |
continue |
| |
fi |
| |
|
| |
case "$option" in |
| |
-*=*) optarg=`echo "$option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; |
| |
*) optarg= ;; |
| |
esac |
| |
|
| |
case "$option" in |
| |
--directory | --director | --directo | --direct | --direc | --dire | \ |
| |
--dir | --di | --d | -d) |
| |
prev=directory ;; |
| |
--directory=* | --director=* | --directo=* | --direct=* | --direc=* | --dire=* | \ |
| |
--dir=* | --di=* | --d=* | -d=*) |
| |
directory="$optarg" ;; |
| |
|
| |
--suffix | --suffi | --suff | --suf | --su | --s | -s) |
| |
prev=suffix ;; |
| |
--suffix=* | --suffi=* | --suff=* | --suf=* | --su=* | --s=* | -s=*) |
| |
suffix="$optarg" ;; |
| |
|
| |
-help | --help | --hel | --he | --h | -h) |
| |
cat << EOF |
| |
Usage: ./packages-log.sh [-d DIR] [--suffix SUFFIX] |
| |
|
| |
--directory=DIR Set output directory to Directory |
| |
--suffix=SUFFIX Add suffix to logfiles. Use this if you wish |
| |
keep some logfiles. Parameter is added |
| |
to the name of logfile |
| |
EOF |
| |
;; |
| |
|
| |
-*) { echo "error: $option: invalid option; use --help to show usage" 1>&2; exit 1; } |
| |
;; |
| |
|
| |
esac |
| |
done |
| |
# Cmdline parsing }}} |
| |
|
| |
LOG="$directory/`previous 0`$suffix" |
| |
PREVIOUS_LOG="$directory/`previous 1`$suffix" |
| |
OLD_LOG="$directory/`previous 2`$suffix" |
| |
DIFF_LOG="$directory/`previous 1`-`previous 0`$suffix.diff" |
| |
|
| # If you have 'dpkg', probably you are on Linux Debian. |
# If you have 'dpkg', probably you are on Linux Debian. |
| # If dpkg not found (or not executable), use rpm |
# If dpkg not found (or not executable), use rpm |
|
|
| fi |
fi |
| |
|
| # save today's list of packages |
# save today's list of packages |
| $PACKAGER > $LOG |
$PACKAGER > "$LOG" |
| |
|
| # compare with previous log |
# compare with previous log |
| if [ -f "$LOG" -a -f "$PREVIOUS_LOG" ]; then |
if [ -f "$LOG" -a -f "$PREVIOUS_LOG" ]; then |