+++ /dev/null
-This directory provides files used for autobuilding grml-ISOs on a daily base,
-like what http://daily.grml.org/ provides. If you plan to use those files
-you definitely have to adjust them according to your needs, it should just
-provide an idea of what can be done using grml-live.
-
- -- Michael Prokop <mika@grml.org>, Sun Oct 7 13:04:05 CEST 2007
+++ /dev/null
-TODO for autobuild infrastructure
----------------------------------
-
-Unify scripts in a core configuration file.
#!/bin/sh
-# Filename: cleanup.sh
+# Filename: /usr/share/grml-live/buildd/buildd/cleanup.sh
# Purpose: clean up daily builds directory - remove old files
# Authors: grml-team (grml.org), (c) Michael Prokop <mika@grml.org>
# Bug-Reports: see http://grml.org/bugs/
# License: This file is licensed under the GPL v2 or any later version.
-# Latest change: Don Okt 18 00:32:36 CEST 2007 [mika]
+# Latest change: YDATE [mika]
################################################################################
set -e
+. /etc/grml/grml-buildd.conf
+
+[ -n "$RECIPIENT" ] || RECIPIENT=root@localhost
+
+[ -n "$MIRROR_DIRECTORY" ] || exit 1
+cd $MIRROR_DIRECTORY || exit 2
+
# we want to always keep a few images, no matter how old they are
# but get rid of the oldest ones first of course :)
# so: how many images do we want to keep?
DAYS=3
REMOVE_ME=""
-for flavour in grml-medium_etch grml-medium_sid grml64-medium_etch grml64-medium_sid grml64_sid grml_sid ; do
+for flavour in grml-small_etch grml-small_sid grml-medium_etch grml-medium_sid grml_sid grml_etch \
+ grml64-small_etch grml64-small_sid grml64-medium_etch grml64-medium_sid grml64_sid grml64_etch ; do
FILE_COUNT=$(ls -1 $flavour*.iso | wc -l)
if [ "$FILE_COUNT" -gt "$DAYS" ] ; then
FILES=$(ls -1 $flavour*.iso | tail -"$DAYS")
# move them before we really delete them:
for file in $REMOVE_ME ; do
- test -f ${file} && mv $file .delete
+ test -f ${file} && rm -f $file
test -f ${file}.md5 && mv ${file}.md5 .delete
done
# inform on successful removal:
if [ "$(echo "$REMOVE_ME" | tr -d ' ' )" != "" ] ; then
- echo "deleted files $REMOVE_ME" | mail -s "daily-builds cleanup script" root@localhost
+ echo "deleted files $REMOVE_ME" | mail -s "daily-builds cleanup script" $RECIPIENT
fi
## END OF FILE #################################################################
--- /dev/null
+#!/bin/sh
+# Filename: /usr/share/grml-live/buildd/buildd/functions.sh
+# Purpose: main function file for grml-live buildd
+# Authors: grml-team (grml.org), (c) Michael Prokop <mika@grml.org>
+# Bug-Reports: see http://grml.org/bugs/
+# License: This file is licensed under the GPL v2 or any later version.
+# Latest change: Mon Oct 22 19:19:26 CEST 2007 [mika]
+################################################################################
+
+die() {
+ [ -n "$1" ] && echo "$1">&2
+ exit 1
+}
+
+. /etc/grml/grml-buildd.conf || die "Could not source /etc/grml/grml-buildd.conf. Exiting."
+
+type -p mutt 1>/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."
+[ -n "$SUITE" ] || die "\$SUITE is not set. Exiting."
+[ -n "$CLASSES" ] || die "\$CLASSES is not set. Exiting."
+[ -n "$NAME" ] || die "\$NAME is not set. Exiting."
+[ -n "$ISO_NAME" ] || die "\$ISO_NAME is not set. Exiting."
+
+# some defaults:
+PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11
+DATE=$(date +%Y%m%d)
+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."
+[ -n "$ARCH" ] && GRML_LIVE_ARCH="-a $ARCH"
+
+# 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 "$LOGFILES" ] || LOGFILES=/var/log/fai/dirinstall/grml
+[ -n "$FROM" ] || FROM=root@localhost
+
+echo "my_hdr From: grml-live autobuild daemon <$FROM>" > $MUTT_HEADERS
+
+# execute grml-live:
+grml_live_run() {
+grml-live -F $GRML_LIVE_ARCH -s $SUITE -c $CLASSES -o $OUTPUT_DIR \
+ -g $NAME -v $DATE -r grml-live-autobuild -i $ISO_NAME \
+ 1>$LOGFILES/grml-live.stdout \
+ 2>$LOGFILES/grml-live.stderr ; RC=$?
+
+if [ "$RC" = "0" ] ; then
+ RC_INFO=success
+else
+ RC_INFO=error
+fi
+}
+
+# create log archive:
+create_logs() {
+( cd / && tar zcf $ATTACHMENT var/log/fai/dirinstall/grml 1>/dev/null )
+}
+
+# store information of ISO size:
+iso_details() {
+if ! [ -f "$OUTPUT_DIR/grml_isos/$ISO_NAME" ] ; then
+ ISO_DETAILS="There was an error creating $ISO_NAME"
+else
+ ISO_DETAILS=$(ls -lh $OUTPUT_DIR/grml_isos/$ISO_NAME)
+fi
+}
+
+# send status mail:
+send_mail() {
+echo -en "Automatically generated mail by $SCRIPTNAME
+
+$ISO_DETAILS
+
+Return code of grml-live run was: $RC
+
+The following errors have been noticed (several might be warnings only):
+
+$(grep error $LOGFILES/* | grep -ve liberror -ve libgpg-error || echo "* nothing")
+
+The following warnings have been noticed:
+
+$(grep warn $LOGFILES/* || echo "* nothing")
+
+Find details in the attached logs." | \
+mutt -s "$SCRIPTNAME [${DATE}] - $RC_INFO" \
+ -a $ATTACHMENT \
+ $RECIPIENT
+}
+
+# make sure we store the final iso:
+store_iso() {
+ [ -d "$ISO_DIR" ] || mkdir "$ISO_DIR"
+ mv $OUTPUT_DIR/grml_isos/$ISO_NAME $ISO_DIR
+}
+
+# allow clean exit:
+bailout() {
+ if [ "$RC" = "0" ] ; then
+ rm -rf "$TMP_DIR" "$MUTT_HEADERS" "$OUTPUT_DIR"
+ else
+ rm -f "$MUTT_HEADERS"
+ echo "building ISO failed, keeping build files [${OUTPUT_DIR} / ${TMP_DIR}]">&2
+ fi
+
+}
+
+trap bailout 1 2 3 15
+
+## END OF FILE #################################################################
--- /dev/null
+# Filename: /etc/grml/grml-buildd.conf
+# Purpose: configuration file for grml-live buildd
+# Authors: grml-team (grml.org), (c) Michael Prokop <mika@grml.org>
+# Bug-Reports: see http://grml.org/bugs/
+# License: This file is licensed under the GPL v2 or any later version.
+# Latest change: Mon Oct 22 19:18:59 CEST 2007 [mika]
+################################################################################
+
+# where do you want to store chroot/ISOs/...? Must be set!
+#STORAGE=/grml-live/
+
+# who should get notification mails?
+# default: root@localhost
+#RECIPIENT=root@localhost
+
+# what do you want to use for "From:" in notification mails?
+# default: root@localhost
+#FROM=root@localhost
+
+# which directory should be cleaned up?
+# used for example inside /usr/share/grml-live/buildd/buildd/cleanup.sh
+#MIRROR_DIRECTORY=/home/ftp/www.grml.org/daily
+
+## END OF FILE #################################################################
#!/bin/sh
-. main.sh || exit 1
-
# settings for grml_live_run:
+DATE=$(date +%Y%m%d)
ISO_NAME=grml_etch_$DATE.iso
SUITE=etch
CLASSES='GRMLBASE,GRML_FULL,LATEX_CLEANUP,RELEASE,I386'
SCRIPTNAME="$(basename $0)"
ARCH=i386
+. /usr/share/grml-live/buildd/buildd/functions.sh || exit 1
+
# execute grml-live:
grml_live_run
#!/bin/sh
-. main.sh || exit 1
-
# settings for grml_live_run:
+DATE=$(date +%Y%m%d)
ISO_NAME=grml_sid_$DATE.iso
SUITE=sid
CLASSES='GRMLBASE,GRML_FULL,LATEX_CLEANUP,RELEASE,I386'
SCRIPTNAME="$(basename $0)"
ARCH=i386
+. /usr/share/grml-live/buildd/buildd/functions.sh || exit 1
+
# execute grml-live:
grml_live_run
#!/bin/sh
-
-#!/bin/sh
-
-. main.sh || exit 1
-
# settings for grml_live_run:
+DATE=$(date +%Y%m%d)
ISO_NAME=grml-medium_etch_$DATE.iso
SUITE=sid
CLASSES='GRMLBASE,GRML_MEDIUM,RELEASE,I386'
-NAME=grml
+NAME=grml-medium
SCRIPTNAME="$(basename $0)"
ARCH=i386
+. /usr/share/grml-live/buildd/buildd/functions.sh || exit 1
+
# execute grml-live:
grml_live_run
#!/bin/sh
-. main.sh || exit 1
-
# settings for grml_live_run:
+DATE=$(date +%Y%m%d)
ISO_NAME=grml-medium_sid_$DATE.iso
SUITE=sid
-CLASSES='GRMLBASE,GRML_MEDIUM,RELEASE,i386'
-NAME=grml
+CLASSES='GRMLBASE,GRML_MEDIUM,RELEASE,I386'
+NAME=grml-medium
SCRIPTNAME="$(basename $0)"
ARCH=i386
+. /usr/share/grml-live/buildd/buildd/functions.sh || exit 1
+
# execute grml-live:
grml_live_run
#!/bin/sh
-. main.sh || exit 1
-
# settings for grml_live_run:
+DATE=$(date +%Y%m%d)
ISO_NAME=grml-small_etch_$DATE.iso
SUITE=etch
CLASSES='GRMLBASE,GRML_SMALL,REMOVE_DOCS,I386'
-NAME=grml
+NAME=grml-small
SCRIPTNAME="$(basename $0)"
ARCH=i386
+. /usr/share/grml-live/buildd/buildd/functions.sh || exit 1
+
# execute grml-live:
grml_live_run
ISO_NAME=grml-small_sid_$DATE.iso
SUITE=sid
CLASSES='GRMLBASE,GRML_SMALL,REMOVE_DOCS,I386'
-NAME=grml
+NAME=grml-small
SCRIPTNAME="$(basename $0)"
ARCH=i386
-. main.sh || exit 1
+. /usr/share/grml-live/buildd/buildd/functions.sh || exit 1
# execute grml-live:
grml_live_run
#!/bin/sh
-. main.sh || exit 1
-
# settings for grml_live_run:
+DATE=$(date +%Y%m%d)
ISO_NAME=grml64_etch_$DATE.iso
SUITE=etch
CLASSES='GRMLBASE,GRML_FULL,LATEX_CLEANUP,AMD64'
NAME=grml64
SCRIPTNAME="$(basename $0)"
+. /usr/share/grml-live/buildd/buildd/functions.sh || exit 1
+
# execute grml-live:
grml_live_run
store_iso
-bailout
+if [ "$RC" = "0" ] ; then
+ bailout
+else
+ echo "building ISO failed, keeping build files [${OUTPUT_DIR}]"
+fi
#!/bin/sh
-. main.sh || exit 1
-
# settings for grml_live_run:
+DATE=$(date +%Y%m%d)
ISO_NAME=grml64_sid_$DATE.iso
SUITE=sid
CLASSES='GRMLBASE,GRML_FULL,LATEX_CLEANUP,AMD64'
NAME=grml64
SCRIPTNAME="$(basename $0)"
+. /usr/share/grml-live/buildd/buildd/functions.sh || exit 1
+
# execute grml-live:
grml_live_run
#!/bin/sh
-. main.sh || exit 1
-
# settings for grml_live_run:
+DATE=$(date +%Y%m%d)
ISO_NAME=grml64-medium_etch_$DATE.iso
SUITE=etch
CLASSES='GRMLBASE,GRML_MEDIUM,AMD64'
NAME=grml64-medium
SCRIPTNAME="$(basename $0)"
+. /usr/share/grml-live/buildd/buildd/functions.sh || exit 1
+
# execute grml-live:
grml_live_run
#!/bin/sh
-. main.sh || exit 1
-
# settings for grml_live_run:
+DATE=$(date +%Y%m%d)
ISO_NAME=grml64-medium_sid_$DATE.iso
SUITE=sid
CLASSES='GRMLBASE,GRML_MEDIUM,AMD64'
NAME=grml64-medium
SCRIPTNAME="$(basename $0)"
+. /usr/share/grml-live/buildd/buildd/functions.sh || exit 1
+
# execute grml-live:
grml_live_run
#!/bin/sh
-. main.sh || exit 1
-
# settings for grml_live_run:
+DATE=$(date +%Y%m%d)
ISO_NAME=grml64-small_etch_$DATE.iso
SUITE=etch
CLASSES='GRMLBASE,GRML_SMALL,REMOVE_DOCS,AMD64'
NAME=grml64-small
SCRIPTNAME="$(basename $0)"
+. /usr/share/grml-live/buildd/buildd/functions.sh || exit 1
+
# execute grml-live:
grml_live_run
#!/bin/sh
-. main.sh || exit 1
-
# settings for grml_live_run:
+DATE=$(date +%Y%m%d)
ISO_NAME=grml64-small_sid_$DATE.iso
SUITE=sid
CLASSES='GRMLBASE,GRML_SMALL,REMOVE_DOCS,AMD64'
NAME=grml64-small
SCRIPTNAME="$(basename $0)"
+. /usr/share/grml-live/buildd/buildd/functions.sh || exit 1
+
# execute grml-live:
grml_live_run
+++ /dev/null
-#!/bin/sh
-# Filename: main.sh
-# Purpose: main configuration and function file for grml-live buildd
-# Authors: grml-team (grml.org), (c) Michael Prokop <mika@grml.org>
-# Bug-Reports: see http://grml.org/bugs/
-# License: This file is licensed under the GPL v2 or any later version.
-# Latest change: Don Okt 18 00:32:02 CEST 2007 [mika]
-################################################################################
-
-# configuration:
-PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11
-DATE=$(date +%Y%m%d)
-STORAGE=/grml-live/
-OUTPUT_DIR="${STORAGE}/grml-live_${DATE}.$$"
-TMP_DIR=$(mktemp -d)
-MUTT_HEADERS=$(mktemp)
-ATTACHMENT=$TMP_DIR/grml-live-logs_$DATE.tar.gz
-[ -n "$ARCH" ] && GRML_LIVE_ARCH="-a $ARCH"
-[ -n "$TMP_DIR" ] || exit 10
-[ -n "$MUTT_HEADERS" ] || exit 20
-RECIPIENT=root@localhost
-ISO_DIR=/grml-live/grml-isos
-echo "my_hdr From: grml-live autobuild daemon <root@localhost>" > $MUTT_HEADERS
-
-# execute grml-live:
-grml_live_run() {
-grml-live -F $GRML_LIVE_ARCH -s $SUITE -c $CLASSES -o $OUTPUT_DIR \
- -g $NAME -v $DATE -r grml-live-autobuild -i $ISO_NAME \
- 1>/var/log/fai/dirinstall/grml/grml-live.stdout \
- 2>/var/log/fai/dirinstall/grml/grml-live.stderr ; RC=$?
-
-if [ "$RC" = "0" ] ; then
- RC=success
-else
- RC=error
-fi
-}
-
-create_logs() {
-# create log archive:
-tar zcf $ATTACHMENT /var/log/fai/dirinstall/grml 1>/dev/null
-}
-
-iso_details() {
-if ! [ -f "$OUTPUT_DIR/grml_isos/$ISO_NAME" ] ; then
- ISO_DETAILS="There was an error creating $ISO_NAME"
-else
- ISO_DETAILS=$(ls -lh $OUTPUT_DIR/grml_isos/$ISO_NAME)
-fi
-}
-
-send_mail() {
-# send status mail:
-echo -en "Automatically generated mail by $SCRIPTNAME
-
-$ISO_DETAILS
-
-Return code of grml-live run was: $RC
-
-The following errors have been noticed (several might be warnings only):
-
-$(grep error /var/log/fai/dirinstall/grml/* | grep -ve liberror -ve libgpg-error)
-
-The following warnings have been noticed:
-
-$(grep warn /var/log/fai/dirinstall/grml/*)
-
-Find details in the attached logs." | \
-mutt -s "grml-live_autobuild_grml-large_sid.sh [${DATE}] - $RC" \
- -a $ATTACHMENT \
- $RECIPIENT
-}
-
-store_iso() {
-# make sure we store the final iso:
-[ -d "$ISO_DIR" ] || mkdir "$ISO_DIR"
-mv $OUTPUT_DIR/grml_isos/$ISO_NAME $ISO_DIR
-}
-
-bailout() {
- rm -rf "$TMP_DIR" "$MUTT_HEADERS" "$OUTPUT_DIR"
-}
-
-trap bailout 1 2 3 15
-
-## END OF FILE #################################################################
#!/bin/sh
-. main.sh || exit 1
+# Filename: /usr/share/grml-live/buildd/buildd/upload_isos.sh
+# Purpose: upload grml ISOs to a rsync server
+# Authors: grml-team (grml.org), (c) Michael Prokop <mika@grml.org>
+# Bug-Reports: see http://grml.org/bugs/
+# License: This file is licensed under the GPL v2 or any later version.
+# Latest change: Mon Oct 22 19:11:33 CEST 2007 [mika]
+################################################################################
+
+. /usr/share/grml-live/buildd/buildd/functions.sh || exit 1
+[ -n "$RSYNC_MIRROR" ] || exit 2
+cd $ISO_DIR || exit 3
+
umask 002
-cd /srv/grml-isos || exit 1
for file in *.iso ; do
[ -f "${file}.md5" ] || md5sum $file > ${file}.md5
chmod 664 $file
chmod 664 ${file}.md5
done
-rsync --partial -az --quiet $ISO_DIR/* grml-build@debian.netcologne.de:/home/ftp/www.grml.org/daily/
+rsync --partial -az --quiet $ISO_DIR/* $RSYNC_MIRROR
+
+## END OF FILE #################################################################
grml-live (0.0.7) unstable; urgency=low
+ * Reworked buildd concept. Now we have a seperate
+ /usr/share/grml-live/buildd/functions.sh for generic
+ stuff and /etc/grml/grml-buildd.conf as configuration
+ file.
* Log executed grml-live command line.
* Set $SECONDS to unknown if $start_seconds is not set.
* Add new packages to GRML_FULL:
cp -a etc debian/grml-live/
cp -a examples debian/grml-live/usr/share/doc/grml-live/
cp -a templates debian/grml-live/usr/share/grml-live/
- cp -a buildd debian/grml-live/usr/share/grml-live/examples/
+ cp -a buildd/*.sh debian/grml-live/usr/share/grml-live/examples/
+ install -o root -m 640 buildd/grml-buildd.conf debian/grml-live/etc/grml/grml-buildd.conf
install -o root -m 755 grml-live debian/grml-live/usr/sbin/grml-live
# Build architecture-independent files here.