[25377] in Source-Commits

home help back first fref pref prev next nref lref last post

Re: /svn/athena r24935 - trunk/debathena/config/auto-update/debian

daemon@ATHENA.MIT.EDU (Jonathan Reed)
Thu Feb 3 14:45:28 2011

Content-Type: text/plain; charset=us-ascii
Mime-Version: 1.0 (Apple Message framework v1082)
From: Jonathan Reed <jdreed@MIT.EDU>
In-Reply-To: <201102031942.p13JghNu003827@drugstore.mit.edu>
Date: Thu, 3 Feb 2011 14:45:21 -0500
Message-Id: <70337426-BCC7-4847-A95B-130D33B09603@mit.edu>
To: source-commits@mit.edu
Content-Transfer-Encoding: 8bit

FYI, I don't want to push this out just yet.  1.20 (in -dev) is what I intend to push out in the short term to fix the at problem.  This is a larger change.

-Jon

On Feb 3, 2011, at 2:42 PM, Jonathan D Reed wrote:

> Author: jdreed
> Date: 2011-02-03 14:42:43 -0500 (Thu, 03 Feb 2011)
> New Revision: 24935
> 
> Added:
>   trunk/debathena/config/auto-update/debian/debathena-auto-update.init
>   trunk/debathena/config/auto-update/debian/debathena-auto-update.prerm
> Removed:
>   trunk/debathena/config/auto-update/debian/debathena-auto-update.cron.d
> Modified:
>   trunk/debathena/config/auto-update/debian/athena-auto-update
>   trunk/debathena/config/auto-update/debian/athena-auto-upgrade
>   trunk/debathena/config/auto-update/debian/changelog
>   trunk/debathena/config/auto-update/debian/control.in
>   trunk/debathena/config/auto-update/debian/debathena-auto-update.postinst
>   trunk/debathena/config/auto-update/debian/rules
> Log:
> In auto-update:
>  * Generate crontabs at configure time
>  * Run an update at boot time if it's been too long since the last one
> 
> 
> Modified: trunk/debathena/config/auto-update/debian/athena-auto-update
> ===================================================================
> --- trunk/debathena/config/auto-update/debian/athena-auto-update	2011-02-03 19:13:46 UTC (rev 24934)
> +++ trunk/debathena/config/auto-update/debian/athena-auto-update	2011-02-03 19:42:43 UTC (rev 24935)
> @@ -67,22 +67,6 @@
> 
> trap 'rm -f $pidfile' EXIT
> 
> -if [ "$1" = "cron" ]; then
> -    case `date +"%H"` in
> -	0[2-6])
> -	    # 2 hrs
> -	    interval=7200
> -	    ;;
> -	*)
> -	    # 6 hrs
> -	    interval=21600
> -	    ;;
> -    esac
> -    if ! desync -t /var/run/athena-update.desync $interval; then
> -	exit 0
> -    fi
> -fi
> -
> statfile="/var/lib/athena-update-status"
> updstatus="unknown"
> updmsg=""
> 
> Modified: trunk/debathena/config/auto-update/debian/athena-auto-upgrade
> ===================================================================
> --- trunk/debathena/config/auto-update/debian/athena-auto-upgrade	2011-02-03 19:13:46 UTC (rev 24934)
> +++ trunk/debathena/config/auto-update/debian/athena-auto-upgrade	2011-02-03 19:42:43 UTC (rev 24935)
> @@ -67,23 +67,6 @@
>     fi
> fi
> 
> -if [ "$1" = "cron" ]; then
> -    interval=21600
> -    shopt -s nocasematch
> -    case `hostname` in
> -	m38-370*)
> -	    interval=43200
> -	    ;;
> -	w20-575*)
> -	    interval=28800
> -	    ;;
> -    esac
> -    shopt -u nocasematch
> -    if ! desync -t /var/run/athena-upgrade.desync $interval; then
> -        exit 0
> -    fi
> -fi    
> -
> CLUSTERINFO=`getcluster -b $(lsb_release -sr)`
> [ $? != 0 ] && complain "Failed to get clusterinfo" && exit 1
> eval $CLUSTERINFO
> 
> Modified: trunk/debathena/config/auto-update/debian/changelog
> ===================================================================
> --- trunk/debathena/config/auto-update/debian/changelog	2011-02-03 19:13:46 UTC (rev 24934)
> +++ trunk/debathena/config/auto-update/debian/changelog	2011-02-03 19:42:43 UTC (rev 24935)
> @@ -1,3 +1,10 @@
> +debathena-auto-update (1.21) UNRELEASED; urgency=low
> +
> +  * Generate crontabs at configure time
> +  * Run an update at boot time if it's been too long since the last one
> +
> + -- Jonathan Reed <jdreed@mit.edu>  Thu, 03 Feb 2011 14:42:33 -0500
> +
> debathena-auto-update (1.20) unstable; urgency=low
> 
>   * Don't depend on at, because bad things happen (Trac #782)
> 
> Modified: trunk/debathena/config/auto-update/debian/control.in
> ===================================================================
> --- trunk/debathena/config/auto-update/debian/control.in	2011-02-03 19:13:46 UTC (rev 24934)
> +++ trunk/debathena/config/auto-update/debian/control.in	2011-02-03 19:42:43 UTC (rev 24935)
> @@ -7,6 +7,6 @@
> 
> Package: debathena-auto-update
> Architecture: all
> -Depends: ${misc:Depends}, bsdutils, debathena-desync, cron, aptitude, apt-file, kexec-tools, at
> +Depends: ${misc:Depends}, bsdutils, debathena-desync, cron, aptitude, apt-file, kexec-tools, bc
> Description: Performs automatic updates for Athena machines.
>  This package performs automatic updates for Athena machines.
> 
> Added: trunk/debathena/config/auto-update/debian/debathena-auto-update.init
> ===================================================================
> --- trunk/debathena/config/auto-update/debian/debathena-auto-update.init	                        (rev 0)
> +++ trunk/debathena/config/auto-update/debian/debathena-auto-update.init	2011-02-03 19:42:43 UTC (rev 24935)
> @@ -0,0 +1,30 @@
> +#!/bin/sh
> +#
> +### BEGIN INIT INFO
> +# Provides:          debathena-auto-update
> +# Required-Start:    $network $local_fs
> +# Default-Start:     2 3 4 5
> +# Short-Description: Run an update at boot time
> +# Description:       Run an update at boot time
> +### END INIT INFO
> +#
> +# This script is part of the debathena-auto-update package
> +# See /usr/share/doc/debathena-auto-update/copyright
> +
> +machtype -v -L | grep -q "debathena-cluster" || exit 0
> +
> +case "$1" in
> +start)
> +	if [ -f /var/lib/athena-update-status ]; then
> +	    updlast=$(awk -F\| '{print $2;}' /var/lib/athena-update-status)
> +	    time=$(date +%s)
> +	    if echo $updlast | grep -q ^[0-9]*$; then
> +		elapsed=`echo $time - $updlast | bc`
> +		if [ $elapsed -le 21600 ]; then
> +		    exit 0
> +		fi
> +	    fi
> +	fi
> +	/usr/sbin/athena-auto-update
> +	;;
> +esac
> 
> Modified: trunk/debathena/config/auto-update/debian/debathena-auto-update.postinst
> ===================================================================
> --- trunk/debathena/config/auto-update/debian/debathena-auto-update.postinst	2011-02-03 19:13:46 UTC (rev 24934)
> +++ trunk/debathena/config/auto-update/debian/debathena-auto-update.postinst	2011-02-03 19:42:43 UTC (rev 24935)
> @@ -17,7 +17,22 @@
> # for details, see http://www.debian.org/doc/debian-policy/ or
> # the debian-policy package
> 
> +desync2cron() {
> +    hour=$1
> +    interval=$2
> +    shift 2
> +    desync=`desync -n $interval`
> +    mins=`echo $desync % 60 | bc`
> +    hours=`echo "$hour + ($desync / 60)" | bc`
> +    if [ $hours -ge 24 ]; then
> +	hours=`echo $hours - 24 | bc`
> +    fi
> +    echo "$mins $hours * * * $*"
> +}
> 
> +UPD_CRONFILE=/etc/cron.d/athena-auto-update
> +UPG_CRONFILE=/etc/cron.d/athena-auto-upgrade
> +
> case "$1" in
>     configure)
> 	# Nuke /var/lib/athena-update-status on 1.18, 
> @@ -27,6 +42,30 @@
> 	    [ -f /var/lib/athena-update-status ]; then
> 	    rm /var/lib/athena-update-status
> 	fi
> +
> +	rm -f $UPD_CRONFILE
> +	rm -f $UPG_CRONFILE
> +
> +	echo "# Automatically generated by debathena-auto-update postinst" > $UPD_CRONFILE
> +	for h in 2 4 6; do
> +	    desync2cron $h 120 root /usr/sbin/athena-auto-update cron >> $UPD_CRONFILE
> +	done
> +	for h in 8 14 20; do
> +	    desync2cron $h 360 root /usr/sbin/athena-auto-update cron >> $UPD_CRONFILE
> +	done
> +	echo "# Automatically generated by debathena-auto-update postinst" > $UPG_CRONFILE
> +
> +	upginterval=360
> +	hostname=`hostname | tr 'A-Z' 'a-z'`
> +	case $hostname in
> +	    m38-370*)
> +		upginterval=420
> +		;;
> +	    w20-575*)
> +		upginterval=480
> +		;;
> +	esac
> +	desync2cron 2 $upginterval root /usr/sbin/athena-auto-upgrade >> $UPG_CRONFILE
> 	
>     ;;
> 
> 
> Added: trunk/debathena/config/auto-update/debian/debathena-auto-update.prerm
> ===================================================================
> --- trunk/debathena/config/auto-update/debian/debathena-auto-update.prerm	                        (rev 0)
> +++ trunk/debathena/config/auto-update/debian/debathena-auto-update.prerm	2011-02-03 19:42:43 UTC (rev 24935)
> @@ -0,0 +1,46 @@
> +#!/bin/sh
> +# prerm script for #PACKAGE#
> +#
> +# see: dh_installdeb(1)
> +
> +set -e
> +
> +# summary of how this script can be called:
> +#        * <prerm> `remove'
> +#        * <old-prerm> `upgrade' <new-version>
> +#        * <new-prerm> `failed-upgrade' <old-version>
> +#        * <conflictor's-prerm> `remove' `in-favour' <package> <new-version>
> +#        * <deconfigured's-prerm> `deconfigure' `in-favour'
> +#          <package-being-installed> <version> `removing'
> +#          <conflicting-package> <version>
> +# for details, see http://www.debian.org/doc/debian-policy/ or
> +# the debian-policy package
> +
> +UPD_CRONFILE=/etc/cron.d/athena-auto-update
> +UPG_CRONFILE=/etc/cron.d/athena-auto-upgrade
> +
> +case "$1" in
> +    remove)
> +	rm -f $UPD_CRONFILE
> +	rm -f $UPG_CRONFILE
> +    ;;
> +
> +    upgrade|deconfigure)
> +	
> +    ;;
> +
> +    failed-upgrade)
> +    ;;
> +
> +    *)
> +        echo "prerm called with unknown argument \`$1'" >&2
> +        exit 1
> +    ;;
> +esac
> +
> +# dh_installdeb will replace this with shell code automatically
> +# generated by other debhelper scripts.
> +
> +#DEBHELPER#
> +
> +exit 0
> 
> Modified: trunk/debathena/config/auto-update/debian/rules
> ===================================================================
> --- trunk/debathena/config/auto-update/debian/rules	2011-02-03 19:13:46 UTC (rev 24934)
> +++ trunk/debathena/config/auto-update/debian/rules	2011-02-03 19:42:43 UTC (rev 24935)
> @@ -1,3 +1,5 @@
> #!/usr/bin/make -f
> 
> +DEB_UPDATE_RCD_PARAMS="defaults 98 02"
> +
> include /usr/share/cdbs/1/rules/debhelper.mk
> 



home help back first fref pref prev next nref lref last post