[Debian-live-changes] r1611 - dists/trunk/live-webbuilder
daniel at alioth.debian.org
daniel at alioth.debian.org
Tue May 22 20:07:46 UTC 2007
Author: daniel
Date: 2007-05-22 20:07:46 +0000 (Tue, 22 May 2007)
New Revision: 1611
Modified:
dists/trunk/live-webbuilder/cron
dists/trunk/live-webbuilder/defaults
dists/trunk/live-webbuilder/live-webbuilder
Log:
Modified: dists/trunk/live-webbuilder/cron
===================================================================
--- dists/trunk/live-webbuilder/cron 2007-05-22 19:14:55 UTC (rev 1610)
+++ dists/trunk/live-webbuilder/cron 2007-05-22 20:07:46 UTC (rev 1611)
@@ -7,8 +7,6 @@
# This is free software, and you are welcome to redistribute it
# under certain conditions; see COPYING for details.
-set -e
-
# Reading defaults
if [ -r /etc/default/live-webbuilder ]
then
@@ -38,11 +36,13 @@
touch /var/lock/live-webbuilder.lock
# Ok from here spin through the live-webbuilder files we have waiting to build
-for LWB in "${TEMPDIR}"/*.lwb
+for FILE in "${TEMPDIR}"/*.build
do
- # Pull in the meta file
- . "${LWB}"
+ DATE_START="`date -R`"
+ # Reading build file
+ . "${FILE}"
+
# Assembling options
if [ -n "${BINARY_IMAGE}" ]
then
@@ -94,32 +94,109 @@
LIVE_OPTIONS="${LIVE_OPTIONS} --packages-lists ${PACKAGES_LISTS}"
fi
- mkdir -p "${DESTDIR}"/${BUILD}
- cd "${DESTDIR}"/${BUILD}
- MAILER="Greetings,\nBeginning your build at: `date -R`"
- echo "Begin: `date -R`" > "${DESTDIR}"/${BUILD}/log.txt
+ # Creating build directory
+ mkdir -p "${TEMPDIR}"/"${BUILD}"
- # Below is where we try to put is all together.
- make-live --root "${DESTDIR}"/${BUILD} ${LIVE_OPTIONS} >> "${DESTDIR}"/${BUILD}/log.txt 2>&1
- MAILER="${MAILER}\nEnding your build at: `date -R`\nTo download your debian-live build see ${SITE_SERVER}/${BUILD} "
- echo "Ending: `date -R`" >> "${DESTDIR}"/${BUILD}/log.txt
- echo ${MAILER} | mail -s "End build of id - ${BUILD}" ${EMAIL}
+ cd "${TEMPDIR}"/"${BUILD}"
- # Move the .lwb file to the target so we do not try to rebuild later
- mv "${LWB}" "${DESTDIR}"/${BUILD}
+# First part of user email.
+cat > "${TEMPDIR}"/"${BUILD}"/mail.txt << EOF
+Subject: Debian Live Webbuilder, ${BUILD}
+From: Debian Live Webbuilder <debian-live-devel at lists.alioth.debian.org>
+To: ${EMAIL}
- # Do cleanup after
- #cd "${DESTDIR}"/${BUILD}
- #lh_clean
+Hi,
- # Unmount some things if still around
- if [ -f "${DESTDIR}"/${BUILD}/chroot/proc/version ]
+this is the automatic Live builder from the Debian Live project
+<http://debian-live.alioth.debian.org/>.
+
+Your build with the ID ${BUILD} has been started at:
+${DATE_START}
+EOF
+
+ echo "Begin: `date -R`" > "${TEMPDIR}"/"${BUILD}"/log.txt
+
+ # Generating image
+ make-live ${LIVE_OPTIONS} >> "${TEMPDIR}"/"${BUILD}"/log.txt 2>&1
+ ERROR="${?}"
+
+ DATE_END="`date -R`"
+
+ # Creating image directory
+ mkdir -p "${DESTDIR}"/"${BUILD}"
+
+ echo "End: ${DATE_END}" >> "${TEMPDIR}"/"${BUILD}"/log.txt
+
+ if [ "${?}" = "0" ]
then
- umount "${DESTDIR}"/${BUILD}/chroot/proc
+
+cat >> "${TEMPDIR}"/"${BUILD}"/mail.txt << EOF
+and was sucessfully finished at:
+${DATE_END}
+
+You can download the images at:
+<http://${SERVER}/${BUILD}/>
+
+Have fun,
+the Debian Live team
+EOF
+
+ else
+
+cat >> "${TEMPDIR}"/"${BUILD}"/mail.txt << EOF
+and was unsucessfully finished at:
+${DATE_END}
+
+You can see the logs at:
+<http://${SERVER}/${BUILD}/>
+
+Have fun,
+the Debian Live team
+EOF
+
fi
- if [ -d "${DESTDIR}"/${BUILD}/chroot/sys/kernel ]
+ # Moving binary image
+ if ls "${TEMPDIR}"/"${BUILD}"/debian-live/binary.* &> /dev/null
then
- umount "${DESTDIR}"/${BUILD}/chroot/sys
+ mv "${TEMPDIR}"/"${BUILD}"/debian-live/binary.* "${DESTDIR}"/"${BUILD}"
fi
+
+ # Moving source image
+ if ls "${TEMPDIR}"/"${BUILD}"/debian-live/source.* &> /dev/null
+ then
+ mv "${TEMPDIR}"/"${BUILD}"/debian-live/source.* "${DESTDIR}"/"${BUILD}"
+ fi
+
+ # Moving build
+ mv "${TEMPDIR}"/"${BUILD}".build "${DESTDIR}"/"${BUILD}"/build
+
+ # Moving log
+ mv "${TEMPDIR}"/"${BUILD}"/log.txt "${DESTDIR}"/"${BUILD}"
+
+ # Moving mail
+ mv "${TEMPDIR}"/"${BUILD}"/mail.txt "${DESTDIR}"/"${BUILD}"
+
+ # Generating md5sum
+ cd "${DESTDIR}"/"${BUILD}"
+ md5sum * > md5sum.txt
+ cd "${OLDPWD}"
+
+ # Sending mail
+ cat "${DESTDIR}"/"${BUILD}"/mail.txt | /usr/sbin/sendmail -t
+
+ # Unmounting proc
+ if [ -f "${TEMPDIR}"/"${BUILD}"/debian-live/chroot/proc/version ]
+ then
+ umount "${TEMPDIR}"/"${BUILD}"/debian-live/chroot/proc
+ fi
+
+ # Unmounting sysfs
+ if [ -d "${TEMPDIR}"/"${BUILD}"/debian-live/chroot/sys/kernel ]
+ then
+ umount "${TEMPDIR}"/${BUILD}/debian-live/chroot/sys
+ fi
+
+ # Removing build directory
+ rm -rf "${TEMPDIR}"/"${BUILD}"
done
Modified: dists/trunk/live-webbuilder/defaults
===================================================================
--- dists/trunk/live-webbuilder/defaults 2007-05-22 19:14:55 UTC (rev 1610)
+++ dists/trunk/live-webbuilder/defaults 2007-05-22 20:07:46 UTC (rev 1611)
@@ -3,11 +3,11 @@
WEBBUILD="disabled"
DESTDIR="/var/www/live-webbuilder"
-TEMPDIR="/tmp"
+TEMPDIR="/tmp/live-webbuilder"
MIRROR_BOOTSTRAP="http://ftp.debian.org/debian/"
MIRROR_BOOTSTRAP_SECURITY="http://security.debian.org/"
MIRROR_IMAGE="http://ftp.debian.org/debian/"
MIRROR_IMAGE_SECURITY="http://security.debian.org/"
-SITE_SERVER="http://localhost/live-webbuilder"
+SERVER="http://localhost/live-webbuilder"
Modified: dists/trunk/live-webbuilder/live-webbuilder
===================================================================
--- dists/trunk/live-webbuilder/live-webbuilder 2007-05-22 19:14:55 UTC (rev 1610)
+++ dists/trunk/live-webbuilder/live-webbuilder 2007-05-22 20:07:46 UTC (rev 1611)
@@ -20,79 +20,76 @@
# On Debian systems, the complete text of the GNU General Public License
# can be found in /usr/share/common-licenses/GPL file.
-# Set some global the parameters
+# Setting static variables
VERSION="0.2.7"
-TEMPDIR="/tmp"
+
HTML="/usr/share/live-webbuilder/html"
+TEMPDIR="/tmp/live-webbuilder"
-# Send the HTTP headers
+# Sending http header
echo "Content-type: text/html"
echo
-# Start sending HTML with version number.
+# Sending html header
cat "${HTML}"/header.html
-##########################################
-# Collet the parms
-##########################################
-#echo $QUERY_STRING
-
+# CGI
if [ -z "${QUERY_STRING}" ]
then
- # Generate the form since it looks like
- # no parameters were detected being passed.
+ # Sending html form
cat "${HTML}"/form.html
else
- # Ok we made it here so we have parameters
- # sent to the script.
+ # Converting spaces: sed "s/+/ /g"
+ # Converting '@': sed "s/%40/@/g"
+ # Converting ':': sed "s/%3A/:/g"
+ # Converting '/': sed "s/%2F/\//g"
- # Collect parameters from the $QUERY_STRING
-
- #echo $QUERY_STRING
- # sed "s/+/ /g" -> converts for spaces passed
- # sed "s/%40/@/g" -> converts for @ symbol passed
- # sed "s/%3A/:/g" -> converts for : sybmol passed
- # sed "s/%2F/\//g" -> converts for / symbol passed
- # --iso-volume STRING
-
+ # Filtering url parameters
EMAIL="`grep -oE '(^|[?&])email=[0-9,a-z,A-Z,.,%,-]+' ${QUERY_STRING} | sed 's/%40/@/g' | cut -f 2 -d '=' | head -n1`"
+
BINARY_IMAGE="`grep -oE '(^|[?&])binary_image=[a-z]+' ${QUERY_STRING} | cut -f 2 -d '=' | head -n1`"
DISTRIBUTION="`grep -oE '(^|[?&])distribution=[a-z]+' ${QUERY_STRING} | cut -f 2 -d '=' | head -n1`"
- FILESYSTEM="`grep -oE '(^|[?&])filesystem=[0-9,a-z]+' ${QUERY_STRING} | cut -f 2 -d '=' | head -n1`"
- ISO_VOLUME="`grep -oE '(^|[?&])iso_volume=[0-9,a-z,A-Z,.,_,-,+]+' ${QUERY_STRING} | sed 's/+/ /g' | cut -f 2 -d '=' | head -n1`"
PACKAGES_LISTS="`grep -oE '(^|[?&])packages_lists=[a-z]+' ${QUERY_STRING} | cut -f 2 -d '=' | head -n1`"
PACKAGES="`grep -oE '(^|[?&])packages=[0-9,a-z,A-Z,.,_,-,+]+' ${QUERY_STRING} | sed 's/+/ /g' | cut -f 2 -d '=' | head -n1`"
- # Set the build number
- # This is crude but should get the average
- # site by until someone else wanted to mess
- # with.
+ FILESYSTEM="`grep -oE '(^|[?&])filesystem=[0-9,a-z]+' ${QUERY_STRING} | cut -f 2 -d '=' | head -n1`"
+ ISO_VOLUME="`grep -oE '(^|[?&])iso_volume=[0-9,a-z,A-Z,.,_,-,+]+' ${QUERY_STRING} | sed 's/+/ /g' | cut -f 2 -d '=' | head -n1`"
+
+ # FIXME: filter invalid options
+
+ # Getting build identifier
BUILD="`date +%Y%m%d.%s`"
- # Start sending HTML
+ # Sending html confirmation
sed -e "s/BUILD/${BUILD}/" \
-e "s/EMAIL/${EMAIL}/" \
-e "s/BINARY_IMAGE/${BINARY_IMAGE}/" \
-e "s/DISTRIBUTION/${DISTRIBUTION}/" \
- -e "s/FILESYSTEM/${FILESYSTEM}/" \
- -e "s/ISO_VOLUME/${ISO_VOLUME}/" \
-e "s/PACKAGES_LISTS/${PACKAGES_LISTS}/" \
-e "s/PACKAGES/${PACKAGES}/" \
+ -e "s/FILESYSTEM/${FILESYSTEM}/" \
+ -e "s/ISO_VOLUME/${ISO_VOLUME}/" \
"${HTML}"/build.html
- # Set the variables to pass to the cron job
- # for processing.
- #echo "`whoami`"
+ # Creating temporary directory
+ if [ ! -d "${TEMPDIR}" ]
+ then
+ mkdir -p "${TEMPDIR}"
+ fi
-cat > "${TEMPDIR}"/"${BUILD}".lwb << EOF
+# Writing build file
+cat > "${TEMPDIR}"/"${BUILD}".build << EOF
BUILD="${BUILD}"
+
EMAIL="${EMAIL}"
+
BINARY_IMAGE="${BINARY_IMAGE}"
-ISO_VOLUME="${ISO_VOLUME}"
DISTRIBUTION="${DISTRIBUTION}"
-FILESYSTEM="${FILESYSTEM}"
PACKAGES_LISTS="${PACKAGES_LISTS}"
PACKAGES="${PACKAGES}"
+
+FILESYSTEM="${FILESYSTEM}"
+ISO_VOLUME="${ISO_VOLUME}"
EOF
fi
More information about the Debian-live-changes
mailing list