From 2c5004a3583c3535e7d40d5eacad0b3b876b65b0 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Tue, 5 Jun 2012 20:25:23 +0200 Subject: Re-arranging frontends in source tree. --- Makefile | 6 +- cgi/Makefile | 21 -- cgi/live-build-cgi | 225 --------------------- cgi/live-build-cgi.cron | 204 -------------------- cgi/live-build-cgi.crontab | 7 - cgi/live-build-cgi.default | 13 -- cgi/live-build-cgi.logrotate | 11 -- cron/TODO | 10 - cron/live-build-cron-images | 343 --------------------------------- cron/live-build-cron-manual | 99 ---------- frontends/cgi/Makefile | 21 ++ frontends/cgi/live-build-cgi | 225 +++++++++++++++++++++ frontends/cgi/live-build-cgi.cron | 204 ++++++++++++++++++++ frontends/cgi/live-build-cgi.crontab | 7 + frontends/cgi/live-build-cgi.default | 13 ++ frontends/cgi/live-build-cgi.logrotate | 11 ++ frontends/cron/TODO | 10 + frontends/cron/live-build-cron-images | 343 +++++++++++++++++++++++++++++++++ frontends/cron/live-build-cron-manual | 99 ++++++++++ 19 files changed, 936 insertions(+), 936 deletions(-) delete mode 100644 cgi/Makefile delete mode 100755 cgi/live-build-cgi delete mode 100755 cgi/live-build-cgi.cron delete mode 100644 cgi/live-build-cgi.crontab delete mode 100644 cgi/live-build-cgi.default delete mode 100644 cgi/live-build-cgi.logrotate delete mode 100644 cron/TODO delete mode 100755 cron/live-build-cron-images delete mode 100755 cron/live-build-cron-manual create mode 100644 frontends/cgi/Makefile create mode 100755 frontends/cgi/live-build-cgi create mode 100755 frontends/cgi/live-build-cgi.cron create mode 100644 frontends/cgi/live-build-cgi.crontab create mode 100644 frontends/cgi/live-build-cgi.default create mode 100644 frontends/cgi/live-build-cgi.logrotate create mode 100644 frontends/cron/TODO create mode 100755 frontends/cron/live-build-cron-images create mode 100755 frontends/cron/live-build-cron-manual diff --git a/Makefile b/Makefile index dd9f9e2e1..d6a16e1b9 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ SHELL := sh -e LANGUAGES = $(shell cd manpages/po && ls) -SCRIPTS = cgi/live-build-cgi cgi/live-build-cgi.cron cron/live-build-cron* functions/* examples/*/*.sh examples/auto/* scripts/*.sh scripts/*/* share/hooks/* +SCRIPTS = frontends/cgi/live-build-cgi frontends/cgi/live-build-cgi.cron frontends/cron/live-build-cron* functions/* examples/*/*.sh examples/auto/* scripts/*.sh scripts/*/* share/hooks/* all: build @@ -40,13 +40,13 @@ build: install: # Installing shared data mkdir -p $(DESTDIR)/usr/share/live/build - cp -r cgi data examples functions scripts includes package-lists templates VERSION $(DESTDIR)/usr/share/live/build + cp -r frontends/cgi data examples functions scripts includes package-lists templates VERSION $(DESTDIR)/usr/share/live/build cp -r share/* $(DESTDIR)/usr/share/live/build # Installing executables mkdir -p $(DESTDIR)/usr/bin mv $(DESTDIR)/usr/share/live/build/scripts/build/lb $(DESTDIR)/usr/share/live/build/scripts/build/live-build $(DESTDIR)/usr/bin - cp cron/live-* $(DESTDIR)/usr/bin + cp frontends/cron/live-* $(DESTDIR)/usr/bin # Installing documentation mkdir -p $(DESTDIR)/usr/share/doc/live-build diff --git a/cgi/Makefile b/cgi/Makefile deleted file mode 100644 index 8ac08ddac..000000000 --- a/cgi/Makefile +++ /dev/null @@ -1,21 +0,0 @@ -# Makefile - -install: - install -D -m 0755 live-build-cgi $(DESTDIR)/usr/lib/cgi-bin/live-build - install -D -m 0755 live-build-cgi.cron $(DESTDIR)/etc/cron.hourly/live-build-cgi - install -D -m 0644 live-build-cgi.crontab $(DESTDIR)/etc/cron.d/live-build-cgi - install -D -m 0644 live-build-cgi.default $(DESTDIR)/etc/default/live-build-cgi - install -D -m 0644 live-build-cgi.logrotate $(DESTDIR)/etc/logrotate.d/live-build-cgi - - install -d -m 0755 $(DESTDIR)/var/log - touch $(DESTDIR)/var/log/live - chown www-data:www-data $(DESTDIR)/var/log/live - -uninstall: - rm -f $(DESTDIR)/usr/lib/cgi-bin/live-build - rm -f $(DESTDIR)/etc/cron.d/live-build-cgi - rm -f $(DESTDIR)/etc/cron.hourly/live-build-cgi - rm -f $(DESTDIR)/etc/default/live-build-cgi - rm -f $(DESTDIR)/etc/logrotate.d/live-build-cgi - -reinstall: uninstall install diff --git a/cgi/live-build-cgi b/cgi/live-build-cgi deleted file mode 100755 index 356918fcf..000000000 --- a/cgi/live-build-cgi +++ /dev/null @@ -1,225 +0,0 @@ -#!/bin/sh - -## live-build(7) - System Build Scripts -## Copyright (C) 2006-2012 Daniel Baumann -## -## live-build comes with ABSOLUTELY NO WARRANTY; for details see COPYING. -## This is free software, and you are welcome to redistribute it -## under certain conditions; see COPYING for details. - - -# Including common functions -. "${LB_BASE:-/usr/share/live/build}"/scripts/build.sh - -# Reading defaults -if [ -r /etc/default/live-build-cgi ] -then - . /etc/default/live-build-cgi -else - echo "E: /etc/default/live-build-cgi missing" - exit 1 -fi - -_HOSTNAME="$(hostname -f)" - -# Turn on debug if enabled -if [ "${_DEBUG}" = "enabled" ] -then - set -x -fi - -# Sending http header -echo "Content-type: text/html" -echo - -# Sending html header -cat "${_TEMPLATES}"/header.html - -# CGI -if [ -z "${QUERY_STRING}" ] -then - # Sending html form - sed -e "s/VERSION/${VERSION}/" \ - -e "s/DATE/`date +%Y%m%d-%H:%M`/" \ - "${_TEMPLATES}"/form.html -else - # Converting spaces: sed 's/+/ /g' - # Converting '@': sed 's/%40/@/g' - # Converting ':': sed 's/%3A/:/g' - # Converting ';': sed 's/%3B/\;/g' - # Converting '/': sed 's/%2F/\//g' - # Converting '~': sed 's/%7E/\~/g' - # Converting '=': sed 's/%3D/=/g' - # Converting '+': sed 's/%2B/+/g' - - # Translate parameters - QUERY_STRING=$(echo "${QUERY_STRING}" | sed -e 's/%2F/\//g' -e 's/+/ /g' -e 's/%3B/;/g' -e 's/%7E/~/g' -e 's/%3A/:/g' -e 's/%40/@/g' -e 's/%3D/=/g' -e 's/%2B/+/g') - # Debug the filtering string - # echo ${QUERY_STRING} - - # Email - _EMAIL=$(echo "${QUERY_STRING}" | grep -oE '(^|[?&])email=[-0-9a-zA-Z._@]+' | cut -f 2 -d '=' | head -n1) - - # CGI Packages List - _LB_CGIPACKAGES=$(echo "${QUERY_STRING}" | grep -oE '(^|[?&])cgipackages=[-0-9a-zA-Z. _+]+' | cut -f 2 -d '=' | head -n1) - - # Standard options - LB_BINARY_IMAGES=$(echo "${QUERY_STRING}" | grep -oE '(^|[?&])binary_images=[-a-z]+' | cut -f 2 -d '=' | head -n1) - LB_DISTRIBUTION=$(echo "${QUERY_STRING}" | grep -oE '(^|[?&])distribution=[a-z]+' | cut -f 2 -d '=' | head -n1) - LB_PACKAGE_LISTS=$(echo "${QUERY_STRING}" | grep -oE '(^|[?&])package_lists=[-0-9a-z]+' | cut -f 2 -d '=' | head -n1) - LB_TASKS=$(echo "${QUERY_STRING}" | grep -oE '(^|[?&])tasks=[-0-9a-zA-Z. _]+' | cut -f 2 -d '=' | head -n1) - - # Advanced bootstrap options - LB_ARCHITECTURES=$(echo "${QUERY_STRING}" | grep -oE '(^|[?&])architectures=[0-9a-z]+' | cut -f 2 -d '=' | head -n1) - LB_BOOTSTRAP_FLAVOUR=$(echo "${QUERY_STRING}" | grep -oE '(^|[?&])bootstrap_flavour=[a-z]+' | cut -f 2 -d '=' | head -n1) - LB_ARCHIVE_AREAS=$(echo "${QUERY_STRING}" | grep -oE '(^|[?&])archive_areas=[a-z]+' | cut -f 2 -d '=' | head -n1) - - # Advanced chroot options - LB_CHROOT_FILESYSTEM=$(echo "${QUERY_STRING}" | grep -oE '(^|[?&])chroot_filesystem=[0-9a-z]+' | cut -f 2 -d '=' | head -n1) - LB_LINUX_FLAVOURS=$(echo "${QUERY_STRING}" | grep -oE '(^|[?&])linux_flavours=[-0-9a-z]+' | cut -f 2 -d '=' | head -n1) - LB_SECURITY=$(echo "${QUERY_STRING}" | grep -oE '(^|[?&])security=[a-z]+' | cut -f 2 -d '=' | head -n1) - - # Advanced binary options - LB_BINARY_INDICES=$(echo "${QUERY_STRING}" | grep -oE '(^|[?&])binary_indices=[a-z]+' | cut -f 2 -d '=' | head -n1) - LB_BOOTAPPEND_INSTALL=$(echo "${QUERY_STRING}" | grep -oE '(^|[?&])bootappend_install=[-0-9a-zA-Z. _+=:/]+' | cut -f2- -d '=' | head -n1) - LB_BOOTAPPEND_LIVE=$(echo "${QUERY_STRING}" | grep -oE '(^|[?&])bootappend_live=[-0-9a-zA-Z. _+=:/]+' | cut -f2- -d '=' | head -n1) - LB_BOOTLOADER=$(echo "${QUERY_STRING}" | grep -oE '(^|[?&])bootloader=[a-z]+' | cut -f 2 -d '=' | head -n1) - LB_DEBIAN_INSTALLER=$(echo "${QUERY_STRING}" | grep -oE '(^|[?&])debian_installer=[a-z]+' | cut -f 2 -d '=' | head -n1) - LB_ISO_APPLICATION=$(echo "${QUERY_STRING}" | grep -oE '(^|[?&])iso_application=[-0-9a-zA-Z. ~;:/_]+' | cut -f 2 -d '=' | head -n1) - LB_ISO_PREPARER=$(echo "${QUERY_STRING}" | grep -oE '(^|[?&])iso_preparer=[-0-9a-zA-Z. ~;:/_]+' | cut -f 2 -d '=' | head -n1) - LB_ISO_PUBLISHER=$(echo "${QUERY_STRING}" | grep -oE '(^|[?&])iso_publisher=[-0-9a-zA-Z. ~;:/_@]+' | cut -f 2 -d '=' | head -n1) - LB_ISO_VOLUME=$(echo "${QUERY_STRING}" | grep -oE '(^|[?&])iso_volume=[-0-9a-zA-Z. ~;:/_]+' | cut -f 2 -d '=' | head -n1) - LB_MEMTEST=$(echo "${QUERY_STRING}" | grep -oE '(^|[?&])memtest=[0-9a-z+]+' | cut -f 2 -d '=' | head -n1) - LB_NET_ROOT_PATH=$(echo "${QUERY_STRING}" | grep -oE '(^|[?&])net_path=[-0-9a-zA-Z._/]+' | cut -f 2 -d '=' | head -n1) - LB_NET_ROOT_SERVER=$(echo "${QUERY_STRING}" | grep -oE '(^|[?&])net_server=[0-9.]+' | cut -f 2 -d '=' | head -n1) - - # Advanced source options - LB_SOURCE=$(echo "${QUERY_STRING}" | grep -oE '(^|[?&])source=[a-z]+' | cut -f 2 -d '=' | head -n1) - LB_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-9a-zA-Z.~:/_]+' | cut -f 2 -d '=' | head -n1) - _CUSTOM_BINARY=$(echo "${QUERY_STRING}" | grep -oE '(^|[?&])custom_binary=[-0-9a-zA-Z.~:/_]+' | cut -f 2 -d '=' | head -n1) - - # FIXME: filter invalid options - unset QUERY_STRING - - if [ -z "${_EMAIL}" ] - then - echo "

Error: No email address specified.

" - - sed -e "s/VERSION/${VERSION}/" \ - -e "s/DATE/`date +%Y%m%d-%H:%M`/" \ - "${_TEMPLATES}"/form.html - - exit - fi - - # Getting build identifier - _BUILD=$(date +%Y%m%d.%H%M%S.%N) - - # Getting number of builds pending. - _QUEUENUM=$(ls "${_TEMPDIR}"/*.build | wc -l) - - #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}/" \ - -e "s/QUEUENUM/${_QUEUENUM}/" \ - -e "s/LB_BINARY_IMAGES/${LB_BINARY_IMAGES}/" \ - -e "s/LB_DISTRIBUTION/${LB_DISTRIBUTION}/" \ - -e "s/LB_PACKAGE_LISTS/${LB_PACKAGE_LISTS}/" \ - -e "s/LB_TASKS/${LB_TASKS}/" \ - -e "s/_LB_CGIPACKAGES/${_LB_CGIPACKAGES}/" \ - -e "s/LB_ARCHITECTURES/${LB_ARCHITECTURES}/" \ - -e "s/LB_BOOTSTRAP_FLAVOUR/${LB_BOOTSTRAP_FLAVOUR}/" \ - -e "s/LB_ARCHIVE_AREAS/${LB_ARCHIVE_AREAS}/" \ - -e "s/LB_CHROOT_FILESYSTEM/${LB_CHROOT_FILESYSTEM}/" \ - -e "s/LB_LINUX_FLAVOURS/${LB_LINUX_FLAVOURS}/" \ - -e "s/LB_SECURITY/${LB_SECURITY}/" \ - -e "s/LB_BINARY_INDICES/${LB_BINARY_INDICES}/" \ - -e "s#LB_BOOTAPPEND_INSTALL#${LB_BOOTAPPEND_INSTALL}#" \ - -e "s#LB_BOOTAPPEND_LIVE#${LB_BOOTAPPEND_LIVE}#" \ - -e "s/LB_BOOTLOADER/${LB_BOOTLOADER}/" \ - -e "s/LB_DEBIAN_INSTALLER/${LB_DEBIAN_INSTALLER}/" \ - -e "s#LB_ISO_APPLICATION#${LB_ISO_APPLICATION}#" \ - -e "s#LB_ISO_PREPARER#${LB_ISO_PREPARER}#" \ - -e "s#LB_ISO_PUBLISHER#${LB_ISO_PUBLISHER}#" \ - -e "s#LB_ISO_VOLUME#${LB_ISO_VOLUME}#" \ - -e "s/LB_MEMTEST/${LB_MEMTEST}/" \ - -e "s#LB_NET_ROOT_PATH#${LB_NET_ROOT_PATH}#" \ - -e "s/LB_NET_ROOT_SERVER/${LB_NET_ROOT_SERVER}/" \ - -e "s#SERVER#${_SERVER}#g" \ - -e "s/LB_SOURCE_IMAGES/${LB_SOURCE_IMAGES}/" \ - -e "s/LB_SOURCE/${LB_SOURCE}/" \ - -e "s#CUSTOM_BOOTSTRAP#${_CUSTOM_BOOTSTRAP}#" \ - -e "s#CUSTOM_BINARY#${_CUSTOM_BINARY}#" \ - "${_TEMPLATES}"/build.html - - # Creating temporary directory - mkdir -p "${_TEMPDIR}" - -# Writing build file -cat > "${_TEMPDIR}"/"${_BUILD}".build << EOF -# live-build-cgi "${VERSION}" build file -# `date -R` - -_BUILD="${_BUILD}" -_EMAIL="${_EMAIL}" - -REMOTE_ADDR="${REMOTE_ADDR}" - -# CGI Packages List -_LB_CGIPACKAGES="${_LB_CGIPACKAGES}" - -# Standard options -LB_BINARY_IMAGES="${LB_BINARY_IMAGES}" -LB_DISTRIBUTION="${LB_DISTRIBUTION}" -LB_PACKAGE_LISTS="${LB_PACKAGE_LISTS}" -LB_TASKS="${LB_TASKS}" - -# Advanced bootstrap options -LB_ARCHITECTURES="${LB_ARCHITECTURES}" -LB_ARCHIVE_AREAS="${LB_ARCHIVE_AREAS}" - -# Advanced chroot options -LB_CHROOT_FILESYSTEM="${LB_CHROOT_FILESYSTEM}" -LB_LINUX_FLAVOURS="${LB_LINUX_FLAVOURS}" -LB_SECURITY="${LB_SECURITY}" - -# Advanced binary options -LB_BINARY_INDICES="${LB_BINARY_INDICES}" -LB_BOOTAPPEND_INSTALL="${LB_BOOTAPPEND_INSTALL}" -LB_BOOTAPPEND_LIVE="${LB_BOOTAPPEND_LIVE}" -LB_BOOTLOADER="${LB_BOOTLOADER}" -LB_DEBIAN_INSTALLER="${LB_DEBIAN_INSTALLER}" -LB_ISO_APPLICATION="${LB_ISO_APPLICATION}" -LB_ISO_PREPARER="${LB_ISO_PREPARER}" -LB_ISO_PUBLISHER="${LB_ISO_PUBLISHER}" -LB_ISO_VOLUME="${LB_ISO_VOLUME}" -LB_MEMTEST="${LB_MEMTEST}" -LB_NET_ROOT_PATH="${LB_NET_ROOT_PATH}" -LB_NET_ROOT_SERVER="${LB_NET_ROOT_SERVER}" - -# Advanced source options -LB_SOURCE_IMAGES="${LB_SOURCE_IMAGES}" -LB_SOURCE="${LB_SOURCE}" - -# Unofficial options -_CUSTOM_BOOTSTRAP="${_CUSTOM_BOOTSTRAP}" -_CUSTOM_BINARY="${_CUSTOM_BINARY}" - -# Other -LB_ARCHIVES="${LB_ARCHIVES}" -LB_PARENT_DISTRIBUTION="${LB_DISTRIBUTION}" -LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION="${LB_DISTRIBUTION}" -LB_BACKPORTS="false" -LB_MODE="debian" -EOF - - echo "$(date +%b\ %d\ %H:%M:%S) ${_HOSTNAME} live-build-cgi: add web build (${_BUILD}) from ${REMOTE_ADDR}." >> /var/log/live - echo "$(date +%b\ %d\ %H:%M:%S) ${_HOSTNAME} live-build-cgi: options ${_BUILD} |email ${_EMAIL}|binary_images ${LB_BINARY_IMAGES}|distribution ${LB_DISTRIBUTION}|package_lists ${LB_PACKAGE_LISTS}|tasks ${LB_TASKS}|cgipackages ${_LB_CGIPACKAGES}|architectures ${LB_ARCHITECTURES}|archive_areas ${LB_ARCHIVE_AREAS}|chroot_filesystem ${LB_CHROOT_FILESYSTEM}|linux_flavours ${LB_LINUX_FLAVOURS}|security ${LB_SECURITY}|binary_indices ${LB_BINARY_INDICES}|bootappend_install ${LB_BOOTAPPEND_INSTALL}|bootappend_live ${LB_BOOTAPPEND_LIVE}|bootloader ${LB_BOOTLOADER}|debian_installer ${LB_DEBIAN_INSTALLER}|iso_application ${LB_ISO_APPLICATION}|iso_preparer ${LB_ISO_PREPARER}|iso_publisher ${LB_ISO_PUBLISHER}|iso_volume ${LB_ISO_VOLUME}|memtest ${LB_MEMTEST}|net_path ${LB_NET_ROOT_PATH}|net_server ${LB_NET_ROOT_SERVER}|source_images ${LB_SOURCE_IMAGES}|sources ${LB_SOURCE}|custom_bootstrap ${_CUSTOM_BOOTSTRAP}|custom_binary ${_CUSTOM_BINARY}" >> /var/log/live -fi - -sed -e "s/VERSION/${VERSION}/" "${_TEMPLATES}"/footer.html diff --git a/cgi/live-build-cgi.cron b/cgi/live-build-cgi.cron deleted file mode 100755 index a81de39a0..000000000 --- a/cgi/live-build-cgi.cron +++ /dev/null @@ -1,204 +0,0 @@ -#!/bin/sh - -## live-build(7) - System Build Scripts -## Copyright (C) 2006-2012 Daniel Baumann -## -## live-build comes with ABSOLUTELY NO WARRANTY; for details see COPYING. -## This is free software, and you are welcome to redistribute it -## under certain conditions; see COPYING for details. - - -# Including common functions -. "${LB_BASE:-/usr/share/live/build}"/scripts/build.sh - -# Reading defaults -if [ -r /etc/default/live-build-cgi ] -then - . /etc/default/live-build-cgi -else - echo "E: /etc/default/live-build-cgi missing" - exit 1 -fi - -# Exit if disabled -if [ "${_WEBBUILD}" != "enabled" ] -then - exit 0 -fi - -_HOSTNAME="$(hostname -f)" - -# Turn on debug if enabled -if [ "${_DEBUG}" = "enabled" ] -then - set -x -fi - -# Checking lock file -if [ -f /var/lock/live-build-cgi.lock ] -then - echo "E: live-build-cgi already/still running." - exit 1 -fi - -# Creating lock trap -trap "test -f /var/lock/live-build-cgi.lock && rm -f /var/lock/live-build-cgi.lock; exit 0" 0 1 2 3 9 15 - -# Creating lock file -touch /var/lock/live-build-cgi.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 -then - rm -rf "${_DESTDIR}"/`date -d yesterday +%Y%m%d.%H`* - - echo "`date +%b\ %d\ %H:%M:%S` ${_HOSTNAME} live-build-cgi: remove web build (`date -d yesterday +%Y%m%d.%H`*)." >> /var/log/live -fi - -# Ok from here spin through the live-build-cgi files we have waiting to build -#if ls "${_TEMPDIR}"/*.build > /dev/null 2>&1 -if Find_files ${_TEMPDIR}/*.build -then - 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}` - # Pull in the email address - _EMAIL=`awk -F\" '/^_EMAIL=/{print $2}' ${_FILE}` - # Pull in cgipackages for config/package-lists/cgipackages.list.chroot - _LB_CGIPACKAGES=`awk -F\" '/^_LB_CGIPACKAGES=/{print $2}' ${_FILE}` - # Pull in the remote address, atchitecture, distribution, and package-lists. - _REMOTE_ADDR=`awk -F\" '/^REMOTE_ADDR=/{print $2}' ${_FILE}` - _LB_ARCHITECTURES=`awk -F\" '/^LB_ARCHITECTURES=/{print $2}' ${_FILE}` - _LB_DISTRIBUTION=`awk -F\" '/^LB_DISTRIBUTION=/{print $2}' ${_FILE}` - _LB_PACKAGE_LISTS=`awk -F\" '/^LB_PACKAGE_LISTS=/{print $2}' ${_FILE}`i - # Pull in the custom bootstrap - _CUSTOM_BOOTSTRAP=`awk -F\" '/^_CUSTOM_BOOTSTRAP=/{print $2}' ${_FILE}` - # Pull in the custom binary - _CUSTOM_BINARY=`awk -F\" '/^_CUSTOM_BINARY=/{print $2}' ${_FILE}` - - # Drop out some build data for information if something goes wrong. - echo "`date +%b\ %d\ %H:%M:%S` ${_HOSTNAME} live-build-cgi: begin web build (${_BUILD})." >> /var/log/live - - # Creating build directory and the config/package-lists - mkdir -p "${_TEMPDIR}"/"${_BUILD}"/config/package-lists - - # The next two tests are for unofficial third party archives - if [ -n "${_LB_CGIPACKAGES}" ] - then - echo "${_LB_CGIPACKAGES}" > "${_TEMPDIR}"/"${_BUILD}"/config/package-lists/cgipackages.list.chroot - fi - - # Creating the config/chroot_sources folder - mkdir -p "${_TEMPDIR}"/"${_BUILD}"/config/chroot_sources - - # The next two tests are for unofficial third party archives - if [ -n "${_CUSTOM_BOOTSTRAP}" ] - then - echo "${_CUSTOM_BOOTSTRAP}" > "${_TEMPDIR}"/"${_BUILD}"/config/chroot_sources/custom.bootstrap - fi - - if [ -n "${_CUSTOM_BINARY}" ] - then - echo "${_CUSTOM_BINARY}" > "${_TEMPDIR}"/"${_BUILD}"/config/chroot_sources/custom.binary - fi - - _DATE_START="`date -R`" - echo "Begin: ${_DATE_START}" > "${_TEMPDIR}"/"${_BUILD}"/log - - # Generating image - cd "${_TEMPDIR}"/"${_BUILD}" - lb config -c ${_FILE} >> "${_TEMPDIR}"/"${_BUILD}"/log 2>&1 - _ERRORCONFIG="${?}" - lb build >> "${_TEMPDIR}"/"${_BUILD}"/log 2>&1 - _ERRORBUILD="${?}" - - _DATE_END="`date -R`" - echo "End: ${_DATE_END}" >> "${_TEMPDIR}"/"${_BUILD}"/log - - # Creating image directory - mkdir -p "${_DESTDIR}"/"${_BUILD}" - - # Creating mail and logging. - if [ "${_ERRORCONFIG}" -eq "0" ] && [ "${_ERRORBUILD}" -eq "0" ] - then - _STATUS="maybe-successful" - echo "${_REMOTE_ADDR} - - `date +[%d/%b/%Y:%H:%m:%S\ %z]` \"${_BUILD} ${_LB_ARCHITECTURES}/${_LB_DISTRIBUTION}/${_LB_PACKAGE_LISTS}/${_LB_CGIPACKAGES}\" 200 - \"-\" \"\"">>/var/log/live-cgi.builds - else - _STATUS="maybe-failed" - echo "${_REMOTE_ADDR} - - `date +[%d/%b/%Y:%H:%m:%S\ %z]` \"${_BUILD} ${_LB_ARCHITECTURES}/${_LB_DISTRIBUTION}/${_LB_PACKAGE_LISTS}/${_LB_CGIPACKAGES}\" 404 - \"-\" \"\"">>/var/log/live-cgi.builds - fi - - 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 - -cat >> "${_DESTDIR}"/"${_BUILD}"/mail << EOF - ---- - -Here's a list of all build-options that were used to build your image: - -EOF - - cat "${_TEMPDIR}"/"${_BUILD}".build >> "${_DESTDIR}"/"${_BUILD}"/mail - - # Moving binary image - #if ls "${_TEMPDIR}"/"${_BUILD}"/binary*.* > /dev/null 2>&1 - if Find_files ${_TEMPDIR}/${_BUILD}/binary*.* - then - mv "${_TEMPDIR}"/"${_BUILD}"/binary*.* "${_DESTDIR}"/"${_BUILD}" - fi - - # Moving source image - #if ls "${_TEMPDIR}"/"${_BUILD}"/source.* > /dev/null 2>&1 - if Find_files ${_TEMPDIR}/${_BUILD}/source.* - then - mv "${_TEMPDIR}"/"${_BUILD}"/source.* "${_DESTDIR}"/"${_BUILD}" - fi - - # Moving build - mv "${_TEMPDIR}"/"${_BUILD}".build "${_DESTDIR}"/"${_BUILD}"/build - - # Moving log - mv "${_TEMPDIR}"/"${_BUILD}"/log "${_DESTDIR}"/"${_BUILD}" - - # Generating md5sum - cd "${_DESTDIR}"/"${_BUILD}" - md5sum * > md5sum - cd "${OLDPWD}" - - # Sending mail - cat "${_DESTDIR}"/"${_BUILD}"/mail | /usr/sbin/sendmail -t - - # Unmounting devpts-live - #if ls "${_TEMPDIR}"/"${_BUILD}"/chroot/dev/pts/* > /dev/null 2>&1 - if Find_files ${_TEMPDIR}/${_BUILD}/chroot/dev/pts/* - then - umount "${_TEMPDIR}"/${_BUILD}/chroot/dev/pts - fi - - # Unmounting proc - if [ -f "${_TEMPDIR}"/"${_BUILD}"/chroot/proc/version ] - then - umount "${_TEMPDIR}"/"${_BUILD}"/chroot/proc - fi - - # Unmounting sysfs - if [ -d "${_TEMPDIR}"/"${_BUILD}"/chroot/sys/kernel ] - then - umount "${_TEMPDIR}"/${_BUILD}/chroot/sys - fi - - # Removing build directory - rm -rf "${_TEMPDIR}"/"${_BUILD}" - - echo "`date +%b\ %d\ %H:%M:%S` ${_HOSTNAME} live-build-cgi: end web build (${_BUILD}: ${_STATUS})." >> /var/log/live - done -fi diff --git a/cgi/live-build-cgi.crontab b/cgi/live-build-cgi.crontab deleted file mode 100644 index 1bf7a815d..000000000 --- a/cgi/live-build-cgi.crontab +++ /dev/null @@ -1,7 +0,0 @@ -# /etc/crontab - system-wide crontab - -SHELL=/bin/sh -PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin - -# m h dom mon dow user command -*/1 * * * * root /etc/cron.hourly/live-build-cgi > /dev/null 2>&1 diff --git a/cgi/live-build-cgi.default b/cgi/live-build-cgi.default deleted file mode 100644 index 73daa586c..000000000 --- a/cgi/live-build-cgi.default +++ /dev/null @@ -1,13 +0,0 @@ -# Defaults for /etc/cron.daily/live-build-cgi - -_WEBBUILD="disabled" - -_MODE="debian-official" - -_DEBUG="disabled" - -_DESTDIR="/srv/debian-live/build/www" -_TEMPLATES="/usr/share/live/build/templates/cgi/${_MODE}" -_TEMPDIR="/srv/debian-live/build/tmp" - -_SERVER="http://live.debian.net/build" diff --git a/cgi/live-build-cgi.logrotate b/cgi/live-build-cgi.logrotate deleted file mode 100644 index 75d89a9eb..000000000 --- a/cgi/live-build-cgi.logrotate +++ /dev/null @@ -1,11 +0,0 @@ -# /etc/logrotate.d/live-build - -/var/log/live -{ - compress - copytruncate - missingok - monthly - notifempty - rotate 24 -} diff --git a/cron/TODO b/cron/TODO deleted file mode 100644 index d3a90d3ac..000000000 --- a/cron/TODO +++ /dev/null @@ -1,10 +0,0 @@ -General: - * add headers to log with build date and versions. - * send summary mails to debian-live@l.d.o. - * do not hardcode git urls. - * add support for git branches. - * add live-build-cron-packages. - - * logrotate for images trimming - * branch specific git version per release - * re-use existing git repository for local lb clone diff --git a/cron/live-build-cron-images b/cron/live-build-cron-images deleted file mode 100755 index 48c8d3115..000000000 --- a/cron/live-build-cron-images +++ /dev/null @@ -1,343 +0,0 @@ -#!/bin/sh - -## live-build(7) - System Build Scripts -## Copyright (C) 2006-2012 Daniel Baumann -## -## live-build comes with ABSOLUTELY NO WARRANTY; for details see COPYING. -## This is free software, and you are welcome to redistribute it -## under certain conditions; see COPYING for details. - - -#set -e - -Init () -{ - if [ -e /etc/live/build-cron.conf ] - then - . /etc/live/build-cron.conf - fi - - if ls /etc/live/build-cron.d/* > /dev/null 2>&1 - then - for _FILE in /etc/live/build-cron.d/* - do - . ${_FILE} - done - fi - - if [ "${LIVE_BUILD_CRON_IMAGES}" != "true" ] - then - exit 0 - fi - - mkdir -p "${LIVE_BUILD_CRON_IMAGES_DIRECTORY}" - - if [ ! -d "${LIVE_BUILD_CRON_IMAGES_DIRECTORY}" ] - then - echo "E: live-build-cron-images directory not set." - exit 1 - fi - - # FIXME: don't hardcode - BUILDS="daily" - DATE="$(date +%Y%m%d)" - - ARCHITECTURE="$(dpkg --print-architecture)" - eval DISTRIBUTIONS="$`echo LIVE_BUILD_CRON_IMAGES_$(echo ${BUILDS} | tr [a-z] [A-Z])_DISTRIBUTIONS`" - eval FLAVOURS="$`echo LIVE_BUILD_CRON_IMAGES_$(echo ${BUILDS} | tr [a-z] [A-Z])_FLAVOURS`" -} - -Setup () -{ - _TMPDIR="$(mktemp -d -t live-build-cron-images.XXXXXXXX)" - - case "${LIVE_BUILD_CRON_IMAGES_BUILD}" in - git) - cd "${_TMPDIR}" - git clone git://live.debian.net/git/live-build.git - git checkout debian-old-2.0 - - LB_BASE="${_TMPDIR}/live-build" - export LB_BASE - - PATH="${PATH}:${_TMPDIR}/live-build/scripts/build" - export PATH - ;; - - release) - # live-build - if [ -n "${LIVE_BUILD}" ] - then - if [ -x "$(which dget 2>/dev/null)" ] - then - dget "http://live.debian.net/archive/packages/live-build/${LIVE_BUILD}/live-build_${LIVE_BUILD}.dsc" - dpkg-source -x live-build_${LIVE_BUILD}.dsc - - LB_BASE="${_TMPDIR}/live-build-$(echo ${LIVE_BUILD} | awk -F- '{ print $1 }')" - export LB_BASE - - PATH="${PATH}:${_TMPDIR}/live-build-$(echo ${LIVE_BUILD} | awk -F- '{ print $1 }')/scripts/build" - export PATH - else - echo "E: dget - command not found" - echo "I: dget can be optained from: " - echo "I: http://git.debian.org/?p=devscripts/devscripts.git" - echo "I: On Debian based systems, dget can be installed with:" - echo "I: apt-get install devscripts" - - exit 1 - fi - fi - ;; - esac - - mkdir -p "${_TMPDIR}/build" - cd "${_TMPDIR}/build" - - # live-boot - if [ -n "${LIVE_BOOT}" ] - then - mkdir -p config/chroot_local-packages - cd config/chroot_local-packages - - wget -c "http://live.debian.net/archive/packages/live-boot/${LIVE_BOOT}/live-boot_${LIVE_BOOT}.dsc" - wget -c "http://live.debian.net/archive/packages/live-boot/${LIVE_BOOT}/live-boot_${LIVE_BOOT}.diff.gz" - wget -c "http://live.debian.net/archive/packages/live-boot/${LIVE_BOOT}/live-boot_$(echo ${LIVE_BOOT} | awk -F- '{ print $1 }').orig.tar.gz" - wget -c "http://live.debian.net/archive/packages/live-boot/${LIVE_BOOT}/live-boot_${LIVE_BOOT}_all.deb" - wget -c "http://live.debian.net/archive/packages/live-boot/${LIVE_BOOT}/live-boot-initramfs-tools_${LIVE_BOOT}_all.deb" - wget -c "http://live.debian.net/archive/packages/live-boot/${LIVE_BOOT}/live-initramfs_${LIVE_BOOT}_all.deb" - - cd "${OLDPWD}" - fi - - # live-config - if [ -n "${LIVE_CONFIG}" ] - then - mkdir -p config/chroot_local-packages - cd config/chroot_local-packages - - wget -c "http://live.debian.net/archive/packages/live-config/${LIVE_CONFIG}/live-config_${LIVE_CONFIG}.dsc" - wget -c "http://live.debian.net/archive/packages/live-config/${LIVE_CONFIG}/live-config_${LIVE_CONFIG}.diff.gz" - wget -c "http://live.debian.net/archive/packages/live-config/${LIVE_CONFIG}/live-config_$(echo ${LIVE_CONFIG} | awk -F- '{ print $1 }').orig.tar.gz" - wget -c "http://live.debian.net/archive/packages/live-config/${LIVE_CONFIG}/live-config_${LIVE_CONFIG}_all.deb" - wget -c "http://live.debian.net/archive/packages/live-config/${LIVE_CONFIG}/live-config-sysvinit_${LIVE_CONFIG}_all.deb" - - cd "${OLDPWD}" - fi - - # live-installer - if [ -n "${LIVE_INSTALLER}" ] - then - mkdir -p config/binary_local-udebs - cd config/binary_local-udebs - - wget -c "http://ftp.debian.org/debian/pool/main/l/live-installer/live-installer_${LIVE_INSTALLER}.dsc" - wget -c "http://ftp.debian.org/debian/pool/main/l/live-installer/live-installer_${LIVE_INSTALLER}.tar.gz" - wget -c "http://ftp.debian.org/debian/pool/main/l/live-installer/live-installer_${LIVE_INSTALLER}_${ARCHITECTURE}.udeb" - - cd "${OLDPWD}" - fi - - # debian-installer-launcher - if [ -n "${DI_LAUNCHER}" ] - then - mkdir -p config/chroot_local-packages - cd config/chroot_local-packages - - wget -c "http://ftp.debian.org/debian/pool/main/d/debian-installer-launcher/debian-installer-launcher_${DI_LAUNCHER}.dsc" - wget -c "http://ftp.debian.org/debian/pool/main/d/debian-installer-launcher/debian-installer-launcher_${DI_LAUNCHER}.tar.gz" - wget -c "http://ftp.debian.org/debian/pool/main/d/debian-installer-launcher/debian-installer-launcher_${DI_LAUNCHER}_all.deb" - - cd "${OLDPWD}" - fi -} - -Build () -{ - cd "${_TMPDIR}/build" - - for DISTRIBUTION in ${DISTRIBUTIONS} - do - rm -rf cache/stages* - - for FLAVOUR in ${FLAVOURS} - do - if [ -e .build ] - then - lb clean - fi - - rm -rf cache/stages_rootfs - rm -f config/* || true - - LB_VERSION="$(lb --version | awk '/^live-build, version / { print $3 }')" - - case "${LB_VERSION}" in - 2.0*) - _PACKAGE_LISTS="--package-lists ${FLAVOUR}" - ;; - - 3.0*) - _PACKAGE_LISTS="--package-lists ${FLAVOUR}" - ;; - esac - - # FIXME: cdebootstrap - lb config --clean \ - --bootstrap cdebootstrap \ - --cache-stages "bootstrap rootfs" \ - --debian-installer ${DEBIAN_INSTALLER} \ - --distribution ${DISTRIBUTION} \ - --mirror-bootstrap ${MIRROR_BOOTSTRAP} \ - --mirror-chroot ${MIRROR_CHROOT} \ - --mirror-chroot-security ${MIRROR_CHROOT_SECURITY} \ - ${_PACKAGE_LISTS} - - lb build 2>&1 | tee debian-live-${DISTRIBUTION}-${ARCHITECTURE}-${FLAVOUR}.iso.log - - mv binary*.iso debian-live-${DISTRIBUTION}-${ARCHITECTURE}-${FLAVOUR}.iso - mv binary.list debian-live-${DISTRIBUTION}-${ARCHITECTURE}-${FLAVOUR}.iso.list - mv binary.packages debian-live-${DISTRIBUTION}-${ARCHITECTURE}-${FLAVOUR}.iso.packages - - if [ "${ARCHITECTURE}" != "powerpc" ] - then - lb clean --binary - lb config --clean --binary-images usb-hdd - lb binary 2>&1 | tee debian-live-${DISTRIBUTION}-${ARCHITECTURE}-${FLAVOUR}.img.log - - mv binary.img debian-live-${DISTRIBUTION}-${ARCHITECTURE}-${FLAVOUR}.img - mv binary.list debian-live-${DISTRIBUTION}-${ARCHITECTURE}-${FLAVOUR}.img.list - mv binary.packages debian-live-${DISTRIBUTION}-${ARCHITECTURE}-${FLAVOUR}.img.packages - fi - - if [ "${ARCHITECTURE}" != "powerpc" ] - then - lb clean - rm -rf cache/stages_rootfs - lb config --clean --binary-images net - - lb build 2>&1 | tee debian-live-${DISTRIBUTION}-${ARCHITECTURE}-${FLAVOUR}.tar.gz.log - - mv binary-net.tar.gz debian-live-${DISTRIBUTION}-${ARCHITECTURE}-${FLAVOUR}.tar.gz - mv binary.list debian-live-${DISTRIBUTION}-${ARCHITECTURE}-${FLAVOUR}.tar.gz.list - mv binary.packages debian-live-${DISTRIBUTION}-${ARCHITECTURE}-${FLAVOUR}.tar.gz.packages - - mv binary/*/filesystem.squashfs debian-live-${DISTRIBUTION}-${ARCHITECTURE}-${FLAVOUR}.squashfs - for memtest in tftpboot/debian-live/${ARCHITECTURE}/memtest*; do cp -f ${memtest} debian-live-${DISTRIBUTION}-${ARCHITECTURE}.$(basename ${memtest}); done || true - for kernel in tftpboot/debian-live/${ARCHITECTURE}/vmlinuz*; do cp -f ${kernel} debian-live-${DISTRIBUTION}-${ARCHITECTURE}.$(basename ${kernel}); done - for initrd in tftpboot/debian-live/${ARCHITECTURE}/initrd*; do cp ${initrd} debian-live-${DISTRIBUTION}-${ARCHITECTURE}-${FLAVOUR}.$(basename ${initrd}); done - cp debian-live-${DISTRIBUTION}-${ARCHITECTURE}-${FLAVOUR}.tar.gz.packages debian-live-${DISTRIBUTION}-${ARCHITECTURE}-${FLAVOUR}.packages - fi - - if [ "${LIVE_BUILD_CRON_IMAGES_SOURCE}" = "true" ] - then - lb config --clean --source true - - lb source 2>&1 | tee debian-live-${DISTRIBUTION}-source-${FLAVOUR}.log - - mv source.debian.tar.gz debian-live-${DISTRIBUTION}-source-${FLAVOUR}.debian.tar.gz - mv source.debian.list debian-live-${DISTRIBUTION}-source-${FLAVOUR}.debian.tar.gz.list - mv source.debian-live.tar.gz debian-live-${DISTRIBUTION}-source-${FLAVOUR}.debian-live.tar.gz - mv source.debian-live.list debian-live-${DISTRIBUTION}-source-${FLAVOUR}.debian-live.tar.gz.list - fi - done - done -} - -Install () -{ - BUILD="1" - - while [ -e "${LIVE_BUILD_CRON_IMAGES_DIRECTORY}/${BUILDS}-builds/${DISTRIBUTION}/${DATE}-${BUILD}/${ARCHITECTURE}" ] - do - BUILD="$((${BUILD} + 1))" - done - - cd "${_TMPDIR}/build" - - # Move iso images - if ls debian-live-${DISTRIBUTION}-${ARCHITECTURE}-*.iso* > /dev/null 2>&1 - then - mkdir -p "${LIVE_BUILD_CRON_IMAGES_DIRECTORY}/${BUILDS}-builds/${DISTRIBUTION}/${DATE}-${BUILD}/${ARCHITECTURE}/iso-hybrid" - mv debian-live-${DISTRIBUTION}-${ARCHITECTURE}-*.iso* "${LIVE_BUILD_CRON_IMAGES_DIRECTORY}/${BUILDS}-builds/${DISTRIBUTION}/${DATE}-${BUILD}/${ARCHITECTURE}/iso-hybrid" - fi - - # Move hdd images - if ls debian-live-${DISTRIBUTION}-${ARCHITECTURE}-*.img > /dev/null 2>&1 - then - mkdir -p "${LIVE_BUILD_CRON_IMAGES_DIRECTORY}/${BUILDS}-builds/${DISTRIBUTION}/${DATE}-${BUILD}/${ARCHITECTURE}/usb-hdd" - mv debian-live-${DISTRIBUTION}-${ARCHITECTURE}-*.img* "${LIVE_BUILD_CRON_IMAGES_DIRECTORY}/${BUILDS}-builds/${DISTRIBUTION}/${DATE}-${BUILD}/${ARCHITECTURE}/usb-hdd" - fi - - # Move net images - if ls debian-live-${DISTRIBUTION}-${ARCHITECTURE}-*.tar.gz* > /dev/null 2>&1 - then - mkdir -p "${LIVE_BUILD_CRON_IMAGES_DIRECTORY}/${BUILDS}-builds/${DISTRIBUTION}/${DATE}-${BUILD}/${ARCHITECTURE}/net" - mv debian-live-${DISTRIBUTION}-${ARCHITECTURE}-*.tar.gz* "${LIVE_BUILD_CRON_IMAGES_DIRECTORY}/${BUILDS}-builds/${DISTRIBUTION}/${DATE}-${BUILD}/${ARCHITECTURE}/net" - fi - - # Move web images - if ls debian-live-${DISTRIBUTION}-${ARCHITECTURE}-*.squashfs > /dev/null 2>&1 - then - mkdir -p "${LIVE_BUILD_CRON_IMAGES_DIRECTORY}/${BUILDS}-builds/${DISTRIBUTION}/${DATE}-${BUILD}/${ARCHITECTURE}/web" - mv debian-live-${DISTRIBUTION}-${ARCHITECTURE}-*.squashfs "${LIVE_BUILD_CRON_IMAGES_DIRECTORY}/${BUILDS}-builds/${DISTRIBUTION}/${DATE}-${BUILD}/${ARCHITECTURE}/web" - mv debian-live-${DISTRIBUTION}-${ARCHITECTURE}-*.packages* "${LIVE_BUILD_CRON_IMAGES_DIRECTORY}/${BUILDS}-builds/${DISTRIBUTION}/${DATE}-${BUILD}/${ARCHITECTURE}/web" - mv debian-live-${DISTRIBUTION}-${ARCHITECTURE}-*.vmlinuz* "${LIVE_BUILD_CRON_IMAGES_DIRECTORY}/${BUILDS}-builds/${DISTRIBUTION}/${DATE}-${BUILD}/${ARCHITECTURE}/web" - mv debian-live-${DISTRIBUTION}-${ARCHITECTURE}-*.initrd.img* "${LIVE_BUILD_CRON_IMAGES_DIRECTORY}/${BUILDS}-builds/${DISTRIBUTION}/${DATE}-${BUILD}/${ARCHITECTURE}/web" - fi - - # Move source images - if ls debian-live-${DISTRIBUTION}-source-* > /dev/null 2>&1 && \ - [ ! -d "${LIVE_BUILD_CRON_IMAGES_DIRECTORY}/${BUILDS}-builds/${DISTRIBUTION}/${DATE}-${BUILD}/source" ] - then - mkdir -p "${LIVE_BUILD_CRON_IMAGES_DIRECTORY}/${BUILDS}-builds/${DISTRIBUTION}/${DATE}-${BUILD}/source/tar" - mv debian-live-${DISTRIBUTION}-source-* "${LIVE_BUILD_CRON_IMAGES_DIRECTORY}/${BUILDS}-builds/${DISTRIBUTION}/${DATE}-${BUILD}/source/tar" - fi - - for DIR in "${LIVE_BUILD_CRON_IMAGES_DIRECTORY}/${BUILDS}-builds/${DISTRIBUTION}/${DATE}-${BUILD}/${ARCHITECTURE}"/* "${LIVE_BUILD_CRON_IMAGES_DIRECTORY}/${BUILDS}-builds/${DISTRIBUTION}/${DATE}-${BUILD}/source"/* - do - cd "${DIR}" - - md5sum debian* > MD5SUMS - sha1sum debian* > SHA1SUMS - sha256sum debian* > SHA256SUMS - done - - rm -f "${LIVE_BUILD_CRON_IMAGES_DIRECTORY}/${BUILDS}-builds/${DISTRIBUTION}/current" - - cd "${LIVE_BUILD_CRON_IMAGES_DIRECTORY}/${BUILDS}-builds/${DISTRIBUTION}" - ln -s ${DATE}-${BUILD} current -} - -Clean () -{ - cd "${_TMPDIR}/build" - lb clean --purge - - cd "${CURDIR}" - rm -rf "${_TMPDIR}" -} - -Trace () -{ - -cat > "${LIVE_BUILD_CRON_IMAGES_DIRECTORY}/${BUILDS}-builds/${BUILDS}-trace" << EOF -${DATE}-${BUILD} -$(LC_ALL=C date -R) -EOF - -} - -Main () -{ - Init - Setup - - Build - Install - Clean - - Trace -} - -Main diff --git a/cron/live-build-cron-manual b/cron/live-build-cron-manual deleted file mode 100755 index 6d539ced8..000000000 --- a/cron/live-build-cron-manual +++ /dev/null @@ -1,99 +0,0 @@ -#!/bin/sh - -## live-build(7) - System Build Scripts -## Copyright (C) 2006-2012 Daniel Baumann -## -## live-build comes with ABSOLUTELY NO WARRANTY; for details see COPYING. -## This is free software, and you are welcome to redistribute it -## under certain conditions; see COPYING for details. - - -#set -e - -Init () -{ - if [ -e /etc/live/build-cron.conf ] - then - . /etc/live/build-cron.conf - fi - - if ls /etc/live/build-cron.d/* > /dev/null 2>&1 - then - for _FILE in /etc/live/build-cron.d/* - do - . "${_FILE}" - done - fi - - if [ "${LIVE_BUILD_CRON_MANUAL}" != "true" ] - then - echo "I: live-build-cron-manual disabled." - exit 0 - fi - - mkdir -p "${LIVE_BUILD_CRON_MANUAL_DIRECTORY}" - - if [ ! -d "${LIVE_BUILD_CRON_MANUAL_DIRECTORY}" ] - then - echo "E: live-build-cron-manual directory not set." - exit 1 - fi -} - -Setup () -{ - _TMPDIR="$(mktemp -d -t live-build-cron-manual.XXXXXXXX)" - - cd "${_TMPDIR}" - git clone git://live.debian.net/git/live-manual.git - - cd live-manual && git checkout debian-next -} - -Build () -{ - cd "${_TMPDIR}/live-manual" - - echo "live-build-cron-manual: $(LC_ALL=C date -R) on ${_HOSTNAME}" | tee build.log - echo "Using the following sisu package versions: " | tee -a build.log - - for _PACKAGE in $(dpkg --get-selections | awk '/^sisu/ { print $1 }') - do - echo ${_PACKAGE} $(apt-cache policy $package | awk '/Installed: / { print $2 }') | tee -a build.log - done - - make DEBUG=1 autobuild 2>&1 | tee -a build.log -} - -Install () -{ - cd "${LIVE_BUILD_CRON_MANUAL_DIRECTORY}" - rm -rf * - - mv "${_TMPDIR}/live-manual/build/"* ./ - mv "${_TMPDIR}/live-manual/build.log" ./ -} - -Clean () -{ - rm -rf "${_TMPDIR}" -} - -Trace () -{ - echo "$(LC_ALL=C date -R)" > "${LIVE_BUILD_CRON_MANUAL_DIRECTORY}/manual-trace" -} - -Main () -{ - Init - Setup - - Build - Install - Clean - - Trace -} - -Main diff --git a/frontends/cgi/Makefile b/frontends/cgi/Makefile new file mode 100644 index 000000000..8ac08ddac --- /dev/null +++ b/frontends/cgi/Makefile @@ -0,0 +1,21 @@ +# Makefile + +install: + install -D -m 0755 live-build-cgi $(DESTDIR)/usr/lib/cgi-bin/live-build + install -D -m 0755 live-build-cgi.cron $(DESTDIR)/etc/cron.hourly/live-build-cgi + install -D -m 0644 live-build-cgi.crontab $(DESTDIR)/etc/cron.d/live-build-cgi + install -D -m 0644 live-build-cgi.default $(DESTDIR)/etc/default/live-build-cgi + install -D -m 0644 live-build-cgi.logrotate $(DESTDIR)/etc/logrotate.d/live-build-cgi + + install -d -m 0755 $(DESTDIR)/var/log + touch $(DESTDIR)/var/log/live + chown www-data:www-data $(DESTDIR)/var/log/live + +uninstall: + rm -f $(DESTDIR)/usr/lib/cgi-bin/live-build + rm -f $(DESTDIR)/etc/cron.d/live-build-cgi + rm -f $(DESTDIR)/etc/cron.hourly/live-build-cgi + rm -f $(DESTDIR)/etc/default/live-build-cgi + rm -f $(DESTDIR)/etc/logrotate.d/live-build-cgi + +reinstall: uninstall install diff --git a/frontends/cgi/live-build-cgi b/frontends/cgi/live-build-cgi new file mode 100755 index 000000000..356918fcf --- /dev/null +++ b/frontends/cgi/live-build-cgi @@ -0,0 +1,225 @@ +#!/bin/sh + +## live-build(7) - System Build Scripts +## Copyright (C) 2006-2012 Daniel Baumann +## +## live-build comes with ABSOLUTELY NO WARRANTY; for details see COPYING. +## This is free software, and you are welcome to redistribute it +## under certain conditions; see COPYING for details. + + +# Including common functions +. "${LB_BASE:-/usr/share/live/build}"/scripts/build.sh + +# Reading defaults +if [ -r /etc/default/live-build-cgi ] +then + . /etc/default/live-build-cgi +else + echo "E: /etc/default/live-build-cgi missing" + exit 1 +fi + +_HOSTNAME="$(hostname -f)" + +# Turn on debug if enabled +if [ "${_DEBUG}" = "enabled" ] +then + set -x +fi + +# Sending http header +echo "Content-type: text/html" +echo + +# Sending html header +cat "${_TEMPLATES}"/header.html + +# CGI +if [ -z "${QUERY_STRING}" ] +then + # Sending html form + sed -e "s/VERSION/${VERSION}/" \ + -e "s/DATE/`date +%Y%m%d-%H:%M`/" \ + "${_TEMPLATES}"/form.html +else + # Converting spaces: sed 's/+/ /g' + # Converting '@': sed 's/%40/@/g' + # Converting ':': sed 's/%3A/:/g' + # Converting ';': sed 's/%3B/\;/g' + # Converting '/': sed 's/%2F/\//g' + # Converting '~': sed 's/%7E/\~/g' + # Converting '=': sed 's/%3D/=/g' + # Converting '+': sed 's/%2B/+/g' + + # Translate parameters + QUERY_STRING=$(echo "${QUERY_STRING}" | sed -e 's/%2F/\//g' -e 's/+/ /g' -e 's/%3B/;/g' -e 's/%7E/~/g' -e 's/%3A/:/g' -e 's/%40/@/g' -e 's/%3D/=/g' -e 's/%2B/+/g') + # Debug the filtering string + # echo ${QUERY_STRING} + + # Email + _EMAIL=$(echo "${QUERY_STRING}" | grep -oE '(^|[?&])email=[-0-9a-zA-Z._@]+' | cut -f 2 -d '=' | head -n1) + + # CGI Packages List + _LB_CGIPACKAGES=$(echo "${QUERY_STRING}" | grep -oE '(^|[?&])cgipackages=[-0-9a-zA-Z. _+]+' | cut -f 2 -d '=' | head -n1) + + # Standard options + LB_BINARY_IMAGES=$(echo "${QUERY_STRING}" | grep -oE '(^|[?&])binary_images=[-a-z]+' | cut -f 2 -d '=' | head -n1) + LB_DISTRIBUTION=$(echo "${QUERY_STRING}" | grep -oE '(^|[?&])distribution=[a-z]+' | cut -f 2 -d '=' | head -n1) + LB_PACKAGE_LISTS=$(echo "${QUERY_STRING}" | grep -oE '(^|[?&])package_lists=[-0-9a-z]+' | cut -f 2 -d '=' | head -n1) + LB_TASKS=$(echo "${QUERY_STRING}" | grep -oE '(^|[?&])tasks=[-0-9a-zA-Z. _]+' | cut -f 2 -d '=' | head -n1) + + # Advanced bootstrap options + LB_ARCHITECTURES=$(echo "${QUERY_STRING}" | grep -oE '(^|[?&])architectures=[0-9a-z]+' | cut -f 2 -d '=' | head -n1) + LB_BOOTSTRAP_FLAVOUR=$(echo "${QUERY_STRING}" | grep -oE '(^|[?&])bootstrap_flavour=[a-z]+' | cut -f 2 -d '=' | head -n1) + LB_ARCHIVE_AREAS=$(echo "${QUERY_STRING}" | grep -oE '(^|[?&])archive_areas=[a-z]+' | cut -f 2 -d '=' | head -n1) + + # Advanced chroot options + LB_CHROOT_FILESYSTEM=$(echo "${QUERY_STRING}" | grep -oE '(^|[?&])chroot_filesystem=[0-9a-z]+' | cut -f 2 -d '=' | head -n1) + LB_LINUX_FLAVOURS=$(echo "${QUERY_STRING}" | grep -oE '(^|[?&])linux_flavours=[-0-9a-z]+' | cut -f 2 -d '=' | head -n1) + LB_SECURITY=$(echo "${QUERY_STRING}" | grep -oE '(^|[?&])security=[a-z]+' | cut -f 2 -d '=' | head -n1) + + # Advanced binary options + LB_BINARY_INDICES=$(echo "${QUERY_STRING}" | grep -oE '(^|[?&])binary_indices=[a-z]+' | cut -f 2 -d '=' | head -n1) + LB_BOOTAPPEND_INSTALL=$(echo "${QUERY_STRING}" | grep -oE '(^|[?&])bootappend_install=[-0-9a-zA-Z. _+=:/]+' | cut -f2- -d '=' | head -n1) + LB_BOOTAPPEND_LIVE=$(echo "${QUERY_STRING}" | grep -oE '(^|[?&])bootappend_live=[-0-9a-zA-Z. _+=:/]+' | cut -f2- -d '=' | head -n1) + LB_BOOTLOADER=$(echo "${QUERY_STRING}" | grep -oE '(^|[?&])bootloader=[a-z]+' | cut -f 2 -d '=' | head -n1) + LB_DEBIAN_INSTALLER=$(echo "${QUERY_STRING}" | grep -oE '(^|[?&])debian_installer=[a-z]+' | cut -f 2 -d '=' | head -n1) + LB_ISO_APPLICATION=$(echo "${QUERY_STRING}" | grep -oE '(^|[?&])iso_application=[-0-9a-zA-Z. ~;:/_]+' | cut -f 2 -d '=' | head -n1) + LB_ISO_PREPARER=$(echo "${QUERY_STRING}" | grep -oE '(^|[?&])iso_preparer=[-0-9a-zA-Z. ~;:/_]+' | cut -f 2 -d '=' | head -n1) + LB_ISO_PUBLISHER=$(echo "${QUERY_STRING}" | grep -oE '(^|[?&])iso_publisher=[-0-9a-zA-Z. ~;:/_@]+' | cut -f 2 -d '=' | head -n1) + LB_ISO_VOLUME=$(echo "${QUERY_STRING}" | grep -oE '(^|[?&])iso_volume=[-0-9a-zA-Z. ~;:/_]+' | cut -f 2 -d '=' | head -n1) + LB_MEMTEST=$(echo "${QUERY_STRING}" | grep -oE '(^|[?&])memtest=[0-9a-z+]+' | cut -f 2 -d '=' | head -n1) + LB_NET_ROOT_PATH=$(echo "${QUERY_STRING}" | grep -oE '(^|[?&])net_path=[-0-9a-zA-Z._/]+' | cut -f 2 -d '=' | head -n1) + LB_NET_ROOT_SERVER=$(echo "${QUERY_STRING}" | grep -oE '(^|[?&])net_server=[0-9.]+' | cut -f 2 -d '=' | head -n1) + + # Advanced source options + LB_SOURCE=$(echo "${QUERY_STRING}" | grep -oE '(^|[?&])source=[a-z]+' | cut -f 2 -d '=' | head -n1) + LB_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-9a-zA-Z.~:/_]+' | cut -f 2 -d '=' | head -n1) + _CUSTOM_BINARY=$(echo "${QUERY_STRING}" | grep -oE '(^|[?&])custom_binary=[-0-9a-zA-Z.~:/_]+' | cut -f 2 -d '=' | head -n1) + + # FIXME: filter invalid options + unset QUERY_STRING + + if [ -z "${_EMAIL}" ] + then + echo "

Error: No email address specified.

" + + sed -e "s/VERSION/${VERSION}/" \ + -e "s/DATE/`date +%Y%m%d-%H:%M`/" \ + "${_TEMPLATES}"/form.html + + exit + fi + + # Getting build identifier + _BUILD=$(date +%Y%m%d.%H%M%S.%N) + + # Getting number of builds pending. + _QUEUENUM=$(ls "${_TEMPDIR}"/*.build | wc -l) + + #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}/" \ + -e "s/QUEUENUM/${_QUEUENUM}/" \ + -e "s/LB_BINARY_IMAGES/${LB_BINARY_IMAGES}/" \ + -e "s/LB_DISTRIBUTION/${LB_DISTRIBUTION}/" \ + -e "s/LB_PACKAGE_LISTS/${LB_PACKAGE_LISTS}/" \ + -e "s/LB_TASKS/${LB_TASKS}/" \ + -e "s/_LB_CGIPACKAGES/${_LB_CGIPACKAGES}/" \ + -e "s/LB_ARCHITECTURES/${LB_ARCHITECTURES}/" \ + -e "s/LB_BOOTSTRAP_FLAVOUR/${LB_BOOTSTRAP_FLAVOUR}/" \ + -e "s/LB_ARCHIVE_AREAS/${LB_ARCHIVE_AREAS}/" \ + -e "s/LB_CHROOT_FILESYSTEM/${LB_CHROOT_FILESYSTEM}/" \ + -e "s/LB_LINUX_FLAVOURS/${LB_LINUX_FLAVOURS}/" \ + -e "s/LB_SECURITY/${LB_SECURITY}/" \ + -e "s/LB_BINARY_INDICES/${LB_BINARY_INDICES}/" \ + -e "s#LB_BOOTAPPEND_INSTALL#${LB_BOOTAPPEND_INSTALL}#" \ + -e "s#LB_BOOTAPPEND_LIVE#${LB_BOOTAPPEND_LIVE}#" \ + -e "s/LB_BOOTLOADER/${LB_BOOTLOADER}/" \ + -e "s/LB_DEBIAN_INSTALLER/${LB_DEBIAN_INSTALLER}/" \ + -e "s#LB_ISO_APPLICATION#${LB_ISO_APPLICATION}#" \ + -e "s#LB_ISO_PREPARER#${LB_ISO_PREPARER}#" \ + -e "s#LB_ISO_PUBLISHER#${LB_ISO_PUBLISHER}#" \ + -e "s#LB_ISO_VOLUME#${LB_ISO_VOLUME}#" \ + -e "s/LB_MEMTEST/${LB_MEMTEST}/" \ + -e "s#LB_NET_ROOT_PATH#${LB_NET_ROOT_PATH}#" \ + -e "s/LB_NET_ROOT_SERVER/${LB_NET_ROOT_SERVER}/" \ + -e "s#SERVER#${_SERVER}#g" \ + -e "s/LB_SOURCE_IMAGES/${LB_SOURCE_IMAGES}/" \ + -e "s/LB_SOURCE/${LB_SOURCE}/" \ + -e "s#CUSTOM_BOOTSTRAP#${_CUSTOM_BOOTSTRAP}#" \ + -e "s#CUSTOM_BINARY#${_CUSTOM_BINARY}#" \ + "${_TEMPLATES}"/build.html + + # Creating temporary directory + mkdir -p "${_TEMPDIR}" + +# Writing build file +cat > "${_TEMPDIR}"/"${_BUILD}".build << EOF +# live-build-cgi "${VERSION}" build file +# `date -R` + +_BUILD="${_BUILD}" +_EMAIL="${_EMAIL}" + +REMOTE_ADDR="${REMOTE_ADDR}" + +# CGI Packages List +_LB_CGIPACKAGES="${_LB_CGIPACKAGES}" + +# Standard options +LB_BINARY_IMAGES="${LB_BINARY_IMAGES}" +LB_DISTRIBUTION="${LB_DISTRIBUTION}" +LB_PACKAGE_LISTS="${LB_PACKAGE_LISTS}" +LB_TASKS="${LB_TASKS}" + +# Advanced bootstrap options +LB_ARCHITECTURES="${LB_ARCHITECTURES}" +LB_ARCHIVE_AREAS="${LB_ARCHIVE_AREAS}" + +# Advanced chroot options +LB_CHROOT_FILESYSTEM="${LB_CHROOT_FILESYSTEM}" +LB_LINUX_FLAVOURS="${LB_LINUX_FLAVOURS}" +LB_SECURITY="${LB_SECURITY}" + +# Advanced binary options +LB_BINARY_INDICES="${LB_BINARY_INDICES}" +LB_BOOTAPPEND_INSTALL="${LB_BOOTAPPEND_INSTALL}" +LB_BOOTAPPEND_LIVE="${LB_BOOTAPPEND_LIVE}" +LB_BOOTLOADER="${LB_BOOTLOADER}" +LB_DEBIAN_INSTALLER="${LB_DEBIAN_INSTALLER}" +LB_ISO_APPLICATION="${LB_ISO_APPLICATION}" +LB_ISO_PREPARER="${LB_ISO_PREPARER}" +LB_ISO_PUBLISHER="${LB_ISO_PUBLISHER}" +LB_ISO_VOLUME="${LB_ISO_VOLUME}" +LB_MEMTEST="${LB_MEMTEST}" +LB_NET_ROOT_PATH="${LB_NET_ROOT_PATH}" +LB_NET_ROOT_SERVER="${LB_NET_ROOT_SERVER}" + +# Advanced source options +LB_SOURCE_IMAGES="${LB_SOURCE_IMAGES}" +LB_SOURCE="${LB_SOURCE}" + +# Unofficial options +_CUSTOM_BOOTSTRAP="${_CUSTOM_BOOTSTRAP}" +_CUSTOM_BINARY="${_CUSTOM_BINARY}" + +# Other +LB_ARCHIVES="${LB_ARCHIVES}" +LB_PARENT_DISTRIBUTION="${LB_DISTRIBUTION}" +LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION="${LB_DISTRIBUTION}" +LB_BACKPORTS="false" +LB_MODE="debian" +EOF + + echo "$(date +%b\ %d\ %H:%M:%S) ${_HOSTNAME} live-build-cgi: add web build (${_BUILD}) from ${REMOTE_ADDR}." >> /var/log/live + echo "$(date +%b\ %d\ %H:%M:%S) ${_HOSTNAME} live-build-cgi: options ${_BUILD} |email ${_EMAIL}|binary_images ${LB_BINARY_IMAGES}|distribution ${LB_DISTRIBUTION}|package_lists ${LB_PACKAGE_LISTS}|tasks ${LB_TASKS}|cgipackages ${_LB_CGIPACKAGES}|architectures ${LB_ARCHITECTURES}|archive_areas ${LB_ARCHIVE_AREAS}|chroot_filesystem ${LB_CHROOT_FILESYSTEM}|linux_flavours ${LB_LINUX_FLAVOURS}|security ${LB_SECURITY}|binary_indices ${LB_BINARY_INDICES}|bootappend_install ${LB_BOOTAPPEND_INSTALL}|bootappend_live ${LB_BOOTAPPEND_LIVE}|bootloader ${LB_BOOTLOADER}|debian_installer ${LB_DEBIAN_INSTALLER}|iso_application ${LB_ISO_APPLICATION}|iso_preparer ${LB_ISO_PREPARER}|iso_publisher ${LB_ISO_PUBLISHER}|iso_volume ${LB_ISO_VOLUME}|memtest ${LB_MEMTEST}|net_path ${LB_NET_ROOT_PATH}|net_server ${LB_NET_ROOT_SERVER}|source_images ${LB_SOURCE_IMAGES}|sources ${LB_SOURCE}|custom_bootstrap ${_CUSTOM_BOOTSTRAP}|custom_binary ${_CUSTOM_BINARY}" >> /var/log/live +fi + +sed -e "s/VERSION/${VERSION}/" "${_TEMPLATES}"/footer.html diff --git a/frontends/cgi/live-build-cgi.cron b/frontends/cgi/live-build-cgi.cron new file mode 100755 index 000000000..a81de39a0 --- /dev/null +++ b/frontends/cgi/live-build-cgi.cron @@ -0,0 +1,204 @@ +#!/bin/sh + +## live-build(7) - System Build Scripts +## Copyright (C) 2006-2012 Daniel Baumann +## +## live-build comes with ABSOLUTELY NO WARRANTY; for details see COPYING. +## This is free software, and you are welcome to redistribute it +## under certain conditions; see COPYING for details. + + +# Including common functions +. "${LB_BASE:-/usr/share/live/build}"/scripts/build.sh + +# Reading defaults +if [ -r /etc/default/live-build-cgi ] +then + . /etc/default/live-build-cgi +else + echo "E: /etc/default/live-build-cgi missing" + exit 1 +fi + +# Exit if disabled +if [ "${_WEBBUILD}" != "enabled" ] +then + exit 0 +fi + +_HOSTNAME="$(hostname -f)" + +# Turn on debug if enabled +if [ "${_DEBUG}" = "enabled" ] +then + set -x +fi + +# Checking lock file +if [ -f /var/lock/live-build-cgi.lock ] +then + echo "E: live-build-cgi already/still running." + exit 1 +fi + +# Creating lock trap +trap "test -f /var/lock/live-build-cgi.lock && rm -f /var/lock/live-build-cgi.lock; exit 0" 0 1 2 3 9 15 + +# Creating lock file +touch /var/lock/live-build-cgi.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 +then + rm -rf "${_DESTDIR}"/`date -d yesterday +%Y%m%d.%H`* + + echo "`date +%b\ %d\ %H:%M:%S` ${_HOSTNAME} live-build-cgi: remove web build (`date -d yesterday +%Y%m%d.%H`*)." >> /var/log/live +fi + +# Ok from here spin through the live-build-cgi files we have waiting to build +#if ls "${_TEMPDIR}"/*.build > /dev/null 2>&1 +if Find_files ${_TEMPDIR}/*.build +then + 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}` + # Pull in the email address + _EMAIL=`awk -F\" '/^_EMAIL=/{print $2}' ${_FILE}` + # Pull in cgipackages for config/package-lists/cgipackages.list.chroot + _LB_CGIPACKAGES=`awk -F\" '/^_LB_CGIPACKAGES=/{print $2}' ${_FILE}` + # Pull in the remote address, atchitecture, distribution, and package-lists. + _REMOTE_ADDR=`awk -F\" '/^REMOTE_ADDR=/{print $2}' ${_FILE}` + _LB_ARCHITECTURES=`awk -F\" '/^LB_ARCHITECTURES=/{print $2}' ${_FILE}` + _LB_DISTRIBUTION=`awk -F\" '/^LB_DISTRIBUTION=/{print $2}' ${_FILE}` + _LB_PACKAGE_LISTS=`awk -F\" '/^LB_PACKAGE_LISTS=/{print $2}' ${_FILE}`i + # Pull in the custom bootstrap + _CUSTOM_BOOTSTRAP=`awk -F\" '/^_CUSTOM_BOOTSTRAP=/{print $2}' ${_FILE}` + # Pull in the custom binary + _CUSTOM_BINARY=`awk -F\" '/^_CUSTOM_BINARY=/{print $2}' ${_FILE}` + + # Drop out some build data for information if something goes wrong. + echo "`date +%b\ %d\ %H:%M:%S` ${_HOSTNAME} live-build-cgi: begin web build (${_BUILD})." >> /var/log/live + + # Creating build directory and the config/package-lists + mkdir -p "${_TEMPDIR}"/"${_BUILD}"/config/package-lists + + # The next two tests are for unofficial third party archives + if [ -n "${_LB_CGIPACKAGES}" ] + then + echo "${_LB_CGIPACKAGES}" > "${_TEMPDIR}"/"${_BUILD}"/config/package-lists/cgipackages.list.chroot + fi + + # Creating the config/chroot_sources folder + mkdir -p "${_TEMPDIR}"/"${_BUILD}"/config/chroot_sources + + # The next two tests are for unofficial third party archives + if [ -n "${_CUSTOM_BOOTSTRAP}" ] + then + echo "${_CUSTOM_BOOTSTRAP}" > "${_TEMPDIR}"/"${_BUILD}"/config/chroot_sources/custom.bootstrap + fi + + if [ -n "${_CUSTOM_BINARY}" ] + then + echo "${_CUSTOM_BINARY}" > "${_TEMPDIR}"/"${_BUILD}"/config/chroot_sources/custom.binary + fi + + _DATE_START="`date -R`" + echo "Begin: ${_DATE_START}" > "${_TEMPDIR}"/"${_BUILD}"/log + + # Generating image + cd "${_TEMPDIR}"/"${_BUILD}" + lb config -c ${_FILE} >> "${_TEMPDIR}"/"${_BUILD}"/log 2>&1 + _ERRORCONFIG="${?}" + lb build >> "${_TEMPDIR}"/"${_BUILD}"/log 2>&1 + _ERRORBUILD="${?}" + + _DATE_END="`date -R`" + echo "End: ${_DATE_END}" >> "${_TEMPDIR}"/"${_BUILD}"/log + + # Creating image directory + mkdir -p "${_DESTDIR}"/"${_BUILD}" + + # Creating mail and logging. + if [ "${_ERRORCONFIG}" -eq "0" ] && [ "${_ERRORBUILD}" -eq "0" ] + then + _STATUS="maybe-successful" + echo "${_REMOTE_ADDR} - - `date +[%d/%b/%Y:%H:%m:%S\ %z]` \"${_BUILD} ${_LB_ARCHITECTURES}/${_LB_DISTRIBUTION}/${_LB_PACKAGE_LISTS}/${_LB_CGIPACKAGES}\" 200 - \"-\" \"\"">>/var/log/live-cgi.builds + else + _STATUS="maybe-failed" + echo "${_REMOTE_ADDR} - - `date +[%d/%b/%Y:%H:%m:%S\ %z]` \"${_BUILD} ${_LB_ARCHITECTURES}/${_LB_DISTRIBUTION}/${_LB_PACKAGE_LISTS}/${_LB_CGIPACKAGES}\" 404 - \"-\" \"\"">>/var/log/live-cgi.builds + fi + + 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 + +cat >> "${_DESTDIR}"/"${_BUILD}"/mail << EOF + +--- + +Here's a list of all build-options that were used to build your image: + +EOF + + cat "${_TEMPDIR}"/"${_BUILD}".build >> "${_DESTDIR}"/"${_BUILD}"/mail + + # Moving binary image + #if ls "${_TEMPDIR}"/"${_BUILD}"/binary*.* > /dev/null 2>&1 + if Find_files ${_TEMPDIR}/${_BUILD}/binary*.* + then + mv "${_TEMPDIR}"/"${_BUILD}"/binary*.* "${_DESTDIR}"/"${_BUILD}" + fi + + # Moving source image + #if ls "${_TEMPDIR}"/"${_BUILD}"/source.* > /dev/null 2>&1 + if Find_files ${_TEMPDIR}/${_BUILD}/source.* + then + mv "${_TEMPDIR}"/"${_BUILD}"/source.* "${_DESTDIR}"/"${_BUILD}" + fi + + # Moving build + mv "${_TEMPDIR}"/"${_BUILD}".build "${_DESTDIR}"/"${_BUILD}"/build + + # Moving log + mv "${_TEMPDIR}"/"${_BUILD}"/log "${_DESTDIR}"/"${_BUILD}" + + # Generating md5sum + cd "${_DESTDIR}"/"${_BUILD}" + md5sum * > md5sum + cd "${OLDPWD}" + + # Sending mail + cat "${_DESTDIR}"/"${_BUILD}"/mail | /usr/sbin/sendmail -t + + # Unmounting devpts-live + #if ls "${_TEMPDIR}"/"${_BUILD}"/chroot/dev/pts/* > /dev/null 2>&1 + if Find_files ${_TEMPDIR}/${_BUILD}/chroot/dev/pts/* + then + umount "${_TEMPDIR}"/${_BUILD}/chroot/dev/pts + fi + + # Unmounting proc + if [ -f "${_TEMPDIR}"/"${_BUILD}"/chroot/proc/version ] + then + umount "${_TEMPDIR}"/"${_BUILD}"/chroot/proc + fi + + # Unmounting sysfs + if [ -d "${_TEMPDIR}"/"${_BUILD}"/chroot/sys/kernel ] + then + umount "${_TEMPDIR}"/${_BUILD}/chroot/sys + fi + + # Removing build directory + rm -rf "${_TEMPDIR}"/"${_BUILD}" + + echo "`date +%b\ %d\ %H:%M:%S` ${_HOSTNAME} live-build-cgi: end web build (${_BUILD}: ${_STATUS})." >> /var/log/live + done +fi diff --git a/frontends/cgi/live-build-cgi.crontab b/frontends/cgi/live-build-cgi.crontab new file mode 100644 index 000000000..1bf7a815d --- /dev/null +++ b/frontends/cgi/live-build-cgi.crontab @@ -0,0 +1,7 @@ +# /etc/crontab - system-wide crontab + +SHELL=/bin/sh +PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin + +# m h dom mon dow user command +*/1 * * * * root /etc/cron.hourly/live-build-cgi > /dev/null 2>&1 diff --git a/frontends/cgi/live-build-cgi.default b/frontends/cgi/live-build-cgi.default new file mode 100644 index 000000000..73daa586c --- /dev/null +++ b/frontends/cgi/live-build-cgi.default @@ -0,0 +1,13 @@ +# Defaults for /etc/cron.daily/live-build-cgi + +_WEBBUILD="disabled" + +_MODE="debian-official" + +_DEBUG="disabled" + +_DESTDIR="/srv/debian-live/build/www" +_TEMPLATES="/usr/share/live/build/templates/cgi/${_MODE}" +_TEMPDIR="/srv/debian-live/build/tmp" + +_SERVER="http://live.debian.net/build" diff --git a/frontends/cgi/live-build-cgi.logrotate b/frontends/cgi/live-build-cgi.logrotate new file mode 100644 index 000000000..75d89a9eb --- /dev/null +++ b/frontends/cgi/live-build-cgi.logrotate @@ -0,0 +1,11 @@ +# /etc/logrotate.d/live-build + +/var/log/live +{ + compress + copytruncate + missingok + monthly + notifempty + rotate 24 +} diff --git a/frontends/cron/TODO b/frontends/cron/TODO new file mode 100644 index 000000000..d3a90d3ac --- /dev/null +++ b/frontends/cron/TODO @@ -0,0 +1,10 @@ +General: + * add headers to log with build date and versions. + * send summary mails to debian-live@l.d.o. + * do not hardcode git urls. + * add support for git branches. + * add live-build-cron-packages. + + * logrotate for images trimming + * branch specific git version per release + * re-use existing git repository for local lb clone diff --git a/frontends/cron/live-build-cron-images b/frontends/cron/live-build-cron-images new file mode 100755 index 000000000..48c8d3115 --- /dev/null +++ b/frontends/cron/live-build-cron-images @@ -0,0 +1,343 @@ +#!/bin/sh + +## live-build(7) - System Build Scripts +## Copyright (C) 2006-2012 Daniel Baumann +## +## live-build comes with ABSOLUTELY NO WARRANTY; for details see COPYING. +## This is free software, and you are welcome to redistribute it +## under certain conditions; see COPYING for details. + + +#set -e + +Init () +{ + if [ -e /etc/live/build-cron.conf ] + then + . /etc/live/build-cron.conf + fi + + if ls /etc/live/build-cron.d/* > /dev/null 2>&1 + then + for _FILE in /etc/live/build-cron.d/* + do + . ${_FILE} + done + fi + + if [ "${LIVE_BUILD_CRON_IMAGES}" != "true" ] + then + exit 0 + fi + + mkdir -p "${LIVE_BUILD_CRON_IMAGES_DIRECTORY}" + + if [ ! -d "${LIVE_BUILD_CRON_IMAGES_DIRECTORY}" ] + then + echo "E: live-build-cron-images directory not set." + exit 1 + fi + + # FIXME: don't hardcode + BUILDS="daily" + DATE="$(date +%Y%m%d)" + + ARCHITECTURE="$(dpkg --print-architecture)" + eval DISTRIBUTIONS="$`echo LIVE_BUILD_CRON_IMAGES_$(echo ${BUILDS} | tr [a-z] [A-Z])_DISTRIBUTIONS`" + eval FLAVOURS="$`echo LIVE_BUILD_CRON_IMAGES_$(echo ${BUILDS} | tr [a-z] [A-Z])_FLAVOURS`" +} + +Setup () +{ + _TMPDIR="$(mktemp -d -t live-build-cron-images.XXXXXXXX)" + + case "${LIVE_BUILD_CRON_IMAGES_BUILD}" in + git) + cd "${_TMPDIR}" + git clone git://live.debian.net/git/live-build.git + git checkout debian-old-2.0 + + LB_BASE="${_TMPDIR}/live-build" + export LB_BASE + + PATH="${PATH}:${_TMPDIR}/live-build/scripts/build" + export PATH + ;; + + release) + # live-build + if [ -n "${LIVE_BUILD}" ] + then + if [ -x "$(which dget 2>/dev/null)" ] + then + dget "http://live.debian.net/archive/packages/live-build/${LIVE_BUILD}/live-build_${LIVE_BUILD}.dsc" + dpkg-source -x live-build_${LIVE_BUILD}.dsc + + LB_BASE="${_TMPDIR}/live-build-$(echo ${LIVE_BUILD} | awk -F- '{ print $1 }')" + export LB_BASE + + PATH="${PATH}:${_TMPDIR}/live-build-$(echo ${LIVE_BUILD} | awk -F- '{ print $1 }')/scripts/build" + export PATH + else + echo "E: dget - command not found" + echo "I: dget can be optained from: " + echo "I: http://git.debian.org/?p=devscripts/devscripts.git" + echo "I: On Debian based systems, dget can be installed with:" + echo "I: apt-get install devscripts" + + exit 1 + fi + fi + ;; + esac + + mkdir -p "${_TMPDIR}/build" + cd "${_TMPDIR}/build" + + # live-boot + if [ -n "${LIVE_BOOT}" ] + then + mkdir -p config/chroot_local-packages + cd config/chroot_local-packages + + wget -c "http://live.debian.net/archive/packages/live-boot/${LIVE_BOOT}/live-boot_${LIVE_BOOT}.dsc" + wget -c "http://live.debian.net/archive/packages/live-boot/${LIVE_BOOT}/live-boot_${LIVE_BOOT}.diff.gz" + wget -c "http://live.debian.net/archive/packages/live-boot/${LIVE_BOOT}/live-boot_$(echo ${LIVE_BOOT} | awk -F- '{ print $1 }').orig.tar.gz" + wget -c "http://live.debian.net/archive/packages/live-boot/${LIVE_BOOT}/live-boot_${LIVE_BOOT}_all.deb" + wget -c "http://live.debian.net/archive/packages/live-boot/${LIVE_BOOT}/live-boot-initramfs-tools_${LIVE_BOOT}_all.deb" + wget -c "http://live.debian.net/archive/packages/live-boot/${LIVE_BOOT}/live-initramfs_${LIVE_BOOT}_all.deb" + + cd "${OLDPWD}" + fi + + # live-config + if [ -n "${LIVE_CONFIG}" ] + then + mkdir -p config/chroot_local-packages + cd config/chroot_local-packages + + wget -c "http://live.debian.net/archive/packages/live-config/${LIVE_CONFIG}/live-config_${LIVE_CONFIG}.dsc" + wget -c "http://live.debian.net/archive/packages/live-config/${LIVE_CONFIG}/live-config_${LIVE_CONFIG}.diff.gz" + wget -c "http://live.debian.net/archive/packages/live-config/${LIVE_CONFIG}/live-config_$(echo ${LIVE_CONFIG} | awk -F- '{ print $1 }').orig.tar.gz" + wget -c "http://live.debian.net/archive/packages/live-config/${LIVE_CONFIG}/live-config_${LIVE_CONFIG}_all.deb" + wget -c "http://live.debian.net/archive/packages/live-config/${LIVE_CONFIG}/live-config-sysvinit_${LIVE_CONFIG}_all.deb" + + cd "${OLDPWD}" + fi + + # live-installer + if [ -n "${LIVE_INSTALLER}" ] + then + mkdir -p config/binary_local-udebs + cd config/binary_local-udebs + + wget -c "http://ftp.debian.org/debian/pool/main/l/live-installer/live-installer_${LIVE_INSTALLER}.dsc" + wget -c "http://ftp.debian.org/debian/pool/main/l/live-installer/live-installer_${LIVE_INSTALLER}.tar.gz" + wget -c "http://ftp.debian.org/debian/pool/main/l/live-installer/live-installer_${LIVE_INSTALLER}_${ARCHITECTURE}.udeb" + + cd "${OLDPWD}" + fi + + # debian-installer-launcher + if [ -n "${DI_LAUNCHER}" ] + then + mkdir -p config/chroot_local-packages + cd config/chroot_local-packages + + wget -c "http://ftp.debian.org/debian/pool/main/d/debian-installer-launcher/debian-installer-launcher_${DI_LAUNCHER}.dsc" + wget -c "http://ftp.debian.org/debian/pool/main/d/debian-installer-launcher/debian-installer-launcher_${DI_LAUNCHER}.tar.gz" + wget -c "http://ftp.debian.org/debian/pool/main/d/debian-installer-launcher/debian-installer-launcher_${DI_LAUNCHER}_all.deb" + + cd "${OLDPWD}" + fi +} + +Build () +{ + cd "${_TMPDIR}/build" + + for DISTRIBUTION in ${DISTRIBUTIONS} + do + rm -rf cache/stages* + + for FLAVOUR in ${FLAVOURS} + do + if [ -e .build ] + then + lb clean + fi + + rm -rf cache/stages_rootfs + rm -f config/* || true + + LB_VERSION="$(lb --version | awk '/^live-build, version / { print $3 }')" + + case "${LB_VERSION}" in + 2.0*) + _PACKAGE_LISTS="--package-lists ${FLAVOUR}" + ;; + + 3.0*) + _PACKAGE_LISTS="--package-lists ${FLAVOUR}" + ;; + esac + + # FIXME: cdebootstrap + lb config --clean \ + --bootstrap cdebootstrap \ + --cache-stages "bootstrap rootfs" \ + --debian-installer ${DEBIAN_INSTALLER} \ + --distribution ${DISTRIBUTION} \ + --mirror-bootstrap ${MIRROR_BOOTSTRAP} \ + --mirror-chroot ${MIRROR_CHROOT} \ + --mirror-chroot-security ${MIRROR_CHROOT_SECURITY} \ + ${_PACKAGE_LISTS} + + lb build 2>&1 | tee debian-live-${DISTRIBUTION}-${ARCHITECTURE}-${FLAVOUR}.iso.log + + mv binary*.iso debian-live-${DISTRIBUTION}-${ARCHITECTURE}-${FLAVOUR}.iso + mv binary.list debian-live-${DISTRIBUTION}-${ARCHITECTURE}-${FLAVOUR}.iso.list + mv binary.packages debian-live-${DISTRIBUTION}-${ARCHITECTURE}-${FLAVOUR}.iso.packages + + if [ "${ARCHITECTURE}" != "powerpc" ] + then + lb clean --binary + lb config --clean --binary-images usb-hdd + lb binary 2>&1 | tee debian-live-${DISTRIBUTION}-${ARCHITECTURE}-${FLAVOUR}.img.log + + mv binary.img debian-live-${DISTRIBUTION}-${ARCHITECTURE}-${FLAVOUR}.img + mv binary.list debian-live-${DISTRIBUTION}-${ARCHITECTURE}-${FLAVOUR}.img.list + mv binary.packages debian-live-${DISTRIBUTION}-${ARCHITECTURE}-${FLAVOUR}.img.packages + fi + + if [ "${ARCHITECTURE}" != "powerpc" ] + then + lb clean + rm -rf cache/stages_rootfs + lb config --clean --binary-images net + + lb build 2>&1 | tee debian-live-${DISTRIBUTION}-${ARCHITECTURE}-${FLAVOUR}.tar.gz.log + + mv binary-net.tar.gz debian-live-${DISTRIBUTION}-${ARCHITECTURE}-${FLAVOUR}.tar.gz + mv binary.list debian-live-${DISTRIBUTION}-${ARCHITECTURE}-${FLAVOUR}.tar.gz.list + mv binary.packages debian-live-${DISTRIBUTION}-${ARCHITECTURE}-${FLAVOUR}.tar.gz.packages + + mv binary/*/filesystem.squashfs debian-live-${DISTRIBUTION}-${ARCHITECTURE}-${FLAVOUR}.squashfs + for memtest in tftpboot/debian-live/${ARCHITECTURE}/memtest*; do cp -f ${memtest} debian-live-${DISTRIBUTION}-${ARCHITECTURE}.$(basename ${memtest}); done || true + for kernel in tftpboot/debian-live/${ARCHITECTURE}/vmlinuz*; do cp -f ${kernel} debian-live-${DISTRIBUTION}-${ARCHITECTURE}.$(basename ${kernel}); done + for initrd in tftpboot/debian-live/${ARCHITECTURE}/initrd*; do cp ${initrd} debian-live-${DISTRIBUTION}-${ARCHITECTURE}-${FLAVOUR}.$(basename ${initrd}); done + cp debian-live-${DISTRIBUTION}-${ARCHITECTURE}-${FLAVOUR}.tar.gz.packages debian-live-${DISTRIBUTION}-${ARCHITECTURE}-${FLAVOUR}.packages + fi + + if [ "${LIVE_BUILD_CRON_IMAGES_SOURCE}" = "true" ] + then + lb config --clean --source true + + lb source 2>&1 | tee debian-live-${DISTRIBUTION}-source-${FLAVOUR}.log + + mv source.debian.tar.gz debian-live-${DISTRIBUTION}-source-${FLAVOUR}.debian.tar.gz + mv source.debian.list debian-live-${DISTRIBUTION}-source-${FLAVOUR}.debian.tar.gz.list + mv source.debian-live.tar.gz debian-live-${DISTRIBUTION}-source-${FLAVOUR}.debian-live.tar.gz + mv source.debian-live.list debian-live-${DISTRIBUTION}-source-${FLAVOUR}.debian-live.tar.gz.list + fi + done + done +} + +Install () +{ + BUILD="1" + + while [ -e "${LIVE_BUILD_CRON_IMAGES_DIRECTORY}/${BUILDS}-builds/${DISTRIBUTION}/${DATE}-${BUILD}/${ARCHITECTURE}" ] + do + BUILD="$((${BUILD} + 1))" + done + + cd "${_TMPDIR}/build" + + # Move iso images + if ls debian-live-${DISTRIBUTION}-${ARCHITECTURE}-*.iso* > /dev/null 2>&1 + then + mkdir -p "${LIVE_BUILD_CRON_IMAGES_DIRECTORY}/${BUILDS}-builds/${DISTRIBUTION}/${DATE}-${BUILD}/${ARCHITECTURE}/iso-hybrid" + mv debian-live-${DISTRIBUTION}-${ARCHITECTURE}-*.iso* "${LIVE_BUILD_CRON_IMAGES_DIRECTORY}/${BUILDS}-builds/${DISTRIBUTION}/${DATE}-${BUILD}/${ARCHITECTURE}/iso-hybrid" + fi + + # Move hdd images + if ls debian-live-${DISTRIBUTION}-${ARCHITECTURE}-*.img > /dev/null 2>&1 + then + mkdir -p "${LIVE_BUILD_CRON_IMAGES_DIRECTORY}/${BUILDS}-builds/${DISTRIBUTION}/${DATE}-${BUILD}/${ARCHITECTURE}/usb-hdd" + mv debian-live-${DISTRIBUTION}-${ARCHITECTURE}-*.img* "${LIVE_BUILD_CRON_IMAGES_DIRECTORY}/${BUILDS}-builds/${DISTRIBUTION}/${DATE}-${BUILD}/${ARCHITECTURE}/usb-hdd" + fi + + # Move net images + if ls debian-live-${DISTRIBUTION}-${ARCHITECTURE}-*.tar.gz* > /dev/null 2>&1 + then + mkdir -p "${LIVE_BUILD_CRON_IMAGES_DIRECTORY}/${BUILDS}-builds/${DISTRIBUTION}/${DATE}-${BUILD}/${ARCHITECTURE}/net" + mv debian-live-${DISTRIBUTION}-${ARCHITECTURE}-*.tar.gz* "${LIVE_BUILD_CRON_IMAGES_DIRECTORY}/${BUILDS}-builds/${DISTRIBUTION}/${DATE}-${BUILD}/${ARCHITECTURE}/net" + fi + + # Move web images + if ls debian-live-${DISTRIBUTION}-${ARCHITECTURE}-*.squashfs > /dev/null 2>&1 + then + mkdir -p "${LIVE_BUILD_CRON_IMAGES_DIRECTORY}/${BUILDS}-builds/${DISTRIBUTION}/${DATE}-${BUILD}/${ARCHITECTURE}/web" + mv debian-live-${DISTRIBUTION}-${ARCHITECTURE}-*.squashfs "${LIVE_BUILD_CRON_IMAGES_DIRECTORY}/${BUILDS}-builds/${DISTRIBUTION}/${DATE}-${BUILD}/${ARCHITECTURE}/web" + mv debian-live-${DISTRIBUTION}-${ARCHITECTURE}-*.packages* "${LIVE_BUILD_CRON_IMAGES_DIRECTORY}/${BUILDS}-builds/${DISTRIBUTION}/${DATE}-${BUILD}/${ARCHITECTURE}/web" + mv debian-live-${DISTRIBUTION}-${ARCHITECTURE}-*.vmlinuz* "${LIVE_BUILD_CRON_IMAGES_DIRECTORY}/${BUILDS}-builds/${DISTRIBUTION}/${DATE}-${BUILD}/${ARCHITECTURE}/web" + mv debian-live-${DISTRIBUTION}-${ARCHITECTURE}-*.initrd.img* "${LIVE_BUILD_CRON_IMAGES_DIRECTORY}/${BUILDS}-builds/${DISTRIBUTION}/${DATE}-${BUILD}/${ARCHITECTURE}/web" + fi + + # Move source images + if ls debian-live-${DISTRIBUTION}-source-* > /dev/null 2>&1 && \ + [ ! -d "${LIVE_BUILD_CRON_IMAGES_DIRECTORY}/${BUILDS}-builds/${DISTRIBUTION}/${DATE}-${BUILD}/source" ] + then + mkdir -p "${LIVE_BUILD_CRON_IMAGES_DIRECTORY}/${BUILDS}-builds/${DISTRIBUTION}/${DATE}-${BUILD}/source/tar" + mv debian-live-${DISTRIBUTION}-source-* "${LIVE_BUILD_CRON_IMAGES_DIRECTORY}/${BUILDS}-builds/${DISTRIBUTION}/${DATE}-${BUILD}/source/tar" + fi + + for DIR in "${LIVE_BUILD_CRON_IMAGES_DIRECTORY}/${BUILDS}-builds/${DISTRIBUTION}/${DATE}-${BUILD}/${ARCHITECTURE}"/* "${LIVE_BUILD_CRON_IMAGES_DIRECTORY}/${BUILDS}-builds/${DISTRIBUTION}/${DATE}-${BUILD}/source"/* + do + cd "${DIR}" + + md5sum debian* > MD5SUMS + sha1sum debian* > SHA1SUMS + sha256sum debian* > SHA256SUMS + done + + rm -f "${LIVE_BUILD_CRON_IMAGES_DIRECTORY}/${BUILDS}-builds/${DISTRIBUTION}/current" + + cd "${LIVE_BUILD_CRON_IMAGES_DIRECTORY}/${BUILDS}-builds/${DISTRIBUTION}" + ln -s ${DATE}-${BUILD} current +} + +Clean () +{ + cd "${_TMPDIR}/build" + lb clean --purge + + cd "${CURDIR}" + rm -rf "${_TMPDIR}" +} + +Trace () +{ + +cat > "${LIVE_BUILD_CRON_IMAGES_DIRECTORY}/${BUILDS}-builds/${BUILDS}-trace" << EOF +${DATE}-${BUILD} +$(LC_ALL=C date -R) +EOF + +} + +Main () +{ + Init + Setup + + Build + Install + Clean + + Trace +} + +Main diff --git a/frontends/cron/live-build-cron-manual b/frontends/cron/live-build-cron-manual new file mode 100755 index 000000000..6d539ced8 --- /dev/null +++ b/frontends/cron/live-build-cron-manual @@ -0,0 +1,99 @@ +#!/bin/sh + +## live-build(7) - System Build Scripts +## Copyright (C) 2006-2012 Daniel Baumann +## +## live-build comes with ABSOLUTELY NO WARRANTY; for details see COPYING. +## This is free software, and you are welcome to redistribute it +## under certain conditions; see COPYING for details. + + +#set -e + +Init () +{ + if [ -e /etc/live/build-cron.conf ] + then + . /etc/live/build-cron.conf + fi + + if ls /etc/live/build-cron.d/* > /dev/null 2>&1 + then + for _FILE in /etc/live/build-cron.d/* + do + . "${_FILE}" + done + fi + + if [ "${LIVE_BUILD_CRON_MANUAL}" != "true" ] + then + echo "I: live-build-cron-manual disabled." + exit 0 + fi + + mkdir -p "${LIVE_BUILD_CRON_MANUAL_DIRECTORY}" + + if [ ! -d "${LIVE_BUILD_CRON_MANUAL_DIRECTORY}" ] + then + echo "E: live-build-cron-manual directory not set." + exit 1 + fi +} + +Setup () +{ + _TMPDIR="$(mktemp -d -t live-build-cron-manual.XXXXXXXX)" + + cd "${_TMPDIR}" + git clone git://live.debian.net/git/live-manual.git + + cd live-manual && git checkout debian-next +} + +Build () +{ + cd "${_TMPDIR}/live-manual" + + echo "live-build-cron-manual: $(LC_ALL=C date -R) on ${_HOSTNAME}" | tee build.log + echo "Using the following sisu package versions: " | tee -a build.log + + for _PACKAGE in $(dpkg --get-selections | awk '/^sisu/ { print $1 }') + do + echo ${_PACKAGE} $(apt-cache policy $package | awk '/Installed: / { print $2 }') | tee -a build.log + done + + make DEBUG=1 autobuild 2>&1 | tee -a build.log +} + +Install () +{ + cd "${LIVE_BUILD_CRON_MANUAL_DIRECTORY}" + rm -rf * + + mv "${_TMPDIR}/live-manual/build/"* ./ + mv "${_TMPDIR}/live-manual/build.log" ./ +} + +Clean () +{ + rm -rf "${_TMPDIR}" +} + +Trace () +{ + echo "$(LC_ALL=C date -R)" > "${LIVE_BUILD_CRON_MANUAL_DIRECTORY}/manual-trace" +} + +Main () +{ + Init + Setup + + Build + Install + Clean + + Trace +} + +Main -- cgit v1.2.3