. /etc/grml/grml-buildd.conf || die "Could not source /etc/grml/grml-buildd.conf. Exiting."
-which nail >/dev/null 2>&1 || die "nail binary not found. Exiting."
+which mutt >/dev/null 2>&1 || die "mutt binary not found. Exiting."
# exit if important variables aren't set:
[ -n "$STORAGE" ] || die "\$STORAGE is not set. Exiting."
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11
DATE=$(date +'%Y%m%d_%H%M%S')
TMP_DIR="$(mktemp -d)"
+MUTT_HEADERS="$(mktemp)"
[ -n "$TMP_DIR" ] || die "Could not create \$TMP_DIR. Exiting."
+[ -n "$MUTT_HEADERS" ] || die "Could not create $\MUTT_HEADERS. Exiting."
# make sure we have same safe defaults:
[ -n "$OUTPUT_DIR" ] || OUTPUT_DIR="${STORAGE}/grml-live_${DATE}.$$"
[ -n "$ISO_DIR" ] || ISO_DIR=$STORAGE/grml-isos
[ -n "$RECIPIENT" ] || RECIPIENT=root@localhost
-[ -n "$ATTACHMENT" ] || ATTACHMENT="$TMP_DIR/grml-live-logs_$DATE.tar.gz"
[ -n "$FROM" ] || FROM=root@localhost
[ -n "$ARCH" ] || ARCH="$(dpkg --print-architecture)"
+ATTACHMENT="$TMP_DIR/grml-live-logs_$DATE.tar.gz"
if [ -n "$LOGFILE" ] ; then
GRML_LOGFILE="$LOGFILE"
fi
[ -n "$FAI_LOGFILES" ] || FAI_LOGFILES=/var/log/fai/grml/last
+echo "my_hdr From: grml-live autobuild daemon <$FROM>" > $MUTT_HEADERS
# execute grml-live:
grml_live_run() {
grml-live -F $* -a $ARCH -s $SUITE -c $CLASSES -o $OUTPUT_DIR \
-g "$grml_name" -v "$shortdate" -r grml-live-autobuild -i $ISO_NAME \
- 1>/var/log/grml-buildd.stdout \
+ >/var/log/grml-buildd.stdout \
2>/var/log/grml-buildd.stderr ; RC=$?
if [ "$RC" = "0" ] ; then
# create log archive:
create_logs() {
- ( cd / && tar zcf $ATTACHMENT $FAI_LOGFILES /var/log/grml-buildd.stderr /var/log/grml-buildd.stdout $GRML_LOGFILE 1>/dev/null )
+ ( cd / && tar zcf $ATTACHMENT $FAI_LOGFILES /var/log/grml-buildd.stderr /var/log/grml-buildd.stdout $GRML_LOGFILE >/dev/null )
}
# store logs on remote server:
# create logs if using 'send_mail -e'
[ "$1" = "-e" ] && create_logs
+ # attach logs only if we have some:
+ [ -r "$ATTACHMENT" ] && MUTT_ATTACH="-a $ATTACHMENT" || MUTT_ATTACH=''
+
echo -en "Automatically generated mail by $SCRIPTNAME
$ISO_DETAILS
$(grep -i "Couldn't find.*package" $FAI_LOGFILES/software.log | sed 's/\(.*\)"\(.*\)"\(.*\)/\2/' | sort -u || echo "* nothing")
See attached files:
-/var/log/grml-buildd.stderr /var/log/grml-buildd.stdout $ATTACHMENT
+/var/log/grml-buildd.stderr $ATTACHMENT
EOF" | \
- nail -r "grml-live autobuild daemon <$FROM>" -s "$SCRIPTNAME [${DATE}] - $RC_INFO" -a /var/log/grml-buildd.stderr $ATTACHMENT "$RECIPIENT"
+ mutt -s "$SCRIPTNAME [${DATE}] - $RC_INFO" -a /var/log/grml-buildd.stderr $MUTT_ATTACH -- "$RECIPIENT"
}
# make sure we store the final iso:
# allow clean exit:
bailout() {
if [ "$RC" = "0" ] ; then
- rm -rf "$ATTACHMENT" "$TMP_DIR" "$OUTPUT_DIR"
+ rm -rf "$ATTACHMENT" "$TMP_DIR" "$OUTPUT_DIR" "$MUTT_HEADERS"
else
- rm -f "$ATTACHMENT"
+ rm -f "$ATTACHMENT" "$MUTT_HEADERS"
echo "building ISO failed, keeping build files [${OUTPUT_DIR} / ${TMP_DIR}]">&2
fi
Package: grml-live-buildd
Architecture: all
-Depends: ${misc:Depends}, grml-live, heirloom-mailx
+Depends: ${misc:Depends}, grml-live, mutt (>= 1.5.20), sudo
Description: autobuild daemon for grml-live
This package provides example scripts for a simple autobuild
daemon for the grml-live framework. Those scripts are used
* 1 minute and 40 seconds with ZLIB
[[install-local-files]]
-How to I install further files into the chroot/ISO?
+How do I install further files into the chroot/ISO?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Just point the configuration variable CHROOT_INSTALL to the directory which
% isohybrid grml.iso
[[basetgz]]
-How to I create a base tar.gz (I386.tar.gz or AMD64.tar.gz)
+How do I create a base tar.gz (I386.tar.gz or AMD64.tar.gz)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Execute the following commands (requires root):
that it needs to be uppercase letters matching the class names, so: AMD64.tar.gz
for amd64 and I386.tar.gz for i386).
+[[autobuild]]
+How do I set up an autobuild environment?
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+If you want to set up a system like link:http://daily.grml.org/[daily.grml.org]
+the Debian package grml-live-buildd provides all you need to start. Start with
+figuring out the cron job script /usr/share/grml-live/buildd/cronjob.sh.
+
+If you want to automatically update the grml-live Debian package on your build
+system based on the git tree of grml-live (so you get bleeding edge of
+development which might is interesting for services like daily.grml.org) the
+provided release_helper.sh script provides everything you need. Execute as root:
+
+ echo "deb file:/home/grml-live-git/grml-live.build-area/ ./" >> /etc/apt/sources.list.d/grml-live.list
+ adduser --disabled-login --disabled-password grml-live-git
+
+Execute 'visudo' to update sudo configuration and add the following line:
+
+ grml-live-git ALL=NOPASSWD: /usr/bin/apt-get
+
+Switch to user grml-live-git and configure the rest:
+
+ su - grml-live-git
+ mkdir grml-live.build-area
+ git clone git://git.grml.org/grml-live.git
+ git config --global user.name "Grml-Live Git Autobuild"
+ git config --global user.email "grml-live-git@$(hostname)"
+
+Finally install a cron job (as user grml-live-git) like:
+
+ 30 00 * * * cd /home/grml-live-git/grml-live.git/ && env AUTOBUILD=1 scripts/release_helper.sh >/home/grml-live-git/grml-live-build.log
+
+Tip: To find out the build date of the installed grml-live package just execute:
+
+ % apt-cache policy grml-live | grep 'Installed.*autobuild'
+ Installed: 0.13.1~autobuild1300450381
+
+and run "date -ud @$STRING" where $STRING is the number behind the "autobuild",
+like:
+
+ % date -ud @1300450081
+ Fri Mar 18 12:08:01 UTC 2011
+
[[question]]
I've a question which isn't answered by this document
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
etch) ;;
lenny) ;;
squeeze) ;;
+ wheezy) ;;
sid) ;;
*) echo "Sorry, $SUITE is not a valid Debian suite, exiting.">&2; bailout 1 ;;
esac
# Bug-Reports: see http://grml.org/bugs/
# License: This file is licensed under the GPL v2 or any later version.
################################################################################
-## How to set up autobuild (for automatically updating grml-live.git and
-## build packages out of git tree and install them, e.g. for usage on
-## daily.grml.org):
-# echo "deb file:/home/grml-live-git/grml-live.build-area/ ./" >> /etc/apt/sources.list.d/grml-live.list
-# adduser --disabled-login --disabled-password grml-live-git
-# visudo -> add "grml-live-git ALL=NOPASSWD: /usr/bin/apt-get"
-# su - grml-live-git
-# mkdir /home/grml-live-git/grml-live.build-area
-# git clone git://git.grml.org/grml-live.git
-# git config --global user.name "Grml-Live Git Autobuild"
-# git config --global user.email "grml-live-git@$(hostname)"
-#
-# Finally install a cron job (as user grml-live-git) like:
-# 30 00 * * * cd /home/grml-live-git/grml-live.git/ && env AUTOBUILD=1 scripts/release_helper.sh >/home/grml-live-git/grml-live-build.log
-#
-# Tip: To find out the build date of the installed grml-live package just run:
-#
-# % apt-cache policy grml-live | grep 'Installed.*autobuild'
-# Installed: 0.13.1~autobuild1300450381
-#
-# and run "date -ud @$STRING" where $STRING is the number
-# behind the "autobuild", like:
-# % date -ud @1300450081
-# Fri Mar 18 12:08:01 UTC 2011
-################################################################################
set -e
set -u