Merge branch 'mika/efi'
[grml-live.git] / buildd / cronjob.sh
1 #!/bin/sh
2 # Filename:      cronjob.sh
3 # Purpose:       example for a grml-live buildd cronjob setup
4 # Authors:       grml-team (grml.org), (c) Michael Prokop <mika@grml.org>
5 # Bug-Reports:   see http://grml.org/bugs/
6 # License:       This file is licensed under the GPL v2 or any later version.
7 ################################################################################
8 # Add something like that to the crontab to execute grml-live buildd
9 # every day at a specific time:
10 # 50 0 * * * /usr/share/grml-live/buildd/cronjob.sh
11 #
12 # On the mirror (where you're hosting the ISOs) you might want to
13 # install something like that in your crontab:
14 # 02  * * * * /home/mika/cronjobs/link_latest.sh
15 # 03 03 * * * /home/mika/cronjobs/cleanup.sh
16 ################################################################################
17
18 die() {
19   [ -n "$1" ] && echo "$1">&2
20   exit 1
21 }
22
23 . /etc/grml/grml-buildd.conf || die "Could not source /etc/grml/grml-buildd.conf. Exiting."
24
25 [ -n "$FLAVOURS" ] || die "\$FLAVOURS is not set. Exiting."
26
27 if [ -r /usr/share/grml-live/buildd/buildd_running ] ; then
28   echo "already running instance of grml-live buildd found, exiting.">&2
29   echo "if you think this is not true: rm /usr/share/grml-live/buildd/buildd_running">&2
30   exit 1
31 fi
32
33 echo $$ > /usr/share/grml-live/buildd/buildd_running
34
35 for flavour in $FLAVOURS; do
36   /usr/share/grml-live/buildd/grml-live_autobuild_${flavour}.sh
37   /usr/share/grml-live/buildd/upload_isos.sh && \
38   /usr/share/grml-live/buildd/remove_isos.sh
39 done
40
41 rm -f /usr/share/grml-live/buildd/buildd_running
42
43 ## END OF FILE #################################################################