From: Joerg Jaspert Date: Sat, 23 Jan 2016 21:17:15 +0000 (+0100) Subject: Various small fixups/style issues X-Git-Url: https://git.decadent.org.uk/gitweb/?p=dak.git;a=commitdiff_plain;h=c7c3004d7fb00f8d419178ea982d30ab2c61b681 Various small fixups/style issues --- diff --git a/config/debian/common b/config/debian/common old mode 100644 new mode 100755 index 6c3a5ba0..21e0d483 --- a/config/debian/common +++ b/config/debian/common @@ -4,7 +4,7 @@ # Set $PROGRAM to a string to have it added to the output. function log () { local prefix=${PROGRAM:-} - echo "$(date +"%b %d %H:%M:%S") ${HOSTNAME} ${prefix}[$$]: $@" + echo "$(date +"%b %d %H:%M:%S") ${HOSTNAME} ${prefix}[$$]: $*" } # log the message using log() but then also send a mail @@ -12,7 +12,7 @@ function log () { function log_error () { log "$@" if [[ -z ${MAILTO} ]]; then - echo "$@" | mail -a "X-Debian: DAK" -e -s "[$PROGRAM@${HOSTNAME}] ERROR [$$]" -a "From: Debian FTP Masters " ${MAILTO} + echo "$*" | mail -a "X-Debian: DAK" -e -s "[$PROGRAM@${HOSTNAME}] ERROR [$$]" -a "From: Debian FTP Masters " ${MAILTO} fi } @@ -102,7 +102,7 @@ function make_buildd_dir () { dak generate-releases -a build-queues >/dev/null # Stick a last modified date in the page footer - echo "

Last updated: `date -u`

" > ${incoming}/web/README.html + echo "

Last updated: $(date -u)

" > ${incoming}/web/README.html # Tell the mirrors that we've updated log "Pushing static for incoming.d.o" @@ -165,9 +165,11 @@ function do_unchecked () { if [[ ! -z ${changes} ]]; then log "Processing files ${changes}" - echo "${timestamp}: ${changes}" >> ${report} - dak process-upload -a -d "$unchecked" >> ${report} - dak process-commands -d "$unchecked" >> ${report} + { + echo "${timestamp}: ${changes}" + dak process-upload -a -d "$unchecked" + dak process-commands -d "$unchecked" + } >> ${report} sync_debbugs do_buildd @@ -223,7 +225,7 @@ function reports() { log "Sending information about crufty packages" dak cruft-report -R > $webdir/cruft-report-daily.txt dak cruft-report -R -s experimental >> $webdir/cruft-report-daily.txt - cat $webdir/cruft-report-daily.txt | mail -a "X-Debian: DAK" -e -s "Debian archive cruft report for $(date +%D)" -a "From: Debian FTP Masters " ftpmaster@ftp-master.debian.org + mail -a "X-Debian: DAK" -e -s "Debian archive cruft report for $(date +%D)" -a "From: Debian FTP Masters " ftpmaster@ftp-master.debian.org < $webdir/cruft-report-daily.txt } function pg_timestamp() { @@ -306,7 +308,7 @@ function stage() { if [[ -f ${STAGEFILE} ]]; then local stamptime=$(/usr/bin/stat -c %Z "${STAGEFILE}") local unixtime=$(date +%s) - local difference=$(( $unixtime - $stamptime )) + local difference=$(( unixtime - stamptime )) if [[ ${difference} -ge 14400 ]]; then log_error "Did already run ${FUNC}, stagefile exists, but that was ${difference} seconds ago. Please check." else diff --git a/config/debian/cronscript b/config/debian/cronscript index 595c6b6a..9a561ab0 100755 --- a/config/debian/cronscript +++ b/config/debian/cronscript @@ -53,7 +53,7 @@ configdir=${configdir:-"/srv/ftp-master.debian.org/dak/config/debian"} # import the general variable set. (This will overwrite configdir, but # it is expected to have the same value) export SCRIPTVARS=${configdir}/vars -. $SCRIPTVARS +. ${SCRIPTVARS} # One arg please declare -lr ARG=${1:-"meh"} @@ -71,7 +71,7 @@ case ${ARG} in ${POSSIBLEARGS}) # Only one of me should ever run. FLOCKER=${FLOCKER:-""} - [ "${FLOCKER}" != "${configdir}/${PROGRAM}.tasks" ] && exec env FLOCKER="${configdir}/${PROGRAM}.tasks" flock -E 0 -en "${configdir}/${PROGRAM}.tasks" "$0" "$@" || : + [[ ${FLOCKER} != ${configdir}/${PROGRAM}.tasks ]] && exec env FLOCKER="${configdir}/${PROGRAM}.tasks" flock -E 0 -en "${configdir}/${PROGRAM}.tasks" "$0" "$@" || : ;; *) cat - < ${TRACEFILE} - echo "Using dak v1" >> ${TRACEFILE} - echo "Running on host: $(hostname -f)" >> ${TRACEFILE} - echo "Archive serial: ${SERIAL}" >> ${TRACEFILE} - echo "Date: ${RFC822DATE}" >> ${TRACEFILE} + { + echo "Using dak v1" + echo "Running on host: $(hostname -f)" + echo "Archive serial: ${SERIAL}" + echo "Date: ${RFC822DATE}" + } >> ${TRACEFILE} # Now make it accessible via one name, no matter on which host we run cd ${archiveroot}/project/trace/ ln -sf ftp-master.debian.org master @@ -651,7 +653,7 @@ function savetimestamp() { } function maillogfile() { - cat "$LOGFILE" | mail -a "X-Debian: DAK" -s "Log for dinstall run of ${NOW}" -a "From: Debian FTP Masters " cron@ftp-master.debian.org + mail -a "X-Debian: DAK" -s "Log for dinstall run of ${NOW}" -a "From: Debian FTP Masters " cron@ftp-master.debian.org < "${LOGFILE}" } function testingsourcelist() { diff --git a/config/debian/hourly.functions b/config/debian/hourly.functions index ec713d8f..dd13ba77 100644 --- a/config/debian/hourly.functions +++ b/config/debian/hourly.functions @@ -66,7 +66,7 @@ function builddautosigning() { exec >>/dev/null 2>&1 DATE=$(date -Is) - cat "${BUILDDFUN}" | mail -a "X-Debian: DAK" -e -s "[${HOSTNAME}] Buildd key changes ${DATE}" -a "From: Debian FTP Masters " buildd-keys@ftp-master.debian.org + mail -a "X-Debian: DAK" -e -s "[${HOSTNAME}] Buildd key changes ${DATE}" -a "From: Debian FTP Masters " buildd-keys@ftp-master.debian.org < "${BUILDDFUN}" rm -f "${BUILDDFUN}" }