buildd: support setting variables through grml-buildd.conf in working directory,...
authorMichael Prokop <mika@grml.org>
Fri, 18 Mar 2011 11:11:58 +0000 (12:11 +0100)
committerMichael Prokop <mika@grml.org>
Fri, 18 Mar 2011 11:38:36 +0000 (12:38 +0100)
buildd/cleanup.sh
buildd/grml-buildd.conf
buildd/link_latest.sh

index 9ec7c31..d0e6fe7 100755 (executable)
@@ -8,10 +8,30 @@
 
 set -e
 
 
 set -e
 
-. /etc/grml/grml-buildd.conf
+dir="$(dirname $0)"
 
 
-[ -n "$MIRROR_DIRECTORY" ] || exit 1
-cd $MIRROR_DIRECTORY || exit 2
+if [ -r /etc/grml/grml-buildd.conf ] ; then
+  . /etc/grml/grml-buildd.conf
+elif [ -r "${dir}/grml-buildd.conf" ] ; then
+  . "${dir}/grml-buildd.conf"
+fi
+
+# directory where daily ISOs are stored locally
+if [ -z "$MIRROR_DIRECTORY" ] ; then
+  echo "Error: \$MIRROR_DIRECTORY is not set. Exiting." >&2
+  exit 1
+fi
+
+# mail address where reports should be sent to
+if [ -z "$STORAGE_ADMIN" ] ; then
+  echo "Error: \$STORAGE_ADMIN is not set. Exiting." >&2
+  exit 2
+fi
+
+if ! cd "$MIRROR_DIRECTORY" ; then
+  echo "Error: could not change directory to $MIRROR_DIRECTORY" >&2
+  exit 3
+fi
 
 # we want to always keep a few images, no matter how old they are
 # but get rid of the oldest ones first of course :)
 
 # we want to always keep a few images, no matter how old they are
 # but get rid of the oldest ones first of course :)
@@ -43,7 +63,7 @@ done
 
 # inform on successful removal:
 if [ "$(echo "$REMOVE_ME" | tr -d ' ' )" != "" ] ; then
 
 # inform on successful removal:
 if [ "$(echo "$REMOVE_ME" | tr -d ' ' )" != "" ] ; then
-   echo "deleted files $REMOVE_ME" | mail -s "daily-builds cleanup script" mika@grml.org
+   echo "deleted files $REMOVE_ME" | mail -s "daily-builds cleanup script" "$STORAGE_ADMIN"
 fi
 
 ## END OF FILE #################################################################
 fi
 
 ## END OF FILE #################################################################
index c5dcec5..4ba67c6 100644 (file)
@@ -8,9 +8,15 @@
 # where do you want to store chroot/ISOs/...? Must be set!
 #STORAGE=/grml-live/
 
 # where do you want to store chroot/ISOs/...? Must be set!
 #STORAGE=/grml-live/
 
+# build server (not necessarily daily-ISO storage server!),
 # who should get notification mails?
 # default: root@localhost
 # who should get notification mails?
 # default: root@localhost
-#RECIPIENT=root@localhost
+#RECIPIENT=root@example.org
+
+# daily-ISO storage server (not necessarily build server!),
+# where should mails be reported to of daily
+# default: root@localhost
+#STORAGE_ADMIN=buildd@example.org
 
 # do you want to force rebuild of already present ISOs?
 # Set it to '1' to force rebuild, otherwise use '0'.
 
 # do you want to force rebuild of already present ISOs?
 # Set it to '1' to force rebuild, otherwise use '0'.
@@ -29,6 +35,8 @@
 
 # which directory should be cleaned up?
 # used for example inside /usr/share/grml-live/buildd/cleanup.sh
 
 # which directory should be cleaned up?
 # used for example inside /usr/share/grml-live/buildd/cleanup.sh
-#MIRROR_DIRECTORY=/home/ftp/www.grml.org/daily
+#MIRROR_DIRECTORY=/srv/mirror/www.grml.org/daily
+
+
 
 ## END OF FILE #################################################################
 
 ## END OF FILE #################################################################
index 3e7345d..a6c22ee 100755 (executable)
@@ -8,15 +8,26 @@
 
 set -e
 
 
 set -e
 
-. /etc/grml/grml-buildd.conf
+dir="$(dirname $0)"
 
 
-[ -n "$MIRROR_DIRECTORY" ] || exit 1
-cd $MIRROR_DIRECTORY || exit 2
+if [ -r /etc/grml/grml-buildd.conf ] ; then
+  . /etc/grml/grml-buildd.conf
+elif [ -r "${dir}/grml-buildd.conf" ] ; then
+  . "${dir}/grml-buildd.conf"
+fi
 
 
-DAILY_DIR=/srv/mirror/www.grml.org/daily
+# directory where daily ISOs are stored locally
+if [ -z "$MIRROR_DIRECTORY" ] ; then
+  echo "Error: \$MIRROR_DIRECTORY is not set. Exiting." >&2
+  exit 1
+fi
 
 
-cd "$DAILY_DIR"
-echo "---------------------------" >> "$DAILY_DIR"/.timestamp_link
+if ! cd "$MIRROR_DIRECTORY" ; then
+  echo "Error: could not change directory to $MIRROR_DIRECTORY" >&2
+  exit 1
+fi
+
+echo "---------------------------" >> "$MIRROR_DIRECTORY"/.timestamp_link
 for flavour in grml-medium_squeeze   grml-medium_wheezy   grml-medium_sid   grml-small_squeeze   grml-small_wheezy  grml-small_sid \
                grml64-medium_squeeze grml64-medium_wheezy grml64-medium_sid grml64-small_squeeze grml64-small_wheezy grml64-small_sid \
                grml64_squeeze grml64_wheezy grml64_sid grml_squeeze grml_wheezy grml_sid ; do
 for flavour in grml-medium_squeeze   grml-medium_wheezy   grml-medium_sid   grml-small_squeeze   grml-small_wheezy  grml-small_sid \
                grml64-medium_squeeze grml64-medium_wheezy grml64-medium_sid grml64-small_squeeze grml64-small_wheezy grml64-small_sid \
                grml64_squeeze grml64_wheezy grml64_sid grml_squeeze grml_wheezy grml_sid ; do
@@ -30,9 +41,9 @@ for flavour in grml-medium_squeeze   grml-medium_wheezy   grml-medium_sid   grml
      sed "s/$name/$latest/" "${ISO}".md5 > "${latest}".md5
      name=$(awk '{print $2}' "${ISO}".sha1)
      sed "s/$name/$latest/" "${ISO}".sha1 > "${latest}".sha1
      sed "s/$name/$latest/" "${ISO}".md5 > "${latest}".md5
      name=$(awk '{print $2}' "${ISO}".sha1)
      sed "s/$name/$latest/" "${ISO}".sha1 > "${latest}".sha1
-     echo "$ISO" >> "$DAILY_DIR"/.timestamp_link
+     echo "$ISO" >> "$MIRROR_DIRECTORY"/.timestamp_link
   fi
 done
   fi
 done
-echo "---------------------------" >> "$DAILY_DIR"/.timestamp_link
+echo "---------------------------" >> "$MIRROR_DIRECTORY"/.timestamp_link
 
 ## END OF FILE #################################################################
 
 ## END OF FILE #################################################################