cron-apt-0.9.2/0000775000000000000000000000000012147751773010153 5ustar cron-apt-0.9.2/test/0000775000000000000000000000000012147751773011132 5ustar cron-apt-0.9.2/test/action.d/0000775000000000000000000000000012147751773012631 5ustar cron-apt-0.9.2/test/action.d/5-t0000664000000000000000000000000011173250415013130 0ustar cron-apt-0.9.2/test/action.d/2-t0000664000000000000000000000002611173250415013135 0ustar install twinspot-base cron-apt-0.9.2/test/action.d/0-t0000664000000000000000000000000711173250414013131 0ustar update cron-apt-0.9.2/test/action.d/1-t0000664000000000000000000000000011173250415013124 0ustar cron-apt-0.9.2/test/config0000664000000000000000000000140411173250415012302 0ustar # Configuration for cron-apt. # The cron config is located in /etc/cron.d/cron-apt # This shows the defaults. # # The directory where the actions is stored. ACTIONDIR=test/action.d # The file that contains error messages, and current run information # when still running the script. ERROR=test/error # The loggfile. LOG=test/log # The email address to send mail to. MAILTO=ola@inguza.com # Value: error (send mail on error runs) # always (always send mail) # (else never send mail) # MAILON=error # MAILON=always # Value: error (exit on error only) # (else never exit) # EXITON=error # EXITON=error # Value: verbose (log everything) # error (log error runs only) # (else log nothing) # DEBUG=verbose cron-apt-0.9.2/test/Makefile0000664000000000000000000000005111237732374012561 0ustar all: install: clean: test: ./test.sh cron-apt-0.9.2/test/test.sh0000775000000000000000000000254211173250415012434 0ustar #!/bin/sh # DocumentId: $Id: cron-apt 2439 2007-08-02 15:59:24Z ola $ # # Copyright (C) 2007-2008 Ola Lundqvist # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, # MA 02110-1301 USA. . ../src/functions # Testing of herevariables_store and restore. A="test a b" A_HERE="gnarg e" echo -n "PRECHECK: " if [ "$A, $A_HERE, $A_STORED" = "test a b, gnarg e, " ] ; then echo "PASSED" else echo FAILED fi echo -n "HERE_STORE: " herevariables_store HERE STORED if [ "$A, $A_HERE, $A_STORED" = "gnarg e, , test a b" ] ; then echo "PASSED" else echo FAILED fi echo -n "HERE_RESTORE: " herevariables_restore STORED "" if [ "$A, $A_HERE, $A_STORED" = "test a b, , " ] ; then echo "PASSED" else echo FAILED fi cron-apt-0.9.2/src/0000775000000000000000000000000012147751773010742 5ustar cron-apt-0.9.2/src/cron-apt0000775000000000000000000004121612147751740012411 0ustar #!/bin/sh # DocumentId: $Id: cron-apt 2707 2013-05-24 20:55:56Z ola $ # # Copyright (C) 2002-2011,2013 Ola Lundqvist # Copyright (C) 2004-2011,2013 Marc Haber # Copyright (C) 2004,2007,2013 Bob Proulx # Copyright (C) 2004 Marc Sherman # Copyright (C) 2004 David Weinehall # Copyright (C) 2003 Sean Finney # Copyright (C) 2002 Marcel Kolaja # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, # MA 02110-1301 USA. # # Changes: # 2013-05-24 Ola Lundqvist # Applied a patch from Marc Haber # to handle the case when cksum return a shorter string than # four digits. See Debian bug #689914 for more information. # Using suggestions from Bob Proulx # the solution was changed to use awk instead of cut. # In addition to that awk is used to generate random data in # the case /dev/urandom is not available. # This is a modified version of the code Bob suggested but using # nanoseconds instead of minutes and seconds. # 2011-11-03 Ola Lundqvist # Applied a patch from Marc Haber # so that the $OPTIONS variable is now included in debug output. # 2011-03-21 Ola Lundqvist # Correction so that also very long apt commands can be # managed properly. # 2009-03-24 Ola Lundqvist # Correction so that it do syslog instead of sending mail # when the syslog parameter is set to changes. Thanks to # Boris Trautmann for spotting this problem. # 2007-08-02 Ola Lundqvist # Added support for *_HERE variables in the action.d files. # They are copied to the * variable before the action loop # and then restored in the end of the loop. # Marc Haber gave the idea to have variables that are applicable # for only the action item. # Also moved out the functions so they can be tested separately. # 2007-08-01 Ola Lundqvist # Changed so that the tmp size checking is done later. # 2007-07-31 Ola Lundqvist # Based on a patch from Marc Haber # cron-apt now fail more gracefully if the mail command is not # available. # Applied patch from Marc Haber to # make a more graceful check if the tmp directory is full. # Modified the patch so it is configurable. # 2007-07-21 Bob Proulx , Ola Lundqvist # Correction of MAILONMSGSDIR and SYSLOGONMSGSDIR. # 2007-07-06 Ola Lundqvist # Check refrain file even after sleep. # 2006-11-26 Ola Lundqvist # Corrected stupid syntax error. # 2006-11-23 Ola Lundqvist # Make sure that initlog is removed on exit. # 2006-04-30 Marc Haber # Move dotlock code so that now the entire cron-apt run # is protected by locking # 2005-10-09 Marc Haber # Add $APTCOMMAND to the CRON-APT line output. # 2005-10-07 Ola Lundqvist # Changed name for DIFF ignore option. # 2005-10-07 Marc Haber # Support for DIFF ignore directive and better hostname handling. # 2005-04-20 Ola Lundqvist # Modified refrain file system to make file name configurable. # 2005-04-20 Marc Haber # Added support for refrain file. # 2004-12-25 Marc Sherman # Added configurable support for aptitude instead of apt-get. # 2004-09-23 Ola Lundqvist # Escaped changes file data so '/' can be used in action.d lines. # 2004-09-19 Marc Haber # Add warning if dotlockfile not found. # 2004-09-12 Ola Lundqvist # Modified patch from Marc Haber to avoid symlink attacks. # Also use nicer cleaning. # 2004-09-12 Marc Haber # Patch to have multiple cron-apt running at the same time # without messing up the changelog. # 2004-09-07 Marc Haber # Patch to achieve run-parts behaviour. # 2004-08-13 Ola Lundqvist # Bugfixes. # Made *ON=changes available to more than only mail. # 2004-08-12 Ola Lundqvist # Added support for mailon=changes. # Marc Haber give me the patch # that I have modified. # Fixed some other bugs that was introduced by me. # Added support for syslogon. # 2004-08-09 Ola Lundqvist # Cleaned up some code and fixed a minor logging bug. # Better argument checking code. Can now handle more than # one option. # Changed from status passing from echo to file. # Fixed so that stdout argument really works. # 2004-08-08 Ola Lundqvist # Fixed variable bug. # Cleaned up the code. # Fixed output function framework so it works as expected. # Better option handling and local output option. # 2004-07-22 Ola Lundqvist # Made it more POSIX compliant by using /dev/random if the # RANDOM variable do not contain a value. Thanks to # Bob Proulx and David Weinehall for the idea. # Also changed -a and -o to && and ||, as Bob suggested. # 2003-07-10 Ola Lundqvist # Always run even if there was an error last time is now the # default. Fix so that you can write RUNSLEEP=0 too. # 2003-07-10 Ola Lundqvist # Added runsleep configuration option. # Now cron-apt is aware of the DEBIAN_FRONTEND = noninteractive # ENVIRONMENT. # 2003-07-10 Ola Lundqvist # Patch for mailon=output option from Sean Finney # . # 2003-04-17 Ola Lundqvist # Added mailon=output option using patch from Sean Finney # . # 2002-08-14 Ola Lundqvist # Implemented mail on upgrade only using patches from Marcel Kolaja # . Thanks a lot for these patches. # 2002-04-07 Ola Lundqvist # Added skipping of comment lines in action files. # Added exra config.d directory. # Rewrote the mail and log part to make it more flexible. # Christian Perrier was the # one that needed this flexibility. # Also added skipping of backup files (*~). # 2002-03-05 Ola Lundqvist # Made it complete so it can be released. # 2002-03-03 Ola Lundqvist # Wrote the beginning. # 2002-04-24 Ola Lundqvist # Added a default path. Thanks to Donovan Baarda # for pointing it out. export PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin UMASK_TIGHT="077" UMASK_APT="022" umask $UMASK_TIGHT ############################# arguments ####################################### STDOUT="" ALLCONFIGS="" while [ -n "$*" ] ; do if [ "$1" = "--help" ] ; then echo "USAGE: cron-apt [-i] [-s] [configfiles]" exit 0 elif [ "$1" = "-i" ] ; then RUNIMMEDIATELY="yes" shift elif [ "$1" = "-s" ] ; then DEBUG=always STDOUT=yes shift else CONFIG="$1" ALLCONFIGS="$ALLCONFIGS $CONFIG" shift fi done if [ -z "$CONFIG" ] ; then CONFIG=/etc/cron-apt/config ALLCONFIGS="$CONFIG" fi ############################## lib and tmp dirs ############################### LIBDIR="/var/lib/cron-apt" SHAREDIR="/usr/share/cron-apt" CONFIGDIRNAME="$(echo $CONFIG | sed 's|/|_-_|g')" TMPDIR=$(mktemp -d -t cron-apt.XXXXXX) if [ $? -ne 0 ]; then echo >&2 "Error: Can not create a safe temporary directory." exit 1 fi INITLOG="$TMPDIR/initlog" RUNERROR="$TMPDIR/runerror" RUNSYSLOG="$TMPDIR/runsyslog" RUNLOG="$TMPDIR/runlog" RUNMAIL="$TMPDIR/runmail" ACTIONERROR="$TMPDIR/actionerror" ACTIONSYSLOG="$TMPDIR/actionsyslog" ACTIONLOG="$TMPDIR/actionlog" ACTIONMAIL="$TMPDIR/actionmail" TEMP="$TMPDIR/temp" MAIL="$TMPDIR/mail" DIFF="$TMPDIR/difftemp" STATUS="$TMPDIR/status" LOCKFILE="$LIBDIR/lockfile" MAILCHDIR="$LIBDIR/$CONFIGDIRNAME/mailchanges" ERROR="$TMPDIR/$CONFIGDIRNAME-error" ############################## defaults ####################################### ACTIONDIR="/etc/cron-apt/action.d" ACTIONCONFDIR="/etc/cron-apt/config.d" MAILMSGDIR="/etc/cron-apt/mailmsg.d" MAILONMSGSDIR="/etc/cron-apt/mailonmsgs" SYSLOGONMSGSDIR="/etc/cron-apt/syslogonmsgs" REFRAINFILE="/etc/cron-apt/refrain" NOLOCKWARN="" ERRORMSGDIR="/etc/cron-apt/errormsg.d" SYSLOGMSGDIR="/etc/cron-apt/syslogmsg.d" LOGMSGDIR="/etc/cron-apt/logmsg.d" LOG="/var/log/cron-apt/log" DIFFONCHANGES="prepend" MAILTO="root" # error, always, never SYSLOGON="upgrade" # error, always MAILON="error" # error, never EXITON="error" # verbose, error DEBUG="verbose" # general options OPTIONS="-o quiet=1" # do always run as default DONTRUN="" # Random sleep time before run RUNSLEEP="3600" # Minimum amount of discspace needed in /tmp MINTMPDIRSIZE=10 # The command to use (can be aptitude instead) APTCOMMAND="/usr/bin/apt-get" # If HOSTNAME is non-empty, the contents will be used to generate the # e-mail subject for notifications sent out. If HOSTNAME is empty, the # output of $(uname -n) will be used. HOSTNAME="" # Ignore lines matching this regexp to determine whether changes occurred # for MAILON="changes". DIFFIGNORE="" # What to do with the diff when *ON=changes. # Value: prepend (prepend to the output) # append (append to the output) # only (only show the diff, not the output itself) # (else do nothing) DIFFONCHANGES=prepend export DEBIAN_FRONTEND="noninteractive" export LANG="C" export LC_ALL="C" # Read configuration. for cfg in $ALLCONFIGS; do if [ -f "$cfg" ] ; then . "$cfg" else echo >&2 "The config file $cfg does not exist." fi done if [ -t 0 ]; then RUNIMMEDIATELY="yes" fi if test "$RUNIMMEDIATELY" = "yes"; then RUNSLEEP= fi ############################## functions ###################################### . $SHAREDIR/functions ############################### check ######################################### if ! [ -d "$LIBDIR/$CONFIGDIRNAME" ]; then mkdir -p "$LIBDIR/$CONFIGDIRNAME" fi if ! [ -d "$MAILCHDIR" ]; then mkdir -p "$MAILCHDIR" fi ################## terminate if $REFRAINFILE exists ################## if [ -e "$REFRAINFILE" ]; then exit 0 fi # Check for space in tmp checktmpsize ############################### sleep ######################################### echo "CRON-APT RUN [$CONFIG]: $(date)" > "$INITLOG" if [ -n "$RUNSLEEP" ] ; then if [ $RUNSLEEP -gt 0 ] ; then if [ -z "$RANDOM" ] ; then # A fix for shells that do not have this bash feature. if [ -e /dev/urandom ] ; then RANDOM=$(dd if=/dev/urandom count=1 2> /dev/null | cksum | awk '{print$1}') else RANDOM=$(awk -v rs=$RUNSLEEP -v s=$$$(date +%N) 'BEGIN{srand(s);print(int(rs*rand()));}') fi fi TIME=$(($RANDOM % $RUNSLEEP)) sleep $TIME echo "CRON-APT SLEEP: $TIME, $(date)" >> "$INITLOG" # Check refrain file again if [ -e "$REFRAINFILE" ]; then exit 0 fi fi fi # Check for space in tmp again checktmpsize ################## try to take out a lock, terminate if unsuccessful ########## if [ -x /usr/bin/dotlockfile ] ; then if ! dotlockfile -l -p -r 10 $LOCKFILE; then # create log entry echo > $MAIL "cannot acquire cron-apt lock." onexit exit 1 fi else if [ -z "$NOLOCKWARN" ]; then echo > $TEMP "WARNING: dotlockfile not installed. If you don't want to see this" echo >> $TEMP " Warning any more, set NOLOCKWARN in the configuration file." createerrorinfo "startup" fi fi ################## initialize various log files ############################## cp "$INITLOG" "$RUNMAIL" cp "$INITLOG" "$RUNLOG" cp "$INITLOG" "$RUNSYSLOG" cp "$INITLOG" "$RUNERROR" rm -f "$INITLOG" ############################### script ######################################## # Always run onexit before exit. for ACTION in $(run_parts "$ACTIONDIR") ; do ACTIONF=$(echo $ACTION | sed "s|$ACTIONDIR/||") if [ -f "$ACTIONCONFDIR/$ACTIONF" ] ; then . "$ACTIONCONFDIR/$ACTIONF" fi echo "CRON-APT ACTION: $ACTIONF" > "$ACTIONERROR" echo "CRON-APT ACTION: $ACTIONF" > "$ACTIONMAIL" echo "CRON-APT ACTION: $ACTIONF" > "$ACTIONLOG" echo "CRON-APT ACTION: $ACTIONF" > "$ACTIONSYSLOG" herevariables_store cat "$ACTIONDIR/$ACTIONF" | \ sed -e "s/#.*$//;" | \ grep -v "^[[:space:]]*$" | { while read LINE ; do echo "CRON-APT LINE: $APTCOMMAND $OPTIONS $LINE" > "$TEMP" UMASK_SAVE=$(umask) umask $UMASK_APT $APTCOMMAND $OPTIONS $LINE >> $TEMP 2>&1 RET=$? umask $UMASK_SAVE if [ $RET -ne 0 ]; then # --- # An error has occured. createerrorinfo $ACTIONF # SYSLOG if [ "$SYSLOGON" = "error" ] || [ "$SYSLOGON" = "upgrade" ] ; then createsysloginfo $ACTIONF fi # MAIL if [ "$MAILON" = "error" ] || [ "$MAILON" = "upgrade" ] ; then createmailinfo $ACTIONF fi # DEBUG if [ "$DEBUG" = "error" ] ; then createloginfo $ACTIONF fi # EXIT if [ "$EXITON" = "error" ] ; then echo exit > "$STATUS" #exit fi else # --- # No error has occured. if grep -q 'The following packages will be upgraded' "$TEMP" ; then # --- # Upgrade has happend # SYSLOG if [ "$SYSLOGON" = "upgrade" ] ; then createsysloginfo $ACTIONF fi # MAIL if [ "$MAILON" = "upgrade" ] ; then createmailinfo $ACTIONF fi # DEBUG if [ "$DEBUG" = "upgrade" ] ; then createloginfo $ACTIONF fi fi fi # --- # Independent of error or not # SYSLOG if [ "$SYSLOGON" = "always" ] ; then createsysloginfo $ACTIONF fi # MAIL if [ "$MAILON" = "always" ] ; then createmailinfo $ACTIONF fi # DEBUG if [ "$DEBUG" = "verbose" ] || [ "$DEBUG" = "always" ] ; then createloginfo $ACTIONF fi if grep -qvE '^[[:space:]]*$|CRON-APT' "$TEMP"; then # --- # Now we have output if [ "$SYSLOGON" = "output" ]; then createsysloginfo $ACTIONF fi if [ "$MAILON" = "output" ]; then createmailinfo $ACTIONF fi if [ "$DEBUG" = "upgrade" ] ; then createloginfo $ACTIONF fi fi TLINE=$(echo "$LINE" | md5sum | sed -e "s/[[:space:]].*//;") if [ -n "$DIFFIGNORE" ]; then DIFFIGNORELINE="--ignore-matching-lines=$DIFFIGNORE" fi if [ ! -r "$MAILCHDIR/$ACTIONF-$TLINE" ] || ! diff $DIFFIGNORELINE -u "$MAILCHDIR/$ACTIONF-$TLINE" "$TEMP" > "$DIFF" ; then cp "$TEMP" "$MAILCHDIR/$ACTIONF-$TLINE" # What to do with diff # OBS! FROM NOW ON "$TEMP" CAN HAVE DIFF INFORMATION IN IT! if [ -n "$DIFF" ] && [ -r "$DIFF" ] ; then if [ "$DIFFONCHANGES" = "only" ] ; then cp "$DIFF" "$TEMP" elif [ "$DIFFONCHANGES" = "append" ] ; then cat "$DIFF" >> "$TEMP" elif [ "$DIFFONCHANGES" = "prepend" ] ; then echo "----- DIFF END HERE -----" >> "$DIFF" cat "$TEMP" >> "$DIFF" mv "$DIFF" "$TEMP" fi rm -f "$DIFF" fi # --- # We have changes # MAIL if [ "$MAILON" = "changes" ] ; then createmailinfo $ACTIONF fi # SYSLOG if [ "$SYSLOGON" = "changes" ] ; then createsysloginfo $ACTIONF fi # DEBUG if [ "$DEBUG" = "changes" ] ; then createloginfo $ACTIONF fi fi done #exit } if [ -e "$STATUS" ] ; then if grep exit "$STATUS" > /dev/null 2>&1 ; then rm -f "$STATUS" onexit exit fi rm -f "$STATUS" fi herevariables_restore done onexit cron-apt-0.9.2/src/functions0000664000000000000000000001676611655075222012704 0ustar # DocumentId: $Id: cron-apt 2438 2007-08-02 15:25:04Z ola $ # # Copyright (C) 2002-2011 Ola Lundqvist # Copyright (C) 2009 Edward Malone # Copyright (C) 2007 Bob Proulx # Copyright (C) 2004,2005,2007 Marc Haber # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, # MA 02110-1301 USA. # # Changes: # 2011-11-05 Ola Lundqvist # No warning message will be printed to tell that there is no # mail command available when MAILON is set to 'never' or empty # string. # 2009-05-12 Ola Lundqvist # Add support for mail headers using suggested code from # Edward Malone # 2007-08-09 Ola Lundqvist # Avoid overflow in directory size calculation when using dash. # Also remove directory if the size is too low. # 2007-08-02 Ola Lundqvist # Broke out the common functions from the cron-apt command so it # can be tested separately. # The changes done in the project has been analyzed to give # correct copyright statements in this file. # # Check the tmpdir size and exit if the space is too small. checktmpsize() { # Sector size SSIZE=$(stat --file-system --format=%S $TMPDIR) # Number of free sectors FSCOUNT=$(stat --file-system --format=%a $TMPDIR) # Check to avoid overflow in calculations when using dash 2^(32-1-6) # The number size above is got from 32768/512=2^6 if [ "$FSCOUNT" -lt 33554432 ] ; then if [ "$(($SSIZE / 512 * $FSCOUNT / 2))" -lt "$MINTMPDIRSIZE" ]; then echo >&2 "Error: Not enough free space in $TMPDIR." rmdir --ignore-fail-on-non-empty $TMPDIR exit 1 fi fi } # Send the mail to the system administrator. Will only be sent if there is # something to send. No arguments needed. onexit() { if [ -f "$INITLOG" ] ; then rm -f "$INITLOG" fi if [ -f "$TEMP" ] ; then rm -f "$TEMP" fi if [ -f "$ACTIONLOG" ] ; then rm -f "$ACTIONLOG" fi if [ -f "$ACTIONSYSLOG" ] ; then rm -f "$ACTIONSYSLOG" fi if [ -f "$ACTIONMAIL" ] ; then rm -f "$ACTIONMAIL" fi if [ -f "$ACTIONERROR" ] ; then rm -f "$ACTIONERROR" fi if [ -f "$RUNLOG" ] ; then rm -f "$RUNLOG" fi if [ -f "$ERROR" ] ; then rm -f "$ERROR" fi if [ -f "$RUNSYSLOG" ] ; then rm -f "$RUNSYSLOG" fi if [ -f "$RUNERROR" ] ; then rm -f "$RUNERROR" fi if [ -f "$RUNMAIL" ] ; then rm -f "$RUNMAIL" fi if [ -f "$MAIL" ] && [ "$MAILON" != "never" ] && [ -n "$MAILON" ] ; then if command -v mail >/dev/null; then if [ -z "$HOSTNAME" ]; then HOSTNAME="$(uname -n)" fi SUBJECT="CRON-APT completed on $HOSTNAME [$CONFIG]" if [ -f "$ERROR" ] ; then SUBJECT="CRON-APT error on $HOSTNAME [$CONFIG]" fi # Support for XHEADERS IFSOLD=$IFS IFS=`printf '\t'` i=1 eval "VAL=\${XHEADER$i}" while [ ! -z $VAL ] ; do XHEADERS="$XHEADERS -a $VAL" i=$(( $i + 1 )) eval "VAL=\${XHEADER$i}" done # mail $XHEADERS -s "$SUBJECT" "$MAILTO" < "$MAIL" IFS=$IFSOLD else echo >&2 "cron-apt was configured to send e-mail, but no mail binary found in path." echo >&2 "Either set MAILON=never in configuration or install the mailx package." fi rm -f "$MAIL" fi if [ -f "$DIFF" ] ; then rm -f "$DIFF" fi if [ -d "$TMPDIR" ] ; then rmdir "$TMPDIR" fi if [ -x "/usr/bin/dotlockfile" ]; then dotlockfile -u $LOCKFILE fi } # Do the actual msg transfer. This reduce some duplications. # 1 CATFILE # 2 TOFILE (if = syslog log to syslog) # 3 TOSTDOUT () tomsg() { TCAT="$1" TFILE="$2" TSTD="$3" if [ -n "$TCAT" ] && [ -r "$TCAT" ] ; then if [ -n "$TSTD" ] ; then cat "$TCAT" fi if [ "$TFILE" != "syslog" ] ; then cat "$TCAT" >> "$TFILE" else logger -p user.notice -t cron-apt -f "$TCAT" fi fi } # Create file with RUN information. Line data should be added later. # Arguments: # 1: File to create (if = "syslog" we should log to syslog instead) # 2: File to cat e.g. $TEMP # 3: Optional file to cat (like errormsg.d/action or so) # 4: Optional runinformation file (will be removed) # 5: Optional actioninformation file (will be removed) # 6: If not empty data will be printed to stdout too. createdivinfo() { FILE="$1" CAT="$2" OPTCAT="$3" OPTRUNCAT="$4" OPTACTIONCAT="$5" TMPSTDOUT="$6" if [ "$FILE" != "syslog" ] ; then touch "$FILE" fi if [ -n "$OPTCAT" ] && [ -f "$OPTCAT" ] ; then tomsg "$OPTCAT" "$FILE" "$TMPSTDOUT" fi if [ -n "$OPTRUNCAT" ] && [ -f "$OPTRUNCAT" ] ; then tomsg "$OPTRUNCAT" "$FILE" "$TMPSTDOUT" rm -f "$OPTRUNCAT" fi if [ -n "$OPTACTIONCAT" ] && [ -f "$OPTACTIONCAT" ] ; then tomsg "$OPTACTIONCAT" "$FILE" "$TMPSTDOUT" rm -f "$OPTACTIONCAT" fi tomsg "$CAT" "$FILE" "$TMPSTDOUT" } # ACTIONF as first argument createmailinfo() { touch "$MAIL" if [ -n "$MAILON" ] && [ -f "$MAILONMSGSDIR/$MAILON" ] ; then cat "$MAILONMSGSDIR/$MAILON" >> "$MAIL" fi createdivinfo "$MAIL" "$TEMP" "$MAILMSGDIR/$1" "$RUNMAIL" "$ACTIONMAIL" } # ACTIONF as first argument createsysloginfo() { if [ -n "$SYSLOGON" ] && [ -f "$SYSLOGONMSGSDIR/$SYSLOGON" ] ; then logger -p user.notice -t cron-apt -f "$SYSLOGONMSGSDIR/$SYSLOGON" fi createdivinfo "syslog" "$TEMP" "$SYSLOGMSGDIR/$1" "$RUNSYSLOG" "$ACTIONSYSLOG" } # ACTIONF as first argument createloginfo() { createdivinfo "$LOG" "$TEMP" "$LOGMSGDIR/$1" "$RUNLOG" "$ACTIONLOG" "$STDOUT" } # ACTIONF as first argument createerrorinfo() { createdivinfo "$ERROR" "$TEMP" "$ERRORMSGDIR/$1" "$RUNERROR" "$ACTIONERROR" } # run-parts emulation, stolen from Branden's /etc/X11/Xsession run_parts () { # reset LC_COLLATE unset LANG LC_COLLATE LC_ALL if [ -z "$1" ]; then echo >&2 "$0: internal run_parts called without an argument" fi if [ ! -d "$1" ]; then echo >&2 "$0: internal run_parts called, but $1 does not exist or is not a directory." fi for F in $(ls $1); do if expr "$F" : '[[:alnum:]_-]\+$' > /dev/null 2>&1; then if [ -f "$1/$F" ] ; then echo "$1/$F" fi fi done; } general_varmove() { PREFIX=$1 STORE=$2 SIFS=$IFS LIST=$(set | grep "^[a-zA-Z][a-zA-Z0-9_]*_$PREFIX=" | sed -e "s|=.*||;") for PVAR in $LIST ; do # Var name VVAR=$(echo $PVAR | sed -e "s|_$PREFIX$||g;") if [ -n "$STORE" ] ; then # Stored var name eval "SVAR=${VVAR}_$STORE" # Store the value eval "$SVAR=\$$VVAR" fi # Set variable to here variable eval "$VVAR=\$$PVAR" eval "unset $PVAR" done } herevariables_store() { general_varmove HERE STORED } herevariables_restore() { general_varmove STORED "" } cron-apt-0.9.2/src/Makefile0000664000000000000000000000102311173250415012357 0ustar CRONDIR=/etc/cron.d BINDIR=/usr/sbin LOGROTDIR=/etc/logrotate.d SHAREDIR=/usr/share/cron-apt all: clean: install: cron.d cron-apt functions # Cron job mkdir -p $(DESTDIR)$(CRONDIR) install -m644 cron.d $(DESTDIR)$(CRONDIR)/cron-apt # Bin mkdir -p $(DESTDIR)$(BINDIR) install -m755 cron-apt $(DESTDIR)$(BINDIR) # Shared functions mkdir -p $(DESTDIR)$(SHAREDIR) install -m644 functions $(DESTDIR)$(SHAREDIR)/functions # Logrotate mkdir -p $(DESTDIR)$(LOGROTDIR) install -m644 logrotate $(DESTDIR)$(LOGROTDIR)/cron-apt cron-apt-0.9.2/src/logrotate0000664000000000000000000000016111173250415012644 0ustar /var/log/cron-apt/log { weekly missingok rotate 4 compress notifempty create 640 root adm sharedscripts } cron-apt-0.9.2/src/cron.d0000664000000000000000000000054311173250415012033 0ustar # # Regular cron jobs for the cron-apt package # # Every night at 4 o'clock. 0 4 * * * root test -x /usr/sbin/cron-apt && /usr/sbin/cron-apt # Every hour. # 0 * * * * root test -x /usr/sbin/cron-apt && /usr/sbin/cron-apt /etc/cron-apt/config2 # Every five minutes. # */5 * * * * root test -x /usr/sbin/cron-apt && /usr/sbin/cron-apt /etc/cron-apt/config2 cron-apt-0.9.2/debian/0000775000000000000000000000000012147751773011375 5ustar cron-apt-0.9.2/debian/rules0000775000000000000000000000277311654433213012452 0ustar #!/usr/bin/make -f # Sample debian/rules that uses debhelper. # GNU copyright 1997 to 1999 by Joey Hess. # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 # This is the debhelper compatability version to use. configure: configure-stamp configure-stamp: dh_testdir # Add here commands to configure the package. touch configure-stamp build: build-stamp build-stamp: configure-stamp dh_testdir # Add here commands to compile the package. $(MAKE) touch build-stamp clean: dh_testdir dh_testroot rm -f build-stamp configure-stamp # Add here commands to clean up after the build process. $(MAKE) clean dh_clean install: build dh_testdir dh_testroot dh_prep dh_installdirs # Add here commands to install the package into debian/cron-apt. $(MAKE) install DESTDIR=$(CURDIR)/debian/cron-apt # Build architecture-independent files here. binary-arch: build install # We have nothing to do by default. # Build architecture-dependent files here. binary-indep: build install dh_testdir dh_testroot # dh_installdebconf dh_installdocs dh_installexamples dh_installmenu # dh_installlogrotate # dh_installemacsen # dh_installpam # dh_installmime # dh_installinit dh_installcron dh_installman dh_installinfo # dh_undocumented dh_installchangelogs dh_link dh_strip dh_compress dh_fixperms # dh_makeshlibs dh_installdeb # dh_perl dh_shlibdeps dh_gencontrol dh_md5sums dh_builddeb binary: binary-indep binary-arch .PHONY: build clean binary-indep binary-arch binary install configure cron-apt-0.9.2/debian/compat0000664000000000000000000000000211654433025012560 0ustar 8 cron-apt-0.9.2/debian/changelog0000664000000000000000000006234312147751135013247 0ustar cron-apt (0.9.2) unstable; urgency=low * The code to generate random data is changed so that it handles absence of /dev/urandom and more importantly handles the case when cksum return a too short string. Closes: #689914. Thanks to Marc Haber and Bob Proulx for the suggestions. -- Ola Lundqvist Fri, 24 May 2013 22:49:33 +0200 cron-apt (0.9.1) unstable; urgency=low * Added path to README file reference. Closes: #658881. -- Ola Lundqvist Mon, 19 Mar 2012 21:33:47 +0100 cron-apt (0.9.0) unstable; urgency=low * Improved documentation for actions, logging and action specific configuration. Closes: #434991, #253419. * Added information about --no-list-cleanup option. Closes: #449391. * Documented apt-get command recommendation more clearly. * The configuration file is now documented in the README file instead of the configuration file itself. * No warning message will be printed to tell that there is no mail command available in case MAILON is set to 'never' or empty string. Closes: #569180. -- Ola Lundqvist Sat, 05 Nov 2011 00:50:19 +0100 cron-apt (0.8.5) unstable; urgency=low * Updated to standards version 3.9.1 and made it debhelper 8 compatible. * The contents of OPTIONS configuration is now included in debug output. Closes: #476751. Thanks to Marc Haber for the patch. -- Ola Lundqvist Thu, 03 Nov 2011 07:35:53 +0100 cron-apt (0.8.4) unstable; urgency=low * Corrected spelling error in the man page. Closes: #631571. Thanks to A. Costa for spotting this fault. -- Ola Lundqvist Mon, 27 Jun 2011 04:21:20 +0200 cron-apt (0.8.3) unstable; urgency=low * Corrected a problem that very long cron-apt options cause an error message and output being generated always. Closes: #619149. -- Ola Lundqvist Mon, 21 Mar 2011 21:21:37 +0100 cron-apt (0.8.2) unstable; urgency=medium * Bandwidth limit must not be enabled by default. Closes: #593859. -- Ola Lundqvist Sun, 22 Aug 2010 10:46:00 +0200 cron-apt (0.8.1) unstable; urgency=low * Added bandwidth limit example to the configuration file. Thanks to Andreas Mohr for pointing out this possibility. -- Ola Lundqvist Sat, 21 Nov 2009 15:07:52 +0100 cron-apt (0.8.0) unstable; urgency=low * Documented the UMASK_APT configuration setting. Changed name from the original UMASK_RELAXED in order to describe the function better. -- Ola Lundqvist Thu, 27 Aug 2009 22:51:17 +0200 cron-apt (0.7.1) unstable; urgency=low * Updated documentation to describe how to configure security updates only. Closes: #449386. -- Ola Lundqvist Mon, 10 Aug 2009 07:42:37 +0200 cron-apt (0.7.0) unstable; urgency=low * Added support for mail headers using code suggestions from Edward Malone . -- Ola Lundqvist Tue, 12 May 2009 06:49:28 +0200 cron-apt (0.6.8) unstable; urgency=low * Corrected problem that cause it to send an email instead of syslogging. Thanks to Boris Trautmann for spotting this. * Updated to standards version 3.8.0. * Changed so that clean target is no longer ignored. * Moved debhelper compatibility version from rules file to compat file. -- Ola Lundqvist Tue, 24 Mar 2009 20:54:10 +0100 cron-apt (0.6.7) unstable; urgency=low * Drop dependency on debianutils as it is an essential package since several major releases of Debian. Closes: #488145. Thanks to Justin B Rye for the patch. * Fixed spelling errors, closes: #489714. Thanks to Jeremiah C. Foster for ponting them out. -- Ola Lundqvist Fri, 11 Jul 2008 23:44:08 +0200 cron-apt (0.6.6) unstable; urgency=low * Updated upstream email and webpage address from opalsys.net to inguza.com. -- Ola Lundqvist Mon, 7 Apr 2008 17:48:57 +0200 cron-apt (0.6.5) unstable; urgency=low * Correctly handle logrotate script and install it, closes: #467616. Thanks to Justin B Rye for pointing me to this obvious fix. -- Ola Lundqvist Sun, 9 Mar 2008 23:29:25 +0100 cron-apt (0.6.4) unstable; urgency=low * Removed some comments about aptitude bug that is now fixed in stable, closes: #445346. * Changed location of upstream page. -- Ola Lundqvist Sat, 6 Oct 2007 10:53:11 +0200 cron-apt (0.6.3) unstable; urgency=low * Revert the change done in the earlier version. -- Ola Lundqvist Sun, 16 Sep 2007 20:05:08 +0200 cron-apt (0.6.2) unstable; urgency=low * Correction so that HERE variables realyl work as they should, closes: #442409. Thanks to Mario Holbe for pointing out this problem. -- Ola Lundqvist Sun, 16 Sep 2007 19:50:13 +0200 cron-apt (0.6.1) unstable; urgency=low * Avoid overflowin directory size calculation when using dash, closes: #436728. * Also remove directory when the disk size is too small, closes: #436685. -- Ola Lundqvist Thu, 9 Aug 2007 06:44:42 +0200 cron-apt (0.6.0) unstable; urgency=low * Support for HERE variables in the action.d configuration files, closes: #435459. The ideas are from Marc Haber. * Moved out functions from cron-apt command so they can be tested separately. * First basic tests added. * Correction of revision history and also added some more people to the AUTHORS file and to the copyright statements. -- Ola Lundqvist Thu, 2 Aug 2007 17:33:27 +0200 cron-apt (0.5.0) unstable; urgency=low * Based on a patch from Marc Haber cron- apt now fail more gracefully if the mail command is not available. Closes: #369666. * Applied patch from Marc Haber to make a more graceful check if the tmp directory is full. Modified the patch so it is configurable. Closes: #373099. * Make the FILTERCTRLM depricated as aptitude now support quiet option. This makes the old conflict with TARGET=upgrade a non-conflict, closes: #296789. -- Ola Lundqvist Tue, 31 Jul 2007 19:38:18 +0200 cron-apt (0.4.16) unstable; urgency=low * Correction from Bob Proulx incorporated to correct the MAILONMSGSDIR and SYSLOGONMSGSDIR spelling problem that exists, closes: #434006. -- Ola Lundqvist Sat, 21 Jul 2007 21:50:26 +0200 cron-apt (0.4.15) unstable; urgency=low * Check refrain file even after sleep, closes: #431949. Suggestion done by Marc Haber . -- Ola Lundqvist Fri, 6 Jul 2007 12:59:59 +0200 cron-apt (0.4.14) unstable; urgency=low * Add dependency on cron, closes: #409555. -- Ola Lundqvist Sun, 4 Feb 2007 12:04:18 +0100 cron-apt (0.4.13) unstable; urgency=low * Applied patch from Felix Palmen to document how to set APT_CONFIG configuration for apt. Closes: #402748. -- Ola Lundqvist Thu, 14 Dec 2006 21:15:26 +0100 cron-apt (0.4.12) unstable; urgency=low * Escaped one character in the configuration file as suggested by Reuben Thomas , closes: #402277. -- Ola Lundqvist Sat, 9 Dec 2006 11:24:35 +0100 cron-apt (0.4.11) unstable; urgency=low * Corrected stupid syntax error, closes: #400465. -- Ola Lundqvist Sun, 26 Nov 2006 17:15:09 +0100 cron-apt (0.4.10) unstable; urgency=low * Make sure that initlog is removed on exit, closes: #399827. -- Ola Lundqvist Thu, 23 Nov 2006 06:28:28 +0100 cron-apt (0.4.9) unstable; urgency=low * Correction of spelling error in config file, closes: #399189. -- Ola Lundqvist Sat, 18 Nov 2006 16:41:48 +0100 cron-apt (0.4.8) unstable; urgency=low * Updated FSF address and updated to latest GPL version. * Applied patch from Alex Owen to correct an inconsistency in the configuration file related to DIFFONCHANGES. Closes: #377681. -- Ola Lundqvist Mon, 17 Jul 2006 19:13:07 +0200 cron-apt (0.4.7) unstable; urgency=low * Corrected so that debhelper is now build depends instead of build depends indep. * Updated to standards version 3.7.2. -- Ola Lundqvist Thu, 6 Jul 2006 00:21:00 +0200 cron-apt (0.4.6) unstable; urgency=low * Move dotlock code so that now the entire cron-apt run is protected by locking, closes: #358136. Thanks to Marc Haber for the patch. -- Ola Lundqvist Sun, 30 Apr 2006 18:09:02 +0200 cron-apt (0.4.5) unstable; urgency=low * Removing bash dependency that is no longer needed, closes: #356566. * Moved mailx dependency to recommends. -- Ola Lundqvist Sun, 12 Mar 2006 20:59:46 +0100 cron-apt (0.4.4) unstable; urgency=low * Fixed minor error in documentation in config file, closes: #355397. * Upgraded to debhelper 4 compatibility. * Updated to standards version 3.6.2. * Corrected FSF address in copyright file. -- Ola Lundqvist Sun, 5 Mar 2006 20:08:05 +0100 cron-apt (0.4.3) unstable; urgency=low * The DIFFIGNORE option is now possible to set per config.d file, closes: #344098. -- Ola Lundqvist Tue, 20 Dec 2005 20:10:37 +0100 cron-apt (0.4.2) unstable; urgency=low * Improved documentation for aptitude problem with untrusted sources, closes: #316606. -- Ola Lundqvist Sun, 9 Oct 2005 21:45:38 +0200 cron-apt (0.4.1) unstable; urgency=low * Changed config documentation to describe how to accept untrusted sources, closes: #316606. * Applied patch from Marc Haber to add $APTCOMMAND to the CRON-APT line output, closes: #332817. * Changed DIFFIGNORE for aptitude in configuration, closes: #332816. Thanks to Marc Haber for this information. -- Ola Lundqvist Sun, 9 Oct 2005 12:30:15 +0200 cron-apt (0.4.0) unstable; urgency=low * Last config file fix was even more ambigous as before. Now it is reverted but easier to understand. * Applied patch from Marc Haber to make it possible to ignore specific lines in when using the mailon=changes directive, closes: #331195. This patch also introduce better hostname handling, closes: #331197. * Changed the option name that the Marc Haber patch introduced. * Documented that additional configuration is needed for noninteractive upgrades of non-authenticated packages with aptitude, closes: #316606. -- Ola Lundqvist Fri, 7 Oct 2005 21:49:49 +0200 cron-apt (0.3.1) unstable; urgency=low * Applied patch from Marc Haber to fix issue with CTRLM, closes: #315731. * Corrected typo in configuration file, closes: #306453. * Mention anacron in README, closes: #309540. -- Ola Lundqvist Sun, 2 Oct 2005 00:19:01 +0200 cron-apt (0.3.0) unstable; urgency=low * Applied patch from Marc Haber that make it possible to create a file that make cron-apt silently exit. Useful for dial-up connections, closes: #305474. * Updated manpage with minor correction, closes: #298983. -- Ola Lundqvist Wed, 20 Apr 2005 22:00:31 +0200 cron-apt (0.2.3) unstable; urgency=low * Updated french manpage with translation of GPL statement. Thanks to Valery Perrin. -- Ola Lundqvist Sun, 27 Feb 2005 15:46:04 +0100 cron-apt (0.2.2) unstable; urgency=low * Change license for manpage and french translation. I'm the copyright holder for the english version and I have got permission from Valery Perrin to change the french version as well. Closes: #296234. * Do not use filterctrlm as default. -- Ola Lundqvist Thu, 24 Feb 2005 19:57:28 +0100 cron-apt (0.2.1) unstable; urgency=low * Fixed bashism in filtercrlf check, closes: #294321. -- Ola Lundqvist Wed, 9 Feb 2005 17:40:53 +0100 cron-apt (0.2.0) unstable; urgency=low * Applied patch from Marc Sherman to support aptitude in addition to apt-get, closes: #287126. This allow support for apt-file as well, closes: #282117. * Fixed the location of the French manpage translation, closes: #292899. * Changed to a more flexible makefile structure. * Updated README to fit the new feature. * Updated description in control file. -- Ola Lundqvist Sun, 6 Feb 2005 12:15:15 +0100 cron-apt (0.1.2) unstable; urgency=low * Updated README file to note that they will be sourced and POSIX syntax is allowed as well as just setting variables, closes: #280868. -- Ola Lundqvist Tue, 1 Feb 2005 20:55:37 +0100 cron-apt (0.1.1) unstable; urgency=low * Added French manpage translation from Valery Perrin , closes: #285474. * Added patch from Marc Haber that fix an umask problem on woody, closes: #283631. -- Ola Lundqvist Mon, 13 Dec 2004 18:31:00 +0100 cron-apt (0.1.0) unstable; urgency=low * Applied patch from Marc Haber that allow for multiple configuration files to be specified from command line. Closes: #284571. * This is the first version to use the major.minor.correction version numbering structure. -- Ola Lundqvist Sun, 12 Dec 2004 00:12:36 +0100 cron-apt (0.0.37) unstable; urgency=low * Removed superflous autoclean line from default config, closes: #276704. -- Ola Lundqvist Thu, 21 Oct 2004 20:22:58 +0200 cron-apt (0.0.36) unstable; urgency=medium * Escaped string so that if action.d file data contain a slash it is escaped, closes: #272941. * Documented how to set an alternative sources.list file. -- Ola Lundqvist Thu, 23 Sep 2004 07:48:10 +0200 cron-apt (0.0.35) unstable; urgency=low * Add warning if dotlockfile not found, closes: #272412. Thanks to Marc Haber for the patch. * Modified copyright file so that it cover 2001-2004 and not just 2001. * Added note about documentation and development information in the README file, closes: #272410. -- Ola Lundqvist Mon, 20 Sep 2004 21:23:05 +0200 cron-apt (0.0.34) unstable; urgency=low * Made locking optional but recommended. Also added recommends on liblockfile1 to reflect this. Closes: #271722. -- Ola Lundqvist Wed, 15 Sep 2004 13:31:53 +0200 cron-apt (0.0.33) unstable; urgency=low * Applied patch from Marc Haber that allow for simultanious cron-apt run without messing up the logging, closes: #271201. * Modified this patch to avoid symlink attacks and also some minor bugfixes (in other parts of the code). * Added dependency to debianutils >= 1.7 because of the modifications to avoid symlink attacks. Thanks to Marc Haber for pointing out mktemp as a solution to the symlink problem. * Fix bug in run-parts, closes: #271191. Thanks to Marc Haber for this cosmetic change. -- Ola Lundqvist Sat, 11 Sep 2004 22:26:42 +0200 cron-apt (0.0.32) unstable; urgency=low * Applied patch from Marc Haber to achieve run-parts behaviour, closes: #270121. -- Ola Lundqvist Tue, 7 Sep 2004 14:34:20 +0200 cron-apt (0.0.31) unstable; urgency=high * Added -qq option to update action, closes: #267104. This is needed in order to make *on=changes output decent information. * Added configuration file to email subject, closes: #267097. * Urgency=high to ensure that these features are available at release time. * Added GNU copyright statement to README and cron-apt source. * Also added AUTHORS information. * Moved information from README.Debian to README file. -- Ola Lundqvist Fri, 20 Aug 2004 23:01:23 +0200 cron-apt (0.0.30) unstable; urgency=low * Changes in *on=changes run structure, closes: #264340. * Verified that it do not close and exit without notice, closes: #265436. This was probably fixed in 0.0.28. -- Ola Lundqvist Fri, 13 Aug 2004 11:13:01 +0200 cron-apt (0.0.29) unstable; urgency=low * Fixed diffbug on first run. -- Ola Lundqvist Fri, 13 Aug 2004 09:31:34 +0200 cron-apt (0.0.28) unstable; urgency=low * Optional files are checked for now, closes: #265367. * Made *ON=changes available to more than only mail (eg. syslog and debug). This also fixed that mailon=changes do not show action lines, closes: #265368. * Config file is shown in run line, closes: #265369. * Added syslogonmsgs in addition to the mailonmsgs. * Set logrotate to 4 instead of 52. It is now just debug information. -- Ola Lundqvist Fri, 13 Aug 2004 07:25:07 +0200 cron-apt (0.0.27) unstable; urgency=low * Fixed error in mailit, closes: #264336. * Better checking on status file, closes: #265283. * Rechecked that files are quoted, closes: #264338. * Added -n check on createdivinfo, closes: #264337. * Applied mailon=changes patch from Marc Haber . Closes: #264340. This is a nice new feature. Modified it some to suite this better. * Extended the mailmsgsdir feature to fit all mailon directives. * Fixed some more error that I have made during this work. * Added support for SYSLOGON too. * Changed defaults so it syslog on upgrade and mail on error. -- Ola Lundqvist Thu, 12 Aug 2004 20:18:42 +0200 cron-apt (0.0.26) unstable; urgency=low * Made sure that all variables are properly quoted, closes: #265056. -- Ola Lundqvist Wed, 11 Aug 2004 20:30:33 +0200 cron-apt (0.0.25) unstable; urgency=low * Cleaned up some code and fixed a minor logging bug. * Better argument checking code. Can now handle more than one option. * Changed from status passing from echo to file. * Fixed so that stdout argument really works. -- Ola Lundqvist Sun, 8 Aug 2004 14:28:03 +0200 cron-apt (0.0.24) unstable; urgency=low * Fixed variable bug, closes: #264168. * Fixed so that dpkg-dist and dpkg-old files is not run, closes: #264167. * Removed a lot of duplicated code and made functions for it. * Rewrote the logging and mail functions. Closes: #264181, #264184, #264171, #264170. * Added debug option, closes: #264165. -- Ola Lundqvist Sat, 7 Aug 2004 15:49:17 +0200 cron-apt (0.0.23) unstable; urgency=low * Changed from upgrade to dist-upgrade as default download action. Thanks to Andrew McCarthy for the suggestion. Also added an autoclean before if there is limited diskspace. -- Ola Lundqvist Wed, 28 Jul 2004 13:08:26 +0200 cron-apt (0.0.22) unstable; urgency=low * Changed from read -e to read as David Weinehall suggested. * Updated standards version to 3.6.1. -- Ola Lundqvist Mon, 26 Jul 2004 20:48:23 +0200 cron-apt (0.0.21) unstable; urgency=low * Cron-apt is now more POSIX compliant. Thanks to David Weinehall Bob Proulx for the suggestions and patch. Also thanks to Bob Proulx for comments. Closes: #260071. * Added some documentation to the sample config so that errormsg.d and such directories are better documented, closes: #228477. * Moved manpage section from 1 to 8. -- Ola Lundqvist Thu, 22 Jul 2004 17:37:38 +0200 cron-apt (0.0.20) unstable; urgency=low * Added dependency on mailx, closes: #222769. * Fix so it always work if LANG not set to C, closes: #226245. * Fixed cron.d example, closes: #219237. * Fixed so runemediatly is set if a terminal exist for stdout, closes: #208145. Thanks to Bob Proulx for the fix. * Fixed inconsistent set in config, closes: #208148. Thanks to Bob Proulx for the patch. * Fixed typo in cronfile, closes: #208116. Thanks to Martin Pool for pointing it out. * Cosmetic changes to sgml file, closes: #208149. -- Ola Lundqvist Fri, 16 Apr 2004 12:02:13 +0200 cron-apt (0.0.19) unstable; urgency=low * Updated manpage with minor fixes. -- Ola Lundqvist Mon, 1 Sep 2003 06:33:53 +0200 cron-apt (0.0.18) unstable; urgency=low * Always run even if there was an error last time is not the default, closes: #203277. * Fix so that you can write RUNSLEEP=0 too, closes: #204430. * Updated standards version from 3.5.8 to 3.5.10. -- Ola Lundqvist Thu, 28 Aug 2003 12:04:39 +0200 cron-apt (0.0.17) unstable; urgency=low * Added patch from Marcel Kolaja that adds an option -i to run immediately from command line. This patch was modified slightly so that it fits better in how I write code. -- Ola Lundqvist Tue, 22 Jul 2003 14:09:14 +0200 cron-apt (0.0.16) unstable; urgency=low * Added randomize feature to spread the webb access times. Now cron- apt will sleep up to one hour (default) before making any apt actions, closes: #191981. * Now cron-apt is aware of the DEBIANFRONTEND=noninteractive environement to make it able to update noninteractively, closes: #190151, #190899. * Added patch to support mailon=output from Sean Finney , closes: #173927. * Added support for per (log,error,mail) messages, closes: #184804. -- Ola Lundqvist Thu, 10 Jul 2003 16:09:36 +0200 cron-apt (0.0.15) unstable; urgency=low * Added note in the README.Debian file that you need to disable the other cron.d. -- Ola Lundqvist Sat, 28 Jun 2003 16:51:31 +0200 cron-apt (0.0.14) unstable; urgency=low * Added mailon=output option using patch from Sean Finney , closes: #185026. -- Ola Lundqvist Thu, 17 Apr 2003 22:51:56 +0200 cron-apt (0.0.13) unstable; urgency=low * Updated standards version from 3.5.2 to 3.5.8 (no other changes). * Removed debian/cron-apt.conffiles. This file is properly generated anyway. Now it creates duplicates instead. * Fixed minor typo, closes: #177567. * Fixed documentation reference in README.Debian, closes: #170295. -- Ola Lundqvist Fri, 10 Jan 2003 17:45:05 +0100 cron-apt (0.0.12) unstable; urgency=low * Fixed manpage error. -- Ola Lundqvist Mon, 11 Nov 2002 07:19:13 +0100 cron-apt (0.0.11) unstable; urgency=low * Minor spelling thing fixed, closes: #161493. * Added new option to avoid unnecessary manual intervention, closes: #166966. -- Ola Lundqvist Tue, 5 Nov 2002 16:04:24 +0100 cron-apt (0.0.10) unstable; urgency=low * Documented the new MAILON=upgrade feature in the configuration file, closes: #159289. * Restructurated the Makefile. * Added more files to the examples directory. -- Ola Lundqvist Mon, 2 Sep 2002 14:59:02 +0200 cron-apt (0.0.9) unstable; urgency=low * Implemented mail on upgrade only using patches from Marcel Kolaja . Thanks a lot for these patches. -- Ola Lundqvist Wed, 14 Aug 2002 15:06:00 +0200 cron-apt (0.0.8) unstable; urgency=low * Fixed "ln" typo in README file, closes: #150061. -- Ola Lundqvist Tue, 13 Aug 2002 11:11:26 +0200 cron-apt (0.0.7) unstable; urgency=low * Added default path so the upgrade will work fine. Thanks to Donovan Baarda for pointing out the problem. Closes: #144158. -- Ola Lundqvist Wed, 24 Apr 2002 22:14:48 +0200 cron-apt (0.0.6) unstable; urgency=low * Fixed help problem, thanks to Mari Wang for the simple patch, closes: #141680. -- Ola Lundqvist Mon, 8 Apr 2002 20:08:32 +0200 cron-apt (0.0.5) unstable; urgency=low * Added download action, closes: #141046. * Fixed description, closes: #140594. * Rewrote the mail and log handling so it will be more flexible. * Added skipping of backup files (*~). * Added skipping of comment lines in action files. -- Ola Lundqvist Sun, 7 Apr 2002 16:51:12 +0200 cron-apt (0.0.4) unstable; urgency=low * Fixed run order, closes: #138295. * Updated documentation, closes: #138291. -- Ola Lundqvist Sun, 17 Mar 2002 23:38:15 +0100 cron-apt (0.0.3) unstable; urgency=low * Now arch all, closes: #137848. * Can not fix the bashism, now depends on bash instead, closes: #137891. -- Ola Lundqvist Tue, 12 Mar 2002 22:05:53 +0100 cron-apt (0.0.2) unstable; urgency=low * Fixed problem with logrotate. * Fixed problem with cronjob, typo. -- Ola Lundqvist Wed, 6 Mar 2002 09:56:02 +0100 cron-apt (0.0.1) unstable; urgency=low * Initial Release. -- Ola Lundqvist Tue, 5 Mar 2002 09:07:31 +0100 cron-apt-0.9.2/debian/cron-apt.docs0000664000000000000000000000000711173250415013750 0ustar README cron-apt-0.9.2/debian/cron-apt.postrm0000775000000000000000000000063511173250415014356 0ustar #!/bin/sh -e # Cron-apt postrm script using debconf # Written by Ola Lundqvist case "$1" in purge) if [ -d /var/log/cron-apt ] ; then rm -Rf /var/log/cron-apt fi ;; remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) ;; *) echo "postrm called with unknown argument \`$1'" >&2 exit 0 ;; esac #DEBHELPER# exit 0 cron-apt-0.9.2/debian/copyright0000664000000000000000000000300112147751626013317 0ustar This package was debianized by Ola Lundqvist on Tue, 5 Mar 2002 09:07:31 +0100. Upstream Author: Ola Lundqvist Homepage: http://inguza.com/software/cron-apt/ Copyright: Copyright (C) 2002-2011,2013 Ola Lundqvist Copyright (C) 2009 Edward Malone Copyright (C) 2004-2011,2013 Marc Haber Copyright (C) 2004,2007,2013 Bob Proulx Copyright (C) 2006 Felix Palmen Copyright (C) 2004 Marc Sherman Copyright (C) 2004 David Weinehall Copyright (C) 2003 Sean Finney Copyright (C) 2002 Marcel Kolaja Licsense: This is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License with your Debian GNU/Linux system, in /usr/share/common-licenses/GPL, or with the source package as the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. cron-apt-0.9.2/debian/control0000664000000000000000000000162611654433045012774 0ustar Source: cron-apt Section: admin Priority: optional Maintainer: Ola Lundqvist Build-Depends-Indep: docbook-to-man Build-Depends: debhelper (>= 8.0.0) Standards-Version: 3.9.1 Package: cron-apt Architecture: all Depends: apt, ${misc:Depends} Recommends: liblockfile1, mailx, cron Description: automatic update of packages using apt-get Contains a tool that is run by a cron job at regular intervals. By default it just updates the package list and downloads new packages without installing. You can instruct it to run anything that you can do with apt-get (or aptitude). . It can optionally send mail to the system administrator on errors, log to syslog or a separate log file. . Observe that this tool may be a security risk, so you should not set it to do more than necessary. Automatic upgrade of all packages is NOT recommended unless you are in full control of the package repository. cron-apt-0.9.2/conf/0000775000000000000000000000000012147751773011100 5ustar cron-apt-0.9.2/conf/0-update0000664000000000000000000000002211173250415012415 0ustar update -o quiet=2 cron-apt-0.9.2/conf/config0000664000000000000000000000021211731714005012244 0ustar # Configuration for cron-apt. For further information about the possible # configuration settings see /usr/share/doc/cron-apt/README.gz. cron-apt-0.9.2/conf/3-download0000664000000000000000000000010011173250415012742 0ustar autoclean -y dist-upgrade -d -y -o APT::Get::Show-Upgraded=true cron-apt-0.9.2/conf/9-notify0000664000000000000000000000013311173250415012457 0ustar # Use it with MAILON=output to tell you when upgrades is available. -q -q --no-act upgrade cron-apt-0.9.2/conf/Makefile0000664000000000000000000000150511173250415012522 0ustar ETCDIR=/etc/cron-apt ACTIONDIR=$(ETCDIR)/action.d DOCDIR=/usr/share/doc/cron-apt all: clean: install: install-examples config 0-update 3-download mkdir -p $(DESTDIR)$(ETCDIR) mkdir -p $(DESTDIR)$(ACTIONDIR) mkdir -p $(DESTDIR)$(ETCDIR)/config.d mkdir -p $(DESTDIR)$(ETCDIR)/mailmsg.d mkdir -p $(DESTDIR)$(ETCDIR)/syslogmsg.d mkdir -p $(DESTDIR)$(ETCDIR)/mailonmsgs mkdir -p $(DESTDIR)$(ETCDIR)/syslogonmsgs mkdir -p $(DESTDIR)$(ETCDIR)/errormsg.d mkdir -p $(DESTDIR)$(ETCDIR)/logmsg.d install -m644 config $(DESTDIR)$(ETCDIR) install -m644 0-update $(DESTDIR)$(ACTIONDIR)/ install -m644 3-download $(DESTDIR)$(ACTIONDIR)/ install-examples: config 0-update 3-download 9-notify mkdir -p $(DESTDIR)$(DOCDIR)/examples install -m644 [0-9]-* -p $(DESTDIR)$(DOCDIR)/examples install -m644 config $(DESTDIR)$(DOCDIR)/examples cron-apt-0.9.2/man/0000775000000000000000000000000012147751773010726 5ustar cron-apt-0.9.2/man/cron-apt.sgml0000664000000000000000000000662511601764226013335 0ustar Ola"> Lundqvist"> mars 5, 2002"> 8"> ola@inguza.com"> CRON-APT"> Debian GNU/Linux"> GNU"> ]>
&dhemail;
&dhfirstname; &dhsurname; 2001-2005 &dhusername; &dhdate;
&dhucpackage; &dhsection; &dhpackage; program to update the system using apt-get &dhpackage; [configfile] DESCRIPTION This manual page documents briefly the &dhpackage; command. &dhpackage; is a program that uses the information in /etc/cron-apt/action.d/ as arguments to apt-get line by line in file order. OPTIONS These programs follow the usual GNU command line syntax, with long options starting with two dashes (`-'). A summary of options is included below. For a complete description, see the Info files. Show summary of options. CONFIGURATION Configuration can be done by editing /etc/cron-apt/config and by adding rules to /etc/cron-apt/action.d/ The variables that you can set in /etc/cron-apt/config is documented in the configuration example in /usr/share/doc/cron-apt/examples/config From version 0.5.0 the optional FILTERCTRLM attribute is deprecated. SEE ALSO apt-get (1) aptitude (1) AUTHOR This manual page was written by &dhusername; &dhemail; for the &debian; system (but may be used by others). This manual is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
cron-apt-0.9.2/man/cron-apt.fr.sgml0000664000000000000000000000710711173250415013731 0ustar Ola"> Lundqvist"> 5 mars 2002"> 8"> ola@inguza.com"> CRON-APT"> Debian GNU/Linux"> GNU"> ]>
&dhemail;
&dhfirstname; &dhsurname; 2001-2005 &dhusername; &dhdate;
&dhucpackage; &dhsection; &dhpackage; Programme d'automatisation des mises à jour du système par apt-get &dhpackage; [fichier-de-configuration] DESCRIPTION Cette page de manuel décrit succinctement la commande &dhpackage;. &dhpackage; est un programme qui utilise les informations de /etc/cron-apt/action.d/ comme paramètre d'apt-get, ligne par ligne, dans l'ordre du fichier. OPTIONS Ce programme respecte la syntaxe habituelle des lignes de commande du GNU. Les options étendues commencent par deux tirets --. Un résumé des options est indiqué ci-dessous. Pour une description complète, voyez les fichiers Info. Affiche la liste des options. CONFIGURATION La configuration peut être faite en modifiant /etc/cron-apt/config et en insérant des règles dans /etc/cron-apt/action.d/. Les variables qu'il est possible de placer dans /etc/cron-apt/config sont documentées dans l'exemple de configuration /usr/share/doc/cron-apt/examples/config. VOIR AUSSI apt-get (1). AUTEUR Cette page de manuel a été écrite par &dhusername; <&dhemail;> pour le système &debian; (mais elle peut être utilisée pour d'autres systèmes). Ce manuel est un logiciel libre. Vous pouvez le redistribuer et/ou le modifier conformément aux termes de la Licence Publique Générale GNU (GNU-GPL) telle que l'a publiée la Free Software Foundation (Fondation pour le Logiciel Libre), soit selon la version 2, soit (à votre convenance) selon toute autre version postérieure. TRADUCTION Valéry Perrin <valery.perrin.debian@free.fr> le 5 décembre 2004. Mise à jour le 25 février 2005. L'équipe de traduction a fait le maximum pour réaliser une adaptation française de qualité. La version anglaise la plus à jour de ce document est toujours consultable via la commande man -L en auto-apt N'hésitez pas à signaler à l'auteur ou au traducteur, selon le cas, toute erreur dans de cette page de manuel.
cron-apt-0.9.2/man/Makefile0000664000000000000000000000064711173250415012356 0ustar MANDIR=/usr/share/man all: docbook-to-man cron-apt.sgml > cron-apt.8 docbook-to-man cron-apt.fr.sgml > cron-apt.fr.8 gzip -9 *.8 clean: -rm cron-apt.8* cron-apt.fr.8* install: cron-apt.8.gz cron-apt.fr.8.gz mkdir -p $(DESTDIR)$(MANDIR)/man8 install -m644 cron-apt.8.gz \ $(DESTDIR)$(MANDIR)/man8 mkdir -p $(DESTDIR)$(MANDIR)/fr/man8 install -m644 cron-apt.fr.8.gz \ $(DESTDIR)$(MANDIR)/fr/man8/cron-apt.8.gz cron-apt-0.9.2/patches/0000775000000000000000000000000012147751773011602 5ustar cron-apt-0.9.2/patches/general-locks.patch0000664000000000000000000000532011173250415015332 0ustar --- cron-apt 2006-04-29 15:32:33.424994750 +0200 +++ /usr/sbin/cron-apt 2006-04-30 00:53:19.147721000 +0200 @@ -20,6 +20,9 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # # Changes: +# 2006-04-30 Marc Haber +# Move dotlock code so that now the entire cron-apt run +# is protected by locking # 2005-10-09 Marc Haber # Add $APTCOMMAND to the CRON-APT line output. # 2005-10-07 Ola Lundqvist @@ -270,6 +273,9 @@ if [ -d "$TMPDIR" ] ; then rmdir "$TMPDIR" fi + if [ -x "/usr/bin/dotlockfile" ]; then + dotlockfile -u $LOCKFILE + fi } # Do the actual msg transfer. This reduce some duplications. @@ -401,6 +407,25 @@ fi fi +################## try to take out a lock, terminate if unsuccessful ########## + +if [ -x /usr/bin/dotlockfile ] ; then + if ! dotlockfile -l -p -r 10 $LOCKFILE; then + # create log entry + echo > $MAIL "cannot acquire cron-apt lock." + onexit + exit 1 + fi +else + if [ -z "$NOLOCKWARN" ]; then + echo > $TEMP "WARNING: dotlockfile not installed. If you don't want to see this" + echo >> $TEMP " Warning any more, set NOLOCKWARN in the configuration file." + createerrorinfo "startup" + fi +fi + +################## initialize various log files ############################## + cp "$INITLOG" "$RUNMAIL" cp "$INITLOG" "$RUNLOG" cp "$INITLOG" "$RUNSYSLOG" @@ -424,34 +449,14 @@ grep -v "^[[:space:]]*$" | { while read LINE ; do echo "CRON-APT LINE: $APTCOMMAND $LINE" > "$TEMP" - if [ -x /usr/bin/dotlockfile ] ; then - if ! dotlockfile -l -p -r 10 $LOCKFILE; then - echo > $TEMP "cannot acquire apt lock." - RET=1 - else - UMASK_SAVE=$(umask) - umask $UMASK_RELAXED - $APTCOMMAND $OPTIONS $LINE >> $TEMP 2>&1 - RET=$? - umask $UMASK_SAVE - fi - dotlockfile -u $LOCKFILE - else - if [ -z "$NOLOCKWARN" ]; then - echo > $TEMP "WARNING: dotlockfile not installed. If you don't want to see this" - echo >> $TEMP " Warning any more, set NOLOCKWARN in the configuration file." - fi - UMASK_SAVE=$(umask) - umask $UMASK_RELAXED - $APTCOMMAND $OPTIONS $LINE >> $TEMP 2>&1 - RET=$? - umask $UMASK_SAVE - fi + UMASK_SAVE=$(umask) + umask $UMASK_RELAXED + $APTCOMMAND $OPTIONS $LINE >> $TEMP 2>&1 + RET=$? + umask $UMASK_SAVE if [ "$FILTERCTRLM" = "true" ]; then CTRLM="$(echo -e \\r)" < "$TEMP" sed "s/.*$CTRLM\(.\+\)/\1/" > "$FILTER" - #grep -v " -#" "$TEMP" > "$FILTER" cp "$FILTER" "$TEMP" fi if [ $RET -ne 0 ]; then cron-apt-0.9.2/patches/cron-apt_0.3.1_0.3.1.1.interdiff0000664000000000000000000000514511173250415016604 0ustar diff -urN cron-apt-0.3.1/conf/config cron-apt-0.3.1.1/conf/config --- cron-apt-0.3.1/conf/config 2005-10-01 21:21:27.000000000 +0000 +++ cron-apt-0.3.1.1/conf/config 2005-10-05 09:47:01.000000000 +0000 @@ -133,3 +133,14 @@ # If this file exist cron-apt will silently exit. # REFRAINFILE=/etc/cron-apt/refrain + +# If this is non-empty, it will be used as the host name in subjects of +# generated e-mail messages. If this is empty, the output of uname -n +# will be used. +# HOSTNAME="" + +# Ignore lines matching this regexp to determine whether changes occurred +# for MAILON="changes". +# Suggested value for aptitude: DIFFIGNORERE="^\(Get:[[:digit:]]\+\|Hit\|Ign\|Del\|Fetched\|Freed\)[[:space:]]" +# Suggested value for apt-get: ##+#FIXME +# DIFFIGNORERE="" diff -urN cron-apt-0.3.1/src/cron-apt cron-apt-0.3.1.1/src/cron-apt --- cron-apt-0.3.1/src/cron-apt 2005-10-01 21:17:44.000000000 +0000 +++ cron-apt-0.3.1.1/src/cron-apt 2005-10-05 09:45:53.000000000 +0000 @@ -179,6 +179,13 @@ # output will be filtered from log/mail/console output. This is useful # with aptitude, which does not currently support -qq (very quiet). FILTERCTRLM="false" +# If HOSTNAME is non-empty, the contents will be used to generate the +# e-mail subject for notifications sent out. If HOSTNAME is empty, the +# output of $(uname -n) will be used. +HOSTNAME="" +# Ignore lines matching this regexp to determine whether changes occurred +# for MAILON="changes". +DIFFIGNORERE="" export DEBIAN_FRONTEND="noninteractive" export LANG="C" @@ -193,6 +200,10 @@ fi done +if [ -n "$DIFFIGNORERE" ]; then + DIFFIGNORERE="--ignore-matching-lines=$DIFFIGNORERE" +fi + if [ -t 0 ]; then RUNIMMEDIATELY="yes" fi @@ -236,9 +247,12 @@ rm -f "$RUNMAIL" fi if [ -f "$MAIL" ] ; then - SUBJECT="CRON-APT completed on $(uname -n) [$CONFIG]" + if [ -z "$HOSTNAME" ]; then + HOSTNAME="$(uname -n)" + fi + SUBJECT="CRON-APT completed on $HOSTNAME [$CONFIG]" if [ -f "$ERROR" ] ; then - SUBJECT="CRON-APT error on $(uname -n) [$CONFIG]" + SUBJECT="CRON-APT error on $HOSTNAME [$CONFIG]" fi mail -s "$SUBJECT" "$MAILTO" < "$MAIL" rm -f "$MAIL" @@ -514,7 +528,7 @@ fi TLINE=$(echo "$LINE" | sed -e "s/[[:space:]]/_/g;" | \ tr "/" "-") - if [ ! -r "$MAILCHDIR/$ACTIONF-$TLINE" ] || ! diff -u "$MAILCHDIR/$ACTIONF-$TLINE" "$TEMP" > "$DIFF" ; then + if [ ! -r "$MAILCHDIR/$ACTIONF-$TLINE" ] || ! diff $DIFFIGNORERE -u "$MAILCHDIR/$ACTIONF-$TLINE" "$TEMP" > "$DIFF" ; then cp "$TEMP" "$MAILCHDIR/$ACTIONF-$TLINE" # What to do with diff # OBS! FROM NOW ON "$TEMP" CAN HAVE DIFF INFORMATION IN IT! cron-apt-0.9.2/patches/cron-apt-0.4.11-APT_CONFIG.diff0000664000000000000000000000377711173250415016344 0ustar diff -Nru cron-apt-0.4.11.orig/conf/config cron-apt-0.4.11/conf/config --- cron-apt-0.4.11.orig/conf/config 2006-12-14 14:59:01.000000000 +0100 +++ cron-apt-0.4.11/conf/config 2006-12-14 15:13:30.000000000 +0100 @@ -139,6 +139,11 @@ # aptitude 0.3.4. # OPTIONS="-o quiet=1 -o APT::Get::AllowUnauthenticated=true -o aptitude::Cmdline::ignore-trust-violations=yes" +# additional APT configuration file that is loaded first. This can be set in +# order to use a completely different APT configuration for cron-apt. See the +# /usr/share/doc/cron-apt/README and apt.conf(5) for details +# export APT_CONFIG=/etc/apt/cron.apt.paths + # Do not run the command, if there is an error in the previous run (default). # Value: error (do not run if there is an error on last run) # (else always run, remove previous error file and run) diff -Nru cron-apt-0.4.11.orig/README cron-apt-0.4.11/README --- cron-apt-0.4.11.orig/README 2006-12-14 14:59:01.000000000 +0100 +++ cron-apt-0.4.11/README 2006-12-14 15:10:23.000000000 +0100 @@ -40,6 +40,26 @@ OPTIONS="-q -o Dir::Etc::SourceList=/etc/apt/security.sources.list" +Alternate APT main configuration +-------------------------------- + +There are cases when you need the APT configuration for use with cron-apt to +differ substantially from your standard configuration. For example, cron-apt +will not work with the default configuration of APT, when apt-listbugs is +installed, because this adds a hook that expects keyboard interactivity. + +Unfortunately, the apt-tools do not accept Dir::Etc::Main and Dir::Etc::Parts +settings on the command-line. In order to use different paths for them, you +have to create another APT configuration file containing eg: + + Dir::Etc::Main "cron.apt.conf"; + Dir::Etc::Parts "cron.apt.conf.d"; + +Then uncomment the following line in your cron-apt configuration file and +point it to your newly created APT configuration file: + + export APT_CONFIG=/etc/apt/cron.apt.paths + Development and documentation ----------------------------- cron-apt-0.9.2/patches/434006-cron-apt-mailoncorrection.patch0000664000000000000000000000524211173250415020435 0ustar Package: cron-apt Version: 0.4.14 Severity: normal Tags: patch I have several chroot systems on the same machine. When mail is sent from the machine from several of the chroots plus the supervisor system itself I could not tell which chroot the messages were coming from. I browsed the cron-apt script and I see that there appears to be provision to add a header message to mail and syslog if it is available. Placing a file /etc/cron-apt/mailonmsgs/upgrade with appropriate contents seems to be the intention. But the current set of variables names do not match. The variables are "MAILONMSGSDIR" ("MAIL <> MSGSDIR") and SYSLOGONMSGSDIR versus versions without the ON in the middle. MAILONMSGSDIR="/etc/cron-apt/mailonmsgs" SYSLOGONMSGSDIR="/etc/cron-apt/syslogonmsgs" ... createmailinfo() { touch "$MAIL" if [ -n "$MAILON" ] && [ -f "$MAILMSGSDIR/$MAILON" ] ; then cat "$MAILMSGSDIR/$MAILON" >> "$MAIL" fi createdivinfo "$MAIL" "$TEMP" "$MAILMSGDIR/$1" "$RUNMAIL" "$ACTIONMAIL" } # ACTIONF as first argument createsysloginfo() { if [ -n "$SYSLOGON" ] && [ -f "$SYSLOGMSGSDIR/$SYSLOGON" ] ; then logger -p user.notice -t cron-apt -f "$SYSLOGMSGSDIR/$SYSLOGON" fi createdivinfo "syslog" "$TEMP" "$SYSLOGMSGDIR/$1" "$RUNSYSLOG" "$ACTIONSYSLOG" } Here is the obvious patch to resolve this problem. With this change a file /etc/cron-apt/mailonmsgs/upgrade will be prepended to the mail. A workaround is for a local admin to put MAILMSGSDIR=/etc/cron-apt/mailonmsgs in the /etc/cron-apt/config.d/0-update file. This duplicates that variable with the current spelling and it then works with the Etch released version of the code. Thanks Bob Index: cron-apt =================================================================== --- cron-apt (revision 2429) +++ cron-apt (working copy) @@ -349,16 +349,16 @@ # ACTIONF as first argument createmailinfo() { touch "$MAIL" - if [ -n "$MAILON" ] && [ -f "$MAILMSGSDIR/$MAILON" ] ; then - cat "$MAILMSGSDIR/$MAILON" >> "$MAIL" + if [ -n "$MAILON" ] && [ -f "$MAILONMSGSDIR/$MAILON" ] ; then + cat "$MAILONMSGSDIR/$MAILON" >> "$MAIL" fi createdivinfo "$MAIL" "$TEMP" "$MAILMSGDIR/$1" "$RUNMAIL" "$ACTIONMAIL" } # ACTIONF as first argument createsysloginfo() { - if [ -n "$SYSLOGON" ] && [ -f "$SYSLOGMSGSDIR/$SYSLOGON" ] ; then - logger -p user.notice -t cron-apt -f "$SYSLOGMSGSDIR/$SYSLOGON" + if [ -n "$SYSLOGON" ] && [ -f "$SYSLOGONMSGSDIR/$SYSLOGON" ] ; then + logger -p user.notice -t cron-apt -f "$SYSLOGONMSGSDIR/$SYSLOGON" fi createdivinfo "syslog" "$TEMP" "$SYSLOGMSGDIR/$1" "$RUNSYSLOG" "$ACTIONSYSLOG" } cron-apt-0.9.2/patches/umask-fix-on-woody.patch0000664000000000000000000000262211173250415016263 0ustar From: Marc Haber Hi, backported cron-apt on woody has apt-get update create files in /var/lib/apt/lists with mode 600, breaking apt-cache for normal users. cron-apt should reset umask to some less restrictive value before invoking apt-get to work around this obvious bug in woody's apt-get that has been fixed in sid. Greetings Marc --- cron-apt.orig Mon Dec 13 10:27:19 2004 +++ cron-apt Mon Dec 13 10:35:23 2004 @@ -78,7 +78,9 @@ # for pointing it out. export PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin -umask 077 +UMASK_TIGHT="077" +UMASK_RELAXED="022" +umask $UMASK_TIGHT ############################# arguments ####################################### @@ -386,8 +388,11 @@ echo > $TEMP "cannot acquire apt lock." RET=1 else + UMASK_SAVE=$(umask) + umask $UMASK_RELAXED apt-get $OPTIONS $LINE >> $TEMP 2>&1 RET=$? + umask $UMASK_SAVE fi dotlockfile -u $LOCKFILE else @@ -395,8 +400,11 @@ echo > $TEMP "WARNING: dotlockfile not installed. If you don't want to see this" echo >> $TEMP " Warning any more, set NOLOCKWARN in the configuration file." fi + UMASK_SAVE=$(umask) + umask $UMASK_RELAXED apt-get $OPTIONS $LINE >> $TEMP 2>&1 RET=$? + umask $UMASK_SAVE fi if [ $RET -ne 0 ]; then # --- cron-apt-0.9.2/patches/373099-tmpcheck.patch0000664000000000000000000000111111173250415015150 0ustar --- cron-apt.orig 2007-07-28 09:08:16.000000000 +0200 +++ cron-apt 2007-07-28 09:26:10.000000000 +0200 @@ -142,7 +142,11 @@ CONFIGDIRNAME="$(echo $CONFIG | sed 's|/|_-_|g')" TMPDIR=$(mktemp -d -t cron-apt.XXXXXX) if [ $? -ne 0 ]; then - echo "Error: Can not create a safe temporary directory." + echo >&2 "Error: Can not create a safe temporary directory." + exit 1 +fi +if [ "$(( $(stat --file-system --format=%S $TMPDIR) * $(stat --file-system --format=%a $TMPDIR) / 1024 ))" -lt "10000" ]; then + echo >&2 "Error: Not enough free space in $TMPDIR." exit 1 fi cron-apt-0.9.2/patches/refrain.patch0000664000000000000000000000074411173250415014237 0ustar From: Marc Haber --- /usr/sbin/cron-apt 2005-02-27 15:47:51.000000000 +0100 +++ cron-apt 2005-04-20 09:25:04.121607832 +0200 @@ -357,6 +357,12 @@ mkdir -p "$MAILCHDIR" fi +################## terminate if /etc/cron-apt/refrain exists ################## + +if [ -e "/etc/cron-apt/refrain" ]; then + exit 0 +fi + ############################### sleep ######################################### echo "CRON-APT RUN [$CONFIG]: $(date)" > $INITLOG cron-apt-0.9.2/patches/mail_on_output.author0000664000000000000000000000004211173250415016041 0ustar Sean Finney cron-apt-0.9.2/patches/inconsistency-in-config.patch0000664000000000000000000000225311173250415017345 0ustar diff -ur cron-apt-0.4.7.orig/conf/config cron-apt-0.4.7/conf/config --- cron-apt-0.4.7.orig/conf/config 2006-03-05 19:09:17.000000000 +0000 +++ cron-apt-0.4.7/conf/config 2006-07-10 16:59:57.000000000 +0100 @@ -122,7 +122,7 @@ # append (append to the output) # only (only show the diff, not the output itself) # (else do nothing) -DIFFONCHANGES=prepend +# DIFFONCHANGES=prepend # General apt options that will be passed to all APTCOMMAND calls. # Use "-o quiet" instead of "-q" for aptitude compatibility. diff -ur cron-apt-0.4.7.orig/src/cron-apt cron-apt-0.4.7/src/cron-apt --- cron-apt-0.4.7.orig/src/cron-apt 2006-04-30 17:21:27.000000000 +0100 +++ cron-apt-0.4.7/src/cron-apt 2006-07-10 16:59:21.000000000 +0100 @@ -197,6 +197,12 @@ # Ignore lines matching this regexp to determine whether changes occurred # for MAILON="changes". DIFFIGNORE="" +# What to do with the diff when *ON=changes. +# Value: prepend (prepend to the output) +# append (append to the output) +# only (only show the diff, not the output itself) +# (else do nothing) +DIFFONCHANGES=prepend export DEBIAN_FRONTEND="noninteractive" export LANG="C" cron-apt-0.9.2/patches/mail_on_upgrade_only.txt0000664000000000000000000000130411173250415016510 0ustar Hello, I have just tried cron-apt and found out there is a feature, I guess is good, not implemented. I think it is good if there is a choice of sending mail only if there are some packages to upgrade. I have made patches against 0.0.7, which implement these features. I am sending you these patches (against /etc/cron-apt/action.d/3-download and /usr/sbin/cron-apt). Can you please apply these patches on next version of cron-apt? Thanks Marcel Kolaja soLNet, s.r.o. http://www.solnet.cz/ -------------------------------------------------------------------------- "Linux hackers are funny people: They count the time in patchlevels." -- Martin Josefsson cron-apt-0.9.2/patches/mail_on_output.patch0000664000000000000000000000071311173250415015643 0ustar --- cron-apt.old Fri Mar 14 15:47:24 2003 +++ cron-apt Fri Mar 14 15:47:47 2003 @@ -131,6 +131,11 @@ if [ "$MAILON" = "always" ] ; then createinfo $MAIL $ACTIONF cat $TEMP >> $MAIL + elif [ "$MAILON" = "output" ]; then + if grep -qvE '^[[:space:]]*$|CRON-APT' $TEMP; then + createinfo $MAIL $ACTIONF + cat $TEMP >> $MAIL + fi fi if [ "$DEBUG" = "verbose" ] ; then createinfo $LOG $ACTIONF cron-apt-0.9.2/patches/mail_on_upgrade_only.author0000664000000000000000000000004111173250415017170 0ustar Marcel Kolaja cron-apt-0.9.2/patches/mail_on_changes.txt0000664000000000000000000000553111173250415015436 0ustar From: Marc Haber To: Debian Bug Tracking System Subject: how about a MAILON="changes" option? Bcc: Marc Haber X-Mailer: reportbug 2.64 Date: Sun, 08 Aug 2004 12:47:58 +0200 Message-ID: Delivered-To: submit@bugs.debian.org X-Spam-Checker-Version: SpamAssassin 2.60-bugs.debian.org_2004_03_25 (1.212-2003-09-23-exp) on spohr.debian.org X-Spam-Status: No, hits=-8.0 required=4.0 tests=BAYES_00,HAS_PACKAGE autolearn=no version=2.60-bugs.debian.org_2004_03_25 X-Spam-Level: [Message part 1 (text/plain, inline)] Package: cron-apt Version: 0.0.24 Severity: wishlist Tags: patch Please consider the attached patch that introduces a MAILON="changes" option which will send an e-mail if apt-get's output has actually changed. This allows cron-apt to be invoked often without swamping the admin with e-mails in the case that new packages are not automatically installed. The patch also includes hot fixes to some of the newly found bugs I have recently reported, so you probably can't take it verbatim. The output routine is probably wrong since I have not yet understood all of your recent changes. I am submitting the patch for your early review. It needs the options of action.d/0-update to be set to -qq instead of -q until #264175 has been sorted out. I have /etc/cron-apt/mailmsg.d/diff saying "This cron-apt run has generated different output than the last invocation. Incuding the output diff." I have a /etc/cron-apt/config-hourly with MAILON="changes" invoked hourly, while the normal daily cronjob still has MAILON="upgrade". That way, I am not swamped by hourly update requests, but I get update requests _once_ immediately after the packages have appeared in the archive, and from there on on a daily basis. Please let me know what you think. Greetings Marc --- cron-apt.orig 2004-08-08 12:03:31.000000000 +0200 +++ cron-apt 2004-08-08 12:39:17.000000000 +0200 @@ -73,6 +73,9 @@ ACTIONLOG=/var/log/cron-apt/actionlog INITLOG=/var/log/cron-apt/initlog LOG=/var/log/cron-apt/log +REF=/var/log/cron-apt/reflog +OLDREF=/var/log/cron-apt/reflog.old +DIFF=/var/log/cron-apt/reflog.diff MAILTO=root # error, always MAILON=error @@ -230,6 +233,9 @@ ############################### script ######################################## # Always run mailit before exit. +touch $REF +mv $REF $OLDREF +touch $REF for ACTIONF in $(ls $ACTIONDIR) ; do if echo "$ACTIONF" | grep "~" > /dev/null 2>&1 ; then # Temporary file, skipping. @@ -288,6 +294,7 @@ createloginfo $ACTIONF fi fi + tail -n +2 $TEMP >> $REF done exit }) @@ -298,4 +305,9 @@ fi done +if [ "$MAILON" = "changes" ] && ! diff -u $OLDREF $REF > $DIFF; then + createdivinfo $MAIL "" $DIFF $MAILMSGDIR/diff "" "" +fi +rm -f $DIFF + mailit cron-apt-0.9.2/patches/cron-apt-run-immediately.patch0000664000000000000000000000174711173250415017443 0ustar --- cron-apt 2003-07-22 12:57:05.000000000 +0200 +++ cron-apt-ri 2003-07-22 13:00:00.000000000 +0200 @@ -25,9 +25,13 @@ ############################# arguments ####################################### if [ "$1" = "--help" ] ; then - echo "USAGE: cron-apt [configfile]" + echo "USAGE: cron-apt [-i] [configfile]" exit 0 fi +if [ "$1" = "-i" ] ; then + RUNIMMEDIATELY="yes" + shift +fi CONFIG=$1 if [ -z "$CONFIG" ] ; then CONFIG=/etc/cron-apt/config @@ -66,6 +70,10 @@ echo "The config file $CONFIG does not exist, using defaults." fi +if test "$RUNIMMEDIATELY" = "yes"; then + RUNSLEEP=0 +fi + ############################## functions ###################################### # Send the mail to the system administrator. Will only be sent if there is @@ -112,7 +120,7 @@ ############################### sleep ######################################### -if [ -n "$RUNSLEEP" ] ; then +if [ "$RUNSLEEP" -gt 0 ] ; then sleep $(($RANDOM % $RUNSLEEP)) fi cron-apt-0.9.2/patches/cron-apt-run-immediately.author0000664000000000000000000000004311173250415017632 0ustar Marcel Kolaja cron-apt-0.9.2/patches/multiple-configs.patch0000664000000000000000000000222011173250415016061 0ustar From: Marc Haber --- cron-apt.orig 2004-12-04 12:44:18.000000000 +0100 +++ cron-apt 2004-12-04 12:46:35.000000000 +0100 @@ -83,10 +83,11 @@ ############################# arguments ####################################### STDOUT="" +ALLCONFIGS="" while [ -n "$*" ] ; do if [ "$1" = "--help" ] ; then - echo "USAGE: cron-apt [-i] [-s] [configfile]" + echo "USAGE: cron-apt [-i] [-s] [configfiles]" exit 0 elif [ "$1" = "-i" ] ; then RUNIMMEDIATELY="yes" @@ -97,11 +98,13 @@ shift else CONFIG="$1" + ALLCONFIGS="$ALLCONFIGS $CONFIG" shift fi done if [ -z "$CONFIG" ] ; then CONFIG=/etc/cron-apt/config + ALLCONFIGS="$CONFIG" fi ############################## lib and tmp dirs ############################### @@ -166,11 +169,13 @@ export LC_ALL="C" # Read configuration. -if [ -f "$CONFIG" ] ; then - . "$CONFIG" -else - echo "The config file $CONFIG does not exist, using defaults." -fi +for cfg in $ALLCONFIGS; do + if [ -f "$cfg" ] ; then + . "$cfg" + else + echo >&2 "The config file $cfg does not exist." + fi +done if [ -t 0 ]; then RUNIMMEDIATELY="yes" cron-apt-0.9.2/patches/better-sh-compatibility.patch0000664000000000000000000000365611173250415017362 0ustar From: David Weinehall This patch, should you choose to accept it, makes cron-apt a /bin/sh-script instead of a /bin/bash-script. Regards: David Weinehall diff -ur cron-apt-0.0.20-old/src/cron-apt cron-apt-0.0.20/src/cron-apt --- cron-apt-0.0.20-old/src/cron-apt 2004-04-16 13:11:20.000000000 +0300 +++ cron-apt-0.0.20/src/cron-apt 2004-07-18 11:28:01.000000000 +0300 @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # DocumentId: $Id: better-sh-compatibility.patch 2622 2009-03-24 19:59:59Z ola $ # Changes: # 2003-07-10 Ola Lundqvist @@ -118,0 +118,0 @@ ############################### check ######################################### -if [ -e $ERROR -a "$DONTRUN" = "error" ] ; then +if [ -e $ERROR ] && [ "$DONTRUN" = "error" ] ; then echo "Error in last update. Fix the problem and remove $ERROR." exit fi @@ -157,7 +157,7 @@ cat $ERRORMSGDIR/$ACTIONF >> $ERROR fi cat $TEMP >> $ERROR - if [ "$MAILON" = "error" -o "$MAILON" = "upgrade" -o "$MAILON" = "always" ] ; then + if [ "$MAILON" = "error" ] || [ "$MAILON" = "upgrade" ] || [ "$MAILON" = "always" ] ; then createinfo $MAIL $ACTIONF if [ -f $MAILMSGDIR/$ACTIONF ] ; then cat $MAILMSGDIR/$ACTIONF >> $MAIL @@ -172,7 +172,7 @@ cat $TEMP >> $MAIL fi fi - if [ "$DEBUG" = "error" -o "$MAILON" = "upgrade" -o "$DEBUG" = "verbose" ] ; then + if [ "$DEBUG" = "error" ] || [ "$MAILON" = "upgrade" ] || [ "$DEBUG" = "verbose" ] ; then createinfo $LOG $ACTIONF if [ -f $LOGMSGDIR/$ACTIONF ] ; then cat $LOGMSGDIR/$ACTIONF >> $LOG cron-apt-0.9.2/patches/simultanious-cron-apt.patch0000664000000000000000000001043011173250415017057 0ustar From: Marc Haber Index: src/cron-apt =================================================================== --- src/cron-apt (revision 1926) +++ src/cron-apt (working copy) @@ -93,51 +93,61 @@ CONFIG=/etc/cron-apt/config fi +############################## lib and tmp dirs ############################### + +LIBDIR="/var/lib/cron-apt" +CONFIGDIRNAME="$(echo $CONFIG | sed 's|/|_-_|g')" +TMPDIR="/tmp/cron-apt/$$" + +INITLOG="$TMPDIR/initlog" +RUNERROR="$TMPDIR/runerror" +RUNSYSLOG="$TMPDIR/runsyslog" +RUNLOG="$TMPDIR/runlog" +RUNMAIL="$TMPDIR/runmail" +ACTIONERROR="$TMPDIR/actionerror" +ACTIONSYSLOG="$TMPDIR/actionsyslog" +ACTIONLOG="$TMPDIR/actionlog" +ACTIONMAIL="$TMPDIR/actionmail" +TEMP="$TMPDIR/temp" +MAIL="$TMPDIR/mail" +DIFF="$TMPDIR/difftemp" +STATUS="$TMPDIR/status" + +LOCKFILE="$LIBDIR/lockfile" +MAILCHDIR="$LIBDIR/$CONFIGDIRNAME/mailchanges" +ERROR="$TMPDIR/$CONFIGDIRNAME/error" + ############################## defaults ####################################### -ACTIONDIR=/etc/cron-apt/action.d -ACTIONCONFDIR=/etc/cron-apt/config.d -MAILMSGDIR=/etc/cron-apt/mailmsg.d -MAILONMSGSDIR=/etc/cron-apt/mailonmsgs -SYSLOGONMSGSDIR=/etc/cron-apt/syslogonmsgs -ERRORMSGDIR=/etc/cron-apt/errormsg.d -SYSLOGMSGDIR=/etc/cron-apt/syslogmsg.d -LOGMSGDIR=/etc/cron-apt/logmsg.d -RUNERROR=/var/lib/cron-apt/runerror -ACTIONERROR=/var/lib/cron-apt/actionerror -ERROR=/var/log/cron-apt/error -TEMP=/var/lib/cron-apt/temp -RUNMAIL=/var/lib/cron-apt/runmail -ACTIONMAIL=/var/lib/cron-apt/actionmail -MAIL=/var/log/cron-apt/mail -RUNSYSLOG=/var/lib/cron-apt/runsyslog -RUNLOG=/var/lib/cron-apt/runlog -ACTIONSYSLOG=/var/lib/cron-apt/actionsyslog -ACTIONLOG=/var/lib/cron-apt/actionlog -INITLOG=/var/lib/cron-apt/initlog -LOG=/var/log/cron-apt/log -DIFF=/var/lib/cron-apt/difftemp -DIFFONCHANGES=prepend -MAILCHDIR=/var/lib/cron-apt/mailchanges -STATUS=/var/lib/cron-apt/status -MAILTO=root + +ACTIONDIR="/etc/cron-apt/action.d" +ACTIONCONFDIR="/etc/cron-apt/config.d" +MAILMSGDIR="/etc/cron-apt/mailmsg.d" +MAILONMSGSDIR="/etc/cron-apt/mailonmsgs" +SYSLOGONMSGSDIR="/etc/cron-apt/syslogonmsgs" +ERRORMSGDIR="/etc/cron-apt/errormsg.d" +SYSLOGMSGDIR="/etc/cron-apt/syslogmsg.d" +LOGMSGDIR="/etc/cron-apt/logmsg.d" +LOG="/var/log/cron-apt/log" +DIFFONCHANGES="prepend" +MAILTO="root" # error, always, never -SYSLOGON=upgrade +SYSLOGON="upgrade" # error, always -MAILON=error +MAILON="error" # error, never -EXITON=error +EXITON="error" # verbose, error -DEBUG=verbose +DEBUG="verbose" # general options -OPTIONS=-q +OPTIONS="-q" # do always run as default -DONTRUN= +DONTRUN="" # Random sleep time before run -RUNSLEEP=3600 +RUNSLEEP="3600" -export DEBIAN_FRONTEND=noninteractive -export LANG=C -export LC_ALL=C +export DEBIAN_FRONTEND="noninteractive" +export LANG="C" +export LC_ALL="C" # Read configuration. if [ -f "$CONFIG" ] ; then @@ -193,6 +203,10 @@ mail -s "$SUBJECT" "$MAILTO" < "$MAIL" rm -f "$MAIL" fi + TMPDIR=$(echo $TMPDIR | sed 's|^/tmp/cron-apt||') + if [ -e "/tmp/cron-apt/$TMPDIR" ]; then + rm -rf "/tmp/cron-apt/$TMPDIR" + fi } # Do the actual msg transfer. This reduce some duplications. @@ -296,6 +310,12 @@ ############################### check ######################################### +if ! [ -d "$LIBDIR/$CONFIGDIRNAME" ]; then + mkdir -p "$LIBDIR/$CONFIGDIRNAME" +fi +if ! [ -d "$MAILCHDIR" ]; then + mkdir -p "$MAILCHDIR" +fi if [ -e "$ERROR" ] && [ "$DONTRUN" = "error" ] ; then echo "Error in last update. Fix the problem and remove $ERROR." exit @@ -309,6 +329,11 @@ ############################### sleep ######################################### +if [ -e "$TMPDIR" ]; then + echo "Error: $TMPDIR does already exist." + exit +fi +mkdir -p "$TMPDIR" echo "CRON-APT RUN [$CONFIG]: $(date)" > $INITLOG if [ -n "$RUNSLEEP" ] ; then if [ $RUNSLEEP -gt 0 ] ; then @@ -345,7 +370,15 @@ grep -v "^[[:space:]]*$" | { while read LINE ; do echo "CRON-APT LINE: $LINE" > "$TEMP" - if ! apt-get $OPTIONS $LINE >> $TEMP 2>&1 ; then + if ! dotlockfile -l -p -r 10 $LOCKFILE; then + echo > $TEMP "cannot acquire apt lock." + RET=1 + else + apt-get $OPTIONS $LINE >> $TEMP 2>&1 + RET=$? + fi + dotlockfile -u $LOCKFILE + if [ $RET -ne 0 ]; then # --- # An error has occured. createerrorinfo $ACTIONF cron-apt-0.9.2/patches/476751.diff0000664000000000000000000000066511654433416013211 0ustar --- cron-apt.orig 2011-02-09 15:17:27.000000000 +0100 +++ cron-apt.new 2011-02-09 15:17:02.000000000 +0100 @@ -350,7 +350,7 @@ sed -e "s/#.*$//;" | \ grep -v "^[[:space:]]*$" | { while read LINE ; do - echo "CRON-APT LINE: $APTCOMMAND $LINE" > "$TEMP" + echo "CRON-APT LINE: $APTCOMMAND $OPTIONS $LINE" > "$TEMP" UMASK_SAVE=$(umask) umask $UMASK_APT $APTCOMMAND $OPTIONS $LINE >> $TEMP 2>&1 cron-apt-0.9.2/patches/configurable-aptitude.patch0000664000000000000000000000770311173250415017070 0ustar From: Marc Sherman --- /usr/sbin/cron-apt.orig 2004-12-25 11:53:47.000000000 -0500 +++ /usr/sbin/cron-apt 2004-12-26 11:00:16.000000000 -0500 @@ -18,6 +18,8 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # # Changes: +# 2004-12-25 Marc Sherman +# Added configurable support for aptitude instead of apt-get. # 2004-09-23 Ola Lundqvist # Escaped changes file data so '/' can be used in action.d lines. # 2004-09-19 Marc Haber @@ -131,6 +133,7 @@ TEMP="$TMPDIR/temp" MAIL="$TMPDIR/mail" DIFF="$TMPDIR/difftemp" +FILTER="$TMPDIR/filtertemp" STATUS="$TMPDIR/status" LOCKFILE="$LIBDIR/lockfile" @@ -160,11 +163,17 @@ # verbose, error DEBUG="verbose" # general options -OPTIONS="-q" +OPTIONS="-o quiet=1" # do always run as default DONTRUN="" # Random sleep time before run RUNSLEEP="3600" +# The command to use (can be aptitude instead) +APTCOMMAND="/usr/bin/apt-get" +# If FILTERCTRLM is "true", then any line containing ^M in the apt-get +# output will be filtered from log/mail/console output. This is useful +# with aptitude, which does not currently support -qq (very quiet). +FILTERCTRLM="false" export DEBIAN_FRONTEND="noninteractive" export LANG="C" @@ -232,6 +241,9 @@ if [ -f "$DIFF" ] ; then rm -f "$DIFF" fi + if [ -f "$FILTER" ] ; then + rm -f "$FILTER" + fi if [ -d "$TMPDIR" ] ; then rmdir "$TMPDIR" fi @@ -390,7 +402,7 @@ else UMASK_SAVE=$(umask) umask $UMASK_RELAXED - apt-get $OPTIONS $LINE >> $TEMP 2>&1 + $APTCOMMAND $OPTIONS $LINE >> $TEMP 2>&1 RET=$? umask $UMASK_SAVE fi @@ -402,10 +414,14 @@ fi UMASK_SAVE=$(umask) umask $UMASK_RELAXED - apt-get $OPTIONS $LINE >> $TEMP 2>&1 + $APTCOMMAND $OPTIONS $LINE >> $TEMP 2>&1 RET=$? umask $UMASK_SAVE fi + if [ "$FILTERCTRLM" == "true" ]; then + grep -v "" "$TEMP" > "$FILTER" + cp "$FILTER" "$TEMP" + fi if [ $RET -ne 0 ]; then # --- # An error has occured. --- /etc/cron-apt/config.orig 2004-12-25 11:49:41.000000000 -0500 +++ /etc/cron-apt/config 2004-12-26 10:49:07.000000000 -0500 @@ -3,6 +3,19 @@ # This shows the defaults. # +# The command used to execute all actions. By default, apt-get is used. +# Change this to /usr/bin/aptitude to use aptitude instead, which will +# resolve changed Recommends (and Suggests as well, if aptitude is so +# configured). +# APTCOMMAND=/usr/bin/apt-get +APTCOMMAND=/usr/bin/aptitude + +# If FILTERCTRLM is "true", then any line containing ^M in the apt-get +# output will be filtered from log/mail/console output. This is useful +# with aptitude, which does not currently support -qq (very quiet). +# FILTERCTRLM="false" +FILTERCTRLM="true" + # A path is needed for this to work. This is the default PATH. # export PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin @@ -105,9 +118,10 @@ DIFFONCHANGES=prepend # General apt options that will be passed to all apt-get calls. -# OPTIONS="-q" +# Use "-o quiet" instead of "-q" for aptitude compatibility. +# OPTIONS="-o quiet=1" # You can for example add an alternative sources.list file here. -# OPTIONS="-q -o Dir::Etc::SourceList=/etc/apt/security.sources.list" +# OPTIONS="-o quiet=1 -o Dir::Etc::SourceList=/etc/apt/security.sources.list" # Do not run the command, if there is an error in the previous run (default). # Value: error (do not run if there is an error on last run) --- /etc/cron-apt/action.d/0-update.orig 2004-12-25 12:14:48.000000000 -0500 +++ /etc/cron-apt/action.d/0-update 2004-12-25 12:15:11.000000000 -0500 @@ -1 +1 @@ -update -qq +update -o quiet=2 --- /etc/cron-apt/action.d/3-download.orig 2004-12-25 12:15:21.000000000 -0500 +++ /etc/cron-apt/action.d/3-download 2004-12-25 12:21:25.000000000 -0500 @@ -1,2 +1,2 @@ autoclean -y -dist-upgrade -d -u -y +dist-upgrade -d -y -o APT::Get::Show-Upgraded=true cron-apt-0.9.2/patches/mail_on_upgrade_only-cron-apt.patch0000664000000000000000000000174711173250415020524 0ustar --- cron-apt Wed Apr 24 00:00:00 2002 +++ cron-apt-magic Wed Jul 31 14:32:28 2002 @@ -114,11 +114,11 @@ # An error has occured. createinfo $ERROR $ACTIONF cat $TEMP >> $ERROR - if [ "$MAILON" = "error" -o "$MAILON" = "always" ] ; then + if [ "$MAILON" = "error" -o "$MAILON" = "upgrade" -o "$MAILON" = "always" ] ; then createinfo $MAIL $ACTIONF cat $TEMP >> $MAIL fi - if [ "$DEBUG" = "error" -o "$DEBUG" = "verbose" ] ; then + if [ "$DEBUG" = "error" -o "$MAILON" = "upgrade" -o "$DEBUG" = "verbose" ] ; then createinfo $LOG $ACTIONF cat $TEMP >> $LOG fi @@ -131,6 +131,12 @@ if [ "$MAILON" = "always" ] ; then createinfo $MAIL $ACTIONF cat $TEMP >> $MAIL + fi + if [ "$MAILON" = "upgrade" ] ; then + if grep -q 'The following packages will be upgraded' $TEMP ; then + createinfo $MAIL $ACTIONIF + cat $TEMP >> $MAIL + fi fi if [ "$DEBUG" = "verbose" ] ; then createinfo $LOG $ACTIONF cron-apt-0.9.2/patches/mail_on_upgrade_only-3-download.patch0000664000000000000000000000022511173250415020736 0ustar --- 3-download Wed Apr 24 00:00:00 2002 +++ 3-download-magic Wed Jul 31 14:48:07 2002 @@ -1,2 +1,2 @@ -upgrade -d -y +upgrade -d -u -y autoclean -y cron-apt-0.9.2/patches/run-parts-behaviour.patch0000664000000000000000000000316711173250415016530 0ustar From: Marc Haber --- cron-apt~ 2004-08-20 21:41:30.000000000 +0000 +++ cron-apt 2004-09-05 15:57:20.000000000 +0000 @@ -272,6 +272,26 @@ createdivinfo "$ERROR" "$TEMP" "$ERRORMSGDIR/$1" "$RUNERROR" "$ACTIONERROR" } +# run-parts emulation, stolen from Branden's /etc/X11/Xsession +run_parts () { + # reset LC_COLLATE + unset LANG LC_COLLATE LC_ALL + + if [ -z "$1" ]; then + echo >&2 "$0: internal run_parts called without an argument" + fi + if [ ! -d "$1" ]; then + echo >&2 "$0: internal run_parts called, but $1 does not exist or is not a directory." + fi + for F in $(ls $1); do + if expr "$F" : '[[:alnum:]_-]\+$' > /dev/null 2>&1; then + if [ -f "$1/$F" ] ; then + echo "$1/$F" + fi + fi + done; +} + ############################### check ######################################### if [ -e "$ERROR" ] && [ "$DONTRUN" = "error" ] ; then @@ -309,17 +329,8 @@ ############################### script ######################################## # Always run onexit before exit. -for ACTIONF in $(ls "$ACTIONDIR") ; do - if echo "$ACTIONF" | grep "~" > /dev/null 2>&1 ; then - # Temporary file, skipping. - : - elif echo "$ACTIONF" | grep ".dpkg-dist" > /dev/null 2>&1 ; then - # dpkg-dist file - : - elif echo "$ACTIONF" | grep ".dpkg-old" > /dev/null 2>&1 ; then - # dpkg-old file - : - elif [ -f "$ACTIONDIR/$ACTIONF" ] ; then +for ACTION in $(run_parts "$ACTIONDIR") ; do + ACTIONF=$(echo $ACTION | sed "s|$ACTIONDIR||") if [ -f "$ACTIONCONFDIR/$ACTIONF" ] ; then . "$ACTIONCONFDIR/$ACTIONF" fi @@ -452,7 +463,6 @@ fi rm -f "$STATUS" fi - fi done onexit cron-apt-0.9.2/patches/315731-filterctrlm-fix.patch0000664000000000000000000000124611173250415016463 0ustar Please consider this patch which will improve FILTERCTRLM behavior. cron-apt diff handling needs to adapt to aptitude as well, since aptitude update seems to create "Hit" lines out of order. I will investigate. Greetings Marc --- cron-apt.orig 2005-06-20 11:51:43.000000000 +0200 +++ /usr/sbin/cron-apt 2005-06-25 14:35:33.000000000 +0200 @@ -430,8 +430,10 @@ umask $UMASK_SAVE fi if [ "$FILTERCTRLM" = "true" ]; then - grep -v " -" "$TEMP" > "$FILTER" + CTRLM="$(echo -e \\r)" + < "$TEMP" sed "s/.*$CTRLM\(.\+\)/\1/" > "$FILTER" + #grep -v " +#" "$TEMP" > "$FILTER" cp "$FILTER" "$TEMP" fi if [ $RET -ne 0 ]; then cron-apt-0.9.2/patches/better-sh-compatibility.suggestion0000664000000000000000000000042411173250415020440 0ustar Random can be replaced by the following: RAND=`dd if=/dev/urandom count=1 2> /dev/null | cksum | cut -c"1-5"` As for the read -e, I cannot come with any good suggestions. Is there a particular reason for using readline instead of the normal way? Regards: David Weinehall cron-apt-0.9.2/patches/dotlockfile-warning.patch0000664000000000000000000000355011173250415016551 0ustar From: Marc Haber diff -urN cron-apt/conf/config cron-apt-0.0.34.0/conf/config --- cron-apt/conf/config 2004-08-13 08:24:47.000000000 +0200 +++ cron-apt-0.0.34.0/conf/config 2004-09-19 22:27:24.000000000 +0200 @@ -48,6 +48,10 @@ # the $SYSLOGON directive. # SYSLOGONMSGSDIR=/etc/cron-apt/syslogonmsgs +# Value: "" (warn if dotlockfile not installed) +# "nowarn" (don't give warning if dotlockfile not installed) +# NOLOCKWARN="" + # The file that contains error messages. # ERROR=/var/log/cron-apt/error diff -urN cron-apt/debian/changelog cron-apt-0.0.34.0/debian/changelog --- cron-apt/debian/changelog 2004-09-15 13:34:43.000000000 +0200 +++ cron-apt-0.0.34.0/debian/changelog 2004-09-19 22:36:19.000000000 +0200 @@ -1,3 +1,9 @@ +cron-apt (0.0.34.0) unstable; urgency=low + + * add warning if dotlockfile not found + + -- Marc Haber Sun, 19 Sep 2004 22:36:05 +0200 + cron-apt (0.0.34) unstable; urgency=low * Made locking optional but recommended. Also added recommends on diff -urN cron-apt/src/cron-apt cron-apt-0.0.34.0/src/cron-apt --- cron-apt/src/cron-apt 2004-09-15 13:34:43.000000000 +0200 +++ cron-apt-0.0.34.0/src/cron-apt 2004-09-19 22:32:00.000000000 +0200 @@ -135,6 +135,7 @@ MAILMSGDIR="/etc/cron-apt/mailmsg.d" MAILONMSGSDIR="/etc/cron-apt/mailonmsgs" SYSLOGONMSGSDIR="/etc/cron-apt/syslogonmsgs" +NOLOCKWARN="" ERRORMSGDIR="/etc/cron-apt/errormsg.d" SYSLOGMSGDIR="/etc/cron-apt/syslogmsg.d" LOGMSGDIR="/etc/cron-apt/logmsg.d" @@ -381,6 +382,10 @@ fi dotlockfile -u $LOCKFILE else + if [ -z "$NOLOCKWARN" ]; then + echo > $TEMP "WARNING: dotlockfile not installed. If you don't want to see this" + echo >> $TEMP " Warning any more, set NOLOCKWARN in the config file." + fi apt-get $OPTIONS $LINE >> $TEMP 2>&1 RET=$? fi cron-apt-0.9.2/COPYING0000664000000000000000000004310311173250415011170 0ustar GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Lesser General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. cron-apt-0.9.2/Makefile0000664000000000000000000000070511237732522011603 0ustar MAKEDIRS = src conf man LOGDIR=/var/log/cron-apt LIBDIR=/var/lib/cron-apt all: for md in $(MAKEDIRS) ; do \ $(MAKE) -C $$md $@ ; \ done clean: for md in $(MAKEDIRS) ; do \ $(MAKE) -C $$md $@ ; \ done install: for md in $(MAKEDIRS) ; do \ $(MAKE) -C $$md $@ ; \ done # Log mkdir -p $(DESTDIR)$(LOGDIR) # Lib mkdir -p $(DESTDIR)$(LIBDIR) mkdir -p $(DESTDIR)$(LIBDIR)/mailchanges test: test.forced test.forced: $(MAKE) -C test test cron-apt-0.9.2/AUTHORS0000664000000000000000000000240311237732522011210 0ustar Ola Lundqvist Main author for everything if nothing else is stated. Marc Haber Invented the idéa of mailon=changes and wrote the initial patch. Has provided valuable ideas and testing. Implemented locking with dotlockfile. Added some new options. A number of improvements and fixes. More general locking. Graceful error message if the mail command is not available. Better check for /tmp directory size. The idea to have variables that are applicable for only the action item. Marc Sherman Implemented support for aptitude in addition to apt-get. Valery Perrin Translation of the French manual page. Felix Palmen Documentation on how to set APT_CONFIG configuration for apt. Bob Proulx Correction of MAILONMSGSDIR and SYSLOGONMSGSDIR. Some ideas and suggestions about POSIX compliance and /dev/random. David Weinehall Suggestion on POSIX compatible random generation. Sean Finney Patch for mailon=output option Marcel Kolaja Patches for mail on upgrade function. Edward Malone Code suggestion (more or less a patch) for mail headers support. cron-apt-0.9.2/README0000664000000000000000000003616112147751526011036 0ustar cron-apt for Debian ------------------- The intention of cron-apt is to automate the process to upgrade the Debian GNU/Linux operating system. By default it only download packages which means that the actual installation/upgrade must be done manually. It is possible to fully update the upgrade procedure if you want but be aware that this may break the installation in case something goes wrong. General Configuration: ---------------------- All cron-apt configuration is placed in /etc/cron-apt. The structure of that directory is as follows. Main configuration: - config - action.d/ - config.d/ Additional configuration for logging: - *msg.d/ - *msgs/ The general principle of cron-apt configuration is that actions are defined in /etc/cron-apt/action.d/. Each action file can contain one or more lines to execute. Each line in an action file is passed as an argument to apt-get (or more precisely the command defined by the APTCOMMAND and OPTIONS configuration variables). The actions are executed in alphabetical order and line by line. Use a number from zero (0) to nine (9) to give a precise order. The default actions are: * 0-update: Updates the list of known packages * 3-download: Downloads the updated packages but do not install them The file /etc/cron-apt/config holds the main configuration data. It is also possible to add extra configuration for each action (same syntax as /etc/cron-apt/config) by naming the file /etc/cron-apt/config.d/. The configuration from one action is kept to the next action as well. Configuration file syntax: -------------------------- The configuration files (/etc/cron-apt/config and /etc/cron-apt/config.d/) consists of a number of variables that can be set to values as outlined below. In addition they follow the POSIX /bin/sh syntax which means that they can be used for hooks and simlar things as well as simply setting variables. These variables are described below with their default value. APTCOMMAND=/usr/bin/apt-get (default) The command used to execute all actions. By default apt-get is used and this is also the recommended command to use. For more information see above. Alternative settings can be: APTCOMMAND=/usr/bin/aptitude APTCOMMAND=/usr/bin/apt-file OPTIONS="-o quiet=1" General apt options that will be passed to all APTCOMMAND calls. Use "-o quiet" instead of "-q" for aptitude compatibility. You can for example add an additional sources.list file here. OPTIONS="-o quiet=1 --no-list-cleanup -o Dir::Etc::SourceList=/etc/apt/security.sources.list" You can also set an alternative sources.list file here. OPTIONS="-o quiet=1 --no-list-cleanup -o Dir::Etc::SourceList=/etc/apt/securi ty.sources.list -o Dir::Etc::SourceParts=\"/dev/null\"" If you want to allow unauthenticated and untrusted packages add the following to your options directive. OPTIONS="-o quiet=1 -o APT::Get::AllowUnauthenticated=true -o aptitude::Cmdli ne::ignore-trust-violations=yes" To limit the bandwidth used use the following line. This example limit the bandwidth usage to 25 kB/s. OPTIONS="-o Acquire::http::Dl-Limit=25" MAILON="error" When to send email about the cron-apt results. Value: error (send mail on error runs) upgrade (when packages are upgraded) changes (mail when change in output from an action) output (send mail when output is generated) always (always send mail) never (never send mail) (else never send mail) SYSLOGON="upgrade" When to log the cron-apt results to syslog. Value: error (syslog on error runs) upgrade (when packages is upgraded) changes (syslog when change in output from an action) output (syslog when output is generated) always (always syslog) never (never syslog) (else never syslog) RUNSLEEP=3600 The random sleep time in seconds. This is used to prevent clients from accessing the APT sources all at the same time and overwhelming them. Default is 3600 seconds which means one hour. DONTRUN="" Do not run the command, if there is an error in the previous run (default). Value: error (do not run if there is an error on last run) (else always run, remove previous error file and run) MAILTO="root" The email address to send mail to. DEBUG="output" When to log to the cron-apt log file. Value: verbose (log everything) always (always log) upgrade (when packages is upgraded) changes (log when change in output from an action) output (log when output is generated) error (log error runs only) never (log nothing) (else log nothing) DIFFONCHANGES=prepend What to do with the diff when *ON is set to 'changes'. Value: prepend (prepend to the output) append (append to the output) only (only show the diff, not the output itself) (else do nothing) REFRAINFILE=/etc/cron-apt/refrain If this file exist cron-apt will silently exit. HOSTNAME="" If this is non-empty, it will be used as the host name in subjects of generated e-mail messages. If this is empty, the output of uname -n will be used. DIFFIGNORE="" Ignore lines matching this regexp to determine whether changes occurred for MAILON="changes". If empty no lines will be ignored. Suggested value for aptitude: DIFFIGNORE="^\(Get:[[:digit:]]\+\|Hit\|Ign\|Del\|Fetched\|Freed\|Reading\)[[:space:]]" Suggested value for apt-get: DIFFIGNORE="^\(Get:[[:digit:]]\+\|Hit\|Ign\)[[:space:]]" XHEADER* Support for mail headers. You can add up to 9 headers to the mail sent. This below example can be used for OTRS. The default is no headers added. XHEADER1="X-OTRS-Queue: updates" XHEADER2="X-OTRS-Loop: true" ... APT_CONFIG=/etc/apt/cron.apt.paths Additional APT configuration file that is loaded first. This can be set in order to use a completely different APT configuration for cron-apt. See the /usr/share/doc/cron-apt/README and apt.conf(5) for details export APT_CONFIG=/etc/apt/cron.apt.paths PATH A path is needed for cron-apt to work. The default PATH is as written below. export PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin MINTMPDIRSIZE=10 The minimum amount of disc space (in kB) that need to exist on the device where temporary files are created (mktemp) to allow cron-apt to run. If set to 0 it will always continue even if empty. ACTIONDIR="/etc/cron-apt/action.d" The directory where the actions is stored. ACTIONCONFDIR="/etc/cron-apt/config.d" The directory where configuration per action is stored. The message file must have the same name as the action file. MAILMSGDIR="/etc/cron-apt/mailmsg.d" The directory where messages that will be prepended to the email that is sent (per action) is stored. The message file must have the same name as the action file. SYSLOGMSGDIR="/etc/cron-apt/syslogmsg.d" The directory where messages that will be prepended to text that is sent (per action) to syslog. The message file must have the same name as the action file. ERRORMSGDIR="/etc/cron-apt/errormsg.d" The directory where messages that will be prepended to the error message (per action) is stored. The message file must have the same name as the action file. LOGMSGDIR="/etc/cron-apt/logmsg.d" The directory where messages that will be prepended to the log (debug) message (per action) is stored. The message file must have the same name as the action file. MAILONMSGSDIR="/etc/cron-apt/mailonmsgs" The directory where messages that will be prepended to the mail message (per MAILON type) is stored. The message file must have the same name as the MAILON directive. SYSLOGONMSGSDIR="/etc/cron-apt/syslogonmsgs" The directory where messages that will be prepended to the syslog message (per SYSLOGON type) is stored. The message file must have the same name as the SYSLOGON directive. NOLOCKWARN="" Whether to warn about the fact that dotlockfile is not installed. Value: "" (warn if dotlockfile is not installed) "nowarn" (don't give warning if dotlockfile not installed) ERROR="/var/log/cron-apt/error" The temporary file that contains error messages. TEMP="/var/log/cron-apt/temp" The temporary file that contains current run information when still running the script. LOG="/var/log/cron-apt/log" The temporary logfile (for debugging). Use syslog for normal logging. MAIL="/var/log/cron-apt/mail" The temporary file that contain information to be sent in email. EXITON="error" Whether to exit on errors or not. Value: error (exit on error only) (else never exit) UMASK_APT="022" Umask for the files created by the APT command used. In all other cases umask 077 will be used. Alternative APT command: ------------------------ The APTCOMMAND configuration variable defines the APT command to use to execute the actions. By default /usr/bin/apt-get is used and this is is also the recommended command to use. But you can actually use any program you like. Although aptitude is the recommended tool for interactive upgrades, for cron-apt's purposes apt-get is better and, for most configurations, the extra features of aptitude are not relevant. If you insist on using aptitide, you will have to work around some of its bugs. OBSERVE that cron-apt is indended to use apt-get and tools like aptitude do not have full support for noninteractive upgrades. You may have to tune options to not create infinit logfiles for example. Setting it to /usr/bin/aptitude (to use aptitude instead of apt-get) will resolve changed Recommends (and Suggests as well, if aptitude is configured so). You can also set other utilities (especially useful for files in the config.d/ directory) to set some completely different tool. Configuration for logging: -------------------------- In addition to the main configuration it is possible to define extra information to be logged at execution. The principle is that files in msg.d/ is logged for each action and files in msgs/ are logged for matching configuration directive. The the below descriptions the following tag syntax is used: [TAG]. The tag means that this configuration is only used in case the TAG configuration variable tell that logging should be done. * /etc/cron-apt/errormsg.d/ Contains a file for each action to log in case an error occur in the corresponding action. This is used in case any of the configuration directive tells that logging should be done. * /etc/cron-apt/logmsg.d/ [DEBUG] Contains a file for each action to log to stdout. * /etc/cron-apt/mailmsg.d/ [MAILON] Contains a file for each action to prepend to the email sent. * /etc/cron-apt/syslogmsg.d/ [SYSLOGON] Contain files for each action to log in syslog. * /etc/cron-apt/mailonmsgs/ [MAILON] Contain files, with name corresponding to the MAILON configuration variable, with text to prepend to the email sent. * /etc/cron-apt/syslogonmsgs/ [SYSLOGON] Contain files, with name corresponding to the SYSLOGON configuration variable, with text to log to syslog. For more details about this see 'Configuration file syntax' below. Regular execution: ------------------ If you want this tool to be run even if you do not have it up at 04 in the morning you can create a symbolic link from /etc/cron.daily/cron-apt to /usr/sbin/cron-apt. It will then be run every day (even if the computer is not on at that time). Similar things can be done for each week, and so on. You have to have anacron installed for this to work. If not, daily scripts run 6 AM by crond. ln -s /usr/sbin/cron-apt /etc/cron.daily/cron-apt Observe that it is not always a good thing to update package information and download files when the computer is started. This is especially true if you do not have a good Internet connection. You also need to disable the normal cron.d/cron-apt file if you do not want it to be run twice. Alternate sources.list file --------------------------- If you just want to update security related things you can always use an alternate sources.list files by giving this extra information to the OPTIONS variable in the configuration file. OPTIONS="-o quiet=1 --no-list-cleanup -o Dir::Etc::SourceList=/etc/apt/security.sources.list -o Dir::Etc::SourceParts=\"/dev/null\"" Alternatively you can use a separate APT configuration file as described in the chapter below. You can for example point to a source list as follows: Dir::Etc::SourceList "/etc/apt/security.sources.list"; Dir::Etc::SourceParts "/dev/null" In that case you only need to update the OPTIONS variable to include the '--no-list-cleanup' argument. Alternate APT main configuration -------------------------------- There are cases when you need the APT configuration for use with cron-apt to differ substantially from your standard configuration. For example, cron-apt will not work with the default configuration of APT, when apt-listbugs is installed, because this adds a hook that expects keyboard interactivity. Unfortunately, the apt-tools do not accept Dir::Etc::Main and Dir::Etc::Parts settings on the command-line. In order to use different paths for them, you have to create another APT configuration file containing eg: Dir::Etc::Main "cron.apt.conf"; Dir::Etc::Parts "cron.apt.conf.d"; Then uncomment the following line in your cron-apt configuration file and point it to your newly created APT configuration file: export APT_CONFIG=/etc/apt/cron.apt.paths Don't forget additional options you might have set in /etc/apt/apt.conf since this file is no longer use when APT_CONFIG point to another conf file. Development and documentation ----------------------------- If you want more information about this software you can visit the homepage at http://inguza.com/software/cron-apt/. You can find documentation, development information and other things there. Copyright information: ---------------------- Copyright (C) 2002-2011,2013 Ola Lundqvist Copyright (C) 2009 Edward Malone Copyright (C) 2004-2011,2013 Marc Haber Copyright (C) 2004,2007,2013 Bob Proulx Copyright (C) 2006 Felix Palmen Copyright (C) 2004 Marc Sherman Copyright (C) 2004 David Weinehall Copyright (C) 2003 Sean Finney Copyright (C) 2002 Marcel Kolaja License terms ------------- This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program as the file COPYING; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.