[SCM] Debian Live build scripts (webfrontent) branch, master, updated. 3fdcc59654986d57f014b6c6721b2a3abde2f722
Richard Nelson
unixabg at gmail.com
Tue Sep 9 02:31:05 UTC 2008
The following commit has been merged in the master branch:
commit 3fdcc59654986d57f014b6c6721b2a3abde2f722
Author: Richard Nelson <unixabg at gmail.com>
Date: Mon Sep 8 21:29:41 2008 -0500
Local variable prefix with _ on VAR i.e. _VAR
diff --git a/scripts/cgi b/scripts/cgi
index 97bfe58..6d94d76 100755
--- a/scripts/cgi
+++ b/scripts/cgi
@@ -38,7 +38,7 @@ echo "Content-type: text/html"
echo
# Sending html header
-cat "${TEMPLATES}"/header.html
+cat "${_TEMPLATES}"/header.html
# CGI
if [ -z "${QUERY_STRING}" ]
@@ -50,7 +50,7 @@ then
-e "s#LH_MIRROR_BINARY#${LH_MIRROR_BINARY}#" \
-e "s/VERSION/${VERSION}/" \
-e "s/DATE/`date +%Y%m%d-%H:%M`/" \
- "${TEMPLATES}"/form.html
+ "${_TEMPLATES}"/form.html
else
# Converting spaces: sed 's/+/ /g'
# Converting '@': sed 's/%40/@/g'
@@ -65,7 +65,7 @@ else
# echo ${QUERY_STRING}
# Email
- EMAIL=$(echo ${QUERY_STRING} | grep -oE '(^|[?&])email=[0-9,a-z,A-Z,.,_,-,@]+' | cut -f 2 -d '=' | head -n1)
+ _EMAIL=$(echo ${QUERY_STRING} | grep -oE '(^|[?&])email=[0-9,a-z,A-Z,.,_,-,@]+' | cut -f 2 -d '=' | head -n1)
# Standard options
LH_BINARY_IMAGES=$(echo ${QUERY_STRING} | grep -oE '(^|[?&])binary_images=[a-z]+' | cut -f 2 -d '=' | head -n1)
@@ -110,13 +110,13 @@ else
LH_SOURCE_IMAGES=$(echo ${QUERY_STRING} | grep -oE '(^|[?&])source_images=[a-z]+' | cut -f 2 -d '=' | head -n1)
# Unofficial options
- CUSTOM_BOOTSTRAP=$(echo ${QUERY_STRING} | grep -oE '(^|[?&])custom_bootstrap=[0-9,a-z,A-Z,., ,~,;,:,/,_,-]+' | cut -f 2 -d '=' | head -n1)
- CUSTOM_BINARY=$(echo ${QUERY_STRING} | grep -oE '(^|[?&])custom_binary=[0-9,a-z,A-Z,., ,~,;,:,/,_,-]+' | cut -f 2 -d '=' | head -n1)
+ _CUSTOM_BOOTSTRAP=$(echo ${QUERY_STRING} | grep -oE '(^|[?&])custom_bootstrap=[0-9,a-z,A-Z,., ,~,;,:,/,_,-]+' | cut -f 2 -d '=' | head -n1)
+ _CUSTOM_BINARY=$(echo ${QUERY_STRING} | grep -oE '(^|[?&])custom_binary=[0-9,a-z,A-Z,., ,~,;,:,/,_,-]+' | cut -f 2 -d '=' | head -n1)
# FIXME: filter invalid options
unset QUERY_STRING
- if [ -z "${EMAIL}" ]
+ if [ -z "${_EMAIL}" ]
then
echo "<h2><div style='color: red;'>Error: No email address specified.</div></h2>"
@@ -126,19 +126,19 @@ else
-e "s#LH_MIRROR_BINARY#${LH_MIRROR_BINARY}#" \
-e "s/VERSION/${VERSION}/" \
-e "s/DATE/`date +%Y%m%d-%H:%M`/" \
- "${TEMPLATES}"/form.html
+ "${_TEMPLATES}"/form.html
exit
fi
# Getting build identifier
- BUILD=$(date +%Y%m%d.%H%M%S.%N)
+ _BUILD=$(date +%Y%m%d.%H%M%S.%N)
echo ${QUERY_STRING}
# Sending html confirmation
# Note: On each string remember to use a delimeter that is not in the string.
- sed -e "s/BUILD/${BUILD}/g" \
- -e "s/EMAIL/${EMAIL}/" \
+ sed -e "s/BUILD/${_BUILD}/g" \
+ -e "s/EMAIL/${_EMAIL}/" \
-e "s/LH_BINARY_IMAGES/${LH_BINARY_IMAGES}/" \
-e "s/LH_DISTRIBUTION/${LH_DISTRIBUTION}/" \
-e "s/LH_PACKAGES_LISTS/${LH_PACKAGES_LISTS}/" \
@@ -168,24 +168,24 @@ else
-e "s/LH_MEMTEST/${LH_MEMTEST}/" \
-e "s#LH_NET_PATH#${LH_NET_PATH}#" \
-e "s/LH_NET_SERVER/${LH_NET_SERVER}/" \
- -e "s#SERVER#${SERVER}#g" \
+ -e "s#SERVER#${_SERVER}#g" \
-e "s/LH_USERNAME/${LH_USERNAME}/" \
-e "s/LH_SOURCE_IMAGES/${LH_SOURCE_IMAGES}/" \
-e "s/LH_SOURCE/${LH_SOURCE}/" \
- -e "s#CUSTOM_BOOTSTRAP#${CUSTOM_BOOTSTRAP}#" \
- -e "s#CUSTOM_BINARY#${CUSTOM_BINARY}#" \
- "${TEMPLATES}"/build.html
+ -e "s#CUSTOM_BOOTSTRAP#${_CUSTOM_BOOTSTRAP}#" \
+ -e "s#CUSTOM_BINARY#${_CUSTOM_BINARY}#" \
+ "${_TEMPLATES}"/build.html
# Creating temporary directory
- mkdir -p "${TEMPDIR}"
+ mkdir -p "${_TEMPDIR}"
# Writing build file
-cat > "${TEMPDIR}"/"${BUILD}".build << EOF
+cat > "${_TEMPDIR}"/"${_BUILD}".build << EOF
# live-webhelper ${VERSION} build file
# `date -R`
-BUILD="${BUILD}"
-EMAIL="${EMAIL}"
+_BUILD="${_BUILD}"
+_EMAIL="${_EMAIL}"
# Standard options
LH_BINARY_IMAGES="${LH_BINARY_IMAGES}"
@@ -229,12 +229,12 @@ LH_SOURCE_IMAGES="${LH_SOURCE_IMAGES}"
LH_SOURCE="${LH_SOURCE}"
# Unofficial options
-CUSTOM_BOOTSTRAP="${CUSTOM_BOOTSTRAP}"
-CUSTOM_BINARY="${CUSTOM_BINARY}"
+_CUSTOM_BOOTSTRAP="${_CUSTOM_BOOTSTRAP}"
+_CUSTOM_BINARY="${_CUSTOM_BINARY}"
EOF
- echo "$(date +%b\ %d\ %H:%M:%S) ${HOSTNAME} live-webhelper: add web build (${BUILD})." >> /var/log/live
- echo "$(date +%b\ %d\ %H:%M:%S) ${HOSTNAME} live-webhelper: options ${BUILD} |email ${EMAIL}|binary_images ${LH_BINARY_IMAGES}|distribution ${LH_DISTRIBUTION}|packages_lists ${LH_PACKAGES_LISTS}|packages ${LH_PACKAGES}|architecture ${LH_ARCHITECTURE}|mirror_bootstrap_security ${LH_MIRROR_BOOTSTRAP}|mirror_bootstrap ${LH_MIRROR_BOOTSTRAP}|mirror_binary_security ${LH_MIRROR_BINARY_SECURITY}|mirror_binary ${LH_MIRROR_BINARY}|sections ${LH_SECTIONS}|chroot_filesystem ${LH_CHROOT_FILESYSTEM}|linux_flavours ${LH_LINUX_FLAVOURS}|security ${LH_SECURITY}|symlinks ${LH_SYMLINKS}|sysvinit ${LH_SYSVINIT}|binary_indices ${LH_BINARY_INDICES}|bootappend ${LH_BOOTAPPEND}|bootloader ${LH_BOOTLOADER}|debian_installer ${LH_DEBIAN_INSTALLER}|encryption ${LH_ENCRYPTION}|hostname ${LH_HOSTNAME}|iso_application ${LH_ISO_APPLICATION}|iso_preparer ${LH_ISO_PREPARER}|iso_publisher ${LH_ISO_PUBLISHER}|iso_volume ${LH_ISO_VOLUME}|memtest ${LH_MEMTEST}|net_path ${LH_NET_PATH}|net_server ${LH_NET_SERVER
}|username ${LH_USERNAME}|source_images ${LH_SOURCE_IMAGES}|source ${LH_SOURCE}|" >> /var/log/live
+ echo "$(date +%b\ %d\ %H:%M:%S) ${HOSTNAME} live-webhelper: add web build (${_BUILD})." >> /var/log/live
+ echo "$(date +%b\ %d\ %H:%M:%S) ${HOSTNAME} live-webhelper: options ${_BUILD} |email ${_EMAIL}|binary_images ${LH_BINARY_IMAGES}|distribution ${LH_DISTRIBUTION}|packages_lists ${LH_PACKAGES_LISTS}|packages ${LH_PACKAGES}|architecture ${LH_ARCHITECTURE}|mirror_bootstrap_security ${LH_MIRROR_BOOTSTRAP}|mirror_bootstrap ${LH_MIRROR_BOOTSTRAP}|mirror_binary_security ${LH_MIRROR_BINARY_SECURITY}|mirror_binary ${LH_MIRROR_BINARY}|sections ${LH_SECTIONS}|chroot_filesystem ${LH_CHROOT_FILESYSTEM}|linux_flavours ${LH_LINUX_FLAVOURS}|security ${LH_SECURITY}|symlinks ${LH_SYMLINKS}|sysvinit ${LH_SYSVINIT}|binary_indices ${LH_BINARY_INDICES}|bootappend ${LH_BOOTAPPEND}|bootloader ${LH_BOOTLOADER}|debian_installer ${LH_DEBIAN_INSTALLER}|encryption ${LH_ENCRYPTION}|hostname ${LH_HOSTNAME}|iso_application ${LH_ISO_APPLICATION}|iso_preparer ${LH_ISO_PREPARER}|iso_publisher ${LH_ISO_PUBLISHER}|iso_volume ${LH_ISO_VOLUME}|memtest ${LH_MEMTEST}|net_path ${LH_NET_PATH}|net_server ${LH_NET_SERV
ER}|username ${LH_USERNAME}|source_images ${LH_SOURCE_IMAGES}|source ${LH_SOURCE}|custom_bootstrap ${_CUSTOM_BOOTSTRAP}|custom_binary ${_CUSTOM_BINARY}\n" >> /var/log/live
fi
-sed -e "s/VERSION/${VERSION}/" "${TEMPLATES}"/footer.html
+sed -e "s/VERSION/${VERSION}/" "${_TEMPLATES}"/footer.html
diff --git a/scripts/cron b/scripts/cron
index 11b063d..fc115a3 100755
--- a/scripts/cron
+++ b/scripts/cron
@@ -21,7 +21,7 @@ else
fi
# Exit if disabled
-if [ "${WEBBUILD}" != "enabled" ]
+if [ "${_WEBBUILD}" != "enabled" ]
then
exit 0
fi
@@ -40,115 +40,115 @@ trap "test -f /var/lock/live-webhelper.lock && rm -f /var/lock/live-webhelper.lo
touch /var/lock/live-webhelper.lock
# Cleanup old builds: cron should be run at least once per hour to take effect
-if ls "${DESTDIR}"/`date -d yesterday +%Y%m%d.%H`* > /dev/null 2>&1
+if ls "${_DESTDIR}"/`date -d yesterday +%Y%m%d.%H`* > /dev/null 2>&1
then
- rm -rf "${DESTDIR}"/`date -d yesterday +%Y%m%d.%H`*
+ rm -rf "${_DESTDIR}"/`date -d yesterday +%Y%m%d.%H`*
echo "`date +%b\ %d\ %H:%M:%S` ${HOSTNAME} live-webhelper: remove web build (`date -d yesterday +%Y%m%d.%H`*)." >> /var/log/live
fi
# Ok from here spin through the live-webhelper files we have waiting to build
-if ls "${TEMPDIR}"/*.build > /dev/null 2>&1
+if ls "${_TEMPDIR}"/*.build > /dev/null 2>&1
then
- for FILE in "${TEMPDIR}"/*.build
+ for _FILE in "${_TEMPDIR}"/*.build
do
# Pull in the variables we want from the config file.
# Pul in the build number
- BUILD=`awk -F\" '/^BUILD=/{print $2}' ${FILE}`
+ _BUILD=`awk -F\" '/^_BUILD=/{print $2}' ${_FILE}`
# Pull in the email address
- EMAIL=`awk -F\" '/^EMAIL=/{print $2}' ${FILE}`
+ _EMAIL=`awk -F\" '/^_EMAIL=/{print $2}' ${_FILE}`
# Drop out some build data for information if something goes wrong.
- echo "`date +%b\ %d\ %H:%M:%S` ${HOSTNAME} live-webhelper: begin web build (${BUILD})." >> /var/log/live
+ echo "`date +%b\ %d\ %H:%M:%S` ${HOSTNAME} live-webhelper: begin web build (${_BUILD})." >> /var/log/live
# Creating build directory which also creates the config/chroot_sources folder
- mkdir -p "${TEMPDIR}"/"${BUILD}"/config/chroot_sources
+ mkdir -p "${_TEMPDIR}"/"${_BUILD}"/config/chroot_sources
# The next two tests are for unofficial third party repositories
- if [ -n "${CUSTOM_BOOTSTRAP}" ]
+ if [ -n "${_CUSTOM_BOOTSTRAP}" ]
then
- echo "${CUSTOM_BOOTSTRAP}" > "${TEMPDIR}"/"${BUILD}"/config/chroot_sources/custom.bootstrap
+ echo "${_CUSTOM_BOOTSTRAP}" > "${_TEMPDIR}"/"${_BUILD}"/config/chroot_sources/custom.bootstrap
fi
- if [ -n "${CUSTOM_BINARY}" ]
+ if [ -n "${_CUSTOM_BINARY}" ]
then
- echo "${CUSTOM_BINARY}" > "${TEMPDIR}"/"${BUILD}"/config/chroot_sources/custom.binary
+ echo "${_CUSTOM_BINARY}" > "${_TEMPDIR}"/"${_BUILD}"/config/chroot_sources/custom.binary
fi
- DATE_START="`date -R`"
- echo "Begin: ${DATE_START}" > "${TEMPDIR}"/"${BUILD}"/log
+ _DATE_START="`date -R`"
+ echo "Begin: ${_DATE_START}" > "${_TEMPDIR}"/"${_BUILD}"/log
# Generating image
- cd "${TEMPDIR}"/"${BUILD}"
- lh_config -c ${FILE} >> "${TEMPDIR}"/"${BUILD}"/log 2>&1
- ERRORCONFIG="${?}"
- lh_build >> "${TEMPDIR}"/"${BUILD}"/log 2>&1
- ERRORBUILD="${?}"
+ cd "${_TEMPDIR}"/"${_BUILD}"
+ lh_config -c ${_FILE} >> "${_TEMPDIR}"/"${_BUILD}"/log 2>&1
+ _ERRORCONFIG="${?}"
+ lh_build >> "${_TEMPDIR}"/"${_BUILD}"/log 2>&1
+ _ERRORBUILD="${?}"
- DATE_END="`date -R`"
- echo "End: ${DATE_END}" >> "${TEMPDIR}"/"${BUILD}"/log
+ _DATE_END="`date -R`"
+ echo "End: ${_DATE_END}" >> "${_TEMPDIR}"/"${_BUILD}"/log
# Creating image directory
- mkdir -p "${DESTDIR}"/"${BUILD}"
+ mkdir -p "${_DESTDIR}"/"${_BUILD}"
# Creating mail
- if [ "${ERRORCONFIG}" -eq "0" ] && [ "${ERRORBUILD}" -eq "0" ]
+ if [ "${_ERRORCONFIG}" -eq "0" ] && [ "${_ERRORBUILD}" -eq "0" ]
then
- STATUS="maybe-successful"
+ _STATUS="maybe-successful"
else
- STATUS="maybe-failed"
+ _STATUS="maybe-failed"
fi
- sed -e "s/BUILD/${BUILD}/g" \
- -e "s/EMAIL/${EMAIL}/" \
+ sed -e "s/BUILD/${_BUILD}/g" \
+ -e "s/EMAIL/${_EMAIL}/" \
-e "s/VERSION/${VERSION}/" \
- -e "s/DATE_START/${DATE_START}/" \
- -e "s/DATE_END/${DATE_END}/" \
- -e "s/STATUS/${STATUS}/" \
- -e "s#SERVER#${SERVER}#" \
- "${TEMPLATES}"/mail.txt > "${DESTDIR}"/"${BUILD}"/mail
+ -e "s/DATE_START/${_DATE_START}/" \
+ -e "s/DATE_END/${_DATE_END}/" \
+ -e "s/STATUS/${_STATUS}/" \
+ -e "s#SERVER#${_SERVER}#" \
+ "${_TEMPLATES}"/mail.txt > "${_DESTDIR}"/"${_BUILD}"/mail
# Moving binary image
- if ls "${TEMPDIR}"/"${BUILD}"/binary.* > /dev/null 2>&1
+ if ls "${_TEMPDIR}"/"${_BUILD}"/binary.* > /dev/null 2>&1
then
- mv "${TEMPDIR}"/"${BUILD}"/binary.* "${DESTDIR}"/"${BUILD}"
+ mv "${_TEMPDIR}"/"${_BUILD}"/binary.* "${_DESTDIR}"/"${_BUILD}"
fi
# Moving source image
- if ls "${TEMPDIR}"/"${BUILD}"/source.* > /dev/null 2>&1
+ if ls "${_TEMPDIR}"/"${_BUILD}"/source.* > /dev/null 2>&1
then
- mv "${TEMPDIR}"/"${BUILD}"/source.* "${DESTDIR}"/"${BUILD}"
+ mv "${_TEMPDIR}"/"${_BUILD}"/source.* "${_DESTDIR}"/"${_BUILD}"
fi
# Moving build
- mv "${TEMPDIR}"/"${BUILD}".build "${DESTDIR}"/"${BUILD}"/build
+ mv "${_TEMPDIR}"/"${_BUILD}".build "${_DESTDIR}"/"${_BUILD}"/build
# Moving log
- mv "${TEMPDIR}"/"${BUILD}"/log "${DESTDIR}"/"${BUILD}"
+ mv "${_TEMPDIR}"/"${_BUILD}"/log "${_DESTDIR}"/"${_BUILD}"
# Generating md5sum
- cd "${DESTDIR}"/"${BUILD}"
+ cd "${_DESTDIR}"/"${_BUILD}"
md5sum * > md5sum
cd "${OLDPWD}"
# Sending mail
- cat "${DESTDIR}"/"${BUILD}"/mail | /usr/sbin/sendmail -t
+ cat "${_DESTDIR}"/"${_BUILD}"/mail | /usr/sbin/sendmail -t
# Unmounting proc
- if [ -f "${TEMPDIR}"/"${BUILD}"/chroot/proc/version ]
+ if [ -f "${_TEMPDIR}"/"${_BUILD}"/chroot/proc/version ]
then
- umount "${TEMPDIR}"/"${BUILD}"/chroot/proc
+ umount "${_TEMPDIR}"/"${_BUILD}"/chroot/proc
fi
# Unmounting sysfs
- if [ -d "${TEMPDIR}"/"${BUILD}"/chroot/sys/kernel ]
+ if [ -d "${_TEMPDIR}"/"${_BUILD}"/chroot/sys/kernel ]
then
- umount "${TEMPDIR}"/${BUILD}/chroot/sys
+ umount "${_TEMPDIR}"/${_BUILD}/chroot/sys
fi
# Removing build directory
- rm -rf "${TEMPDIR}"/"${BUILD}"
+ rm -rf "${_TEMPDIR}"/"${_BUILD}"
- echo "`date +%b\ %d\ %H:%M:%S` ${HOSTNAME} live-webhelper: end web build (${BUILD}: ${STATUS})." >> /var/log/live
+ echo "`date +%b\ %d\ %H:%M:%S` ${HOSTNAME} live-webhelper: end web build (${_BUILD}: ${_STATUS})." >> /var/log/live
done
fi
diff --git a/scripts/default b/scripts/default
index 969ac56..f2403bd 100644
--- a/scripts/default
+++ b/scripts/default
@@ -1,18 +1,18 @@
# Defaults for /etc/cron.daily/live-webhelper
-WEBBUILD="disabled"
+_WEBBUILD="disabled"
-MODE="debian-official"
+_MODE="debian-official"
-DEBUG="disabled"
+_DEBUG="disabled"
-DESTDIR="/srv/debian-live/www/webhelper"
-TEMPLATES="/usr/share/live-webhelper/templates/${MODE}"
-TEMPDIR="/srv/tmp/live-webhelper"
+_DESTDIR="/srv/debian-live/www/webhelper"
+_TEMPLATES="/usr/share/live-webhelper/templates/${_MODE}"
+_TEMPDIR="/srv/tmp/live-webhelper"
LH_MIRROR_BOOTSTRAP="http://ftp.de.debian.org/debian/"
LH_MIRROR_BOOTSTRAP_SECURITY="http://ftp.de.debian.org/debian-security/"
LH_MIRROR_BINARY="http://ftp.debian.org/debian/"
LH_MIRROR_BINARY_SECURITY="http://security.debian.org/"
-SERVER="http://live.debian.net/webhelper"
+_SERVER="http://live.debian.net/webhelper"
--
Debian Live build scripts (webfrontent)
More information about the debian-live-changes
mailing list