diff options
author | Daniel Baumann <daniel@debian.org> | 2011-07-15 20:31:44 +0200 |
---|---|---|
committer | Daniel Baumann <daniel@debian.org> | 2011-07-15 20:38:39 +0200 |
commit | 7e4c34b6f2259425ed4258d8f36b55e6d468efdf (patch) | |
tree | 043237418591a3036d18eae06029d380586ef8bd | |
parent | e24497b72306d4519d8c2999c6b7c0dbec9166ef (diff) | |
download | vyos-live-build-7e4c34b6f2259425ed4258d8f36b55e6d468efdf.tar.gz vyos-live-build-7e4c34b6f2259425ed4258d8f36b55e6d468efdf.zip |
Adding initial live-build-cron package.
-rw-r--r-- | Makefile | 3 | ||||
-rw-r--r-- | cron/TODO | 5 | ||||
-rwxr-xr-x | cron/live-build-cron-images | 341 | ||||
-rwxr-xr-x | cron/live-build-cron-manual | 107 | ||||
-rw-r--r-- | debian/control | 9 | ||||
-rw-r--r-- | debian/live-build-cron.config | 78 | ||||
-rw-r--r-- | debian/live-build-cron.postinst | 176 | ||||
-rw-r--r-- | debian/live-build-cron.postrm | 31 | ||||
-rw-r--r-- | debian/live-build-cron.templates | 82 | ||||
-rw-r--r-- | debian/po/POTFILES.in | 1 | ||||
-rw-r--r-- | debian/po/templates.pot | 208 | ||||
-rwxr-xr-x | debian/rules | 6 | ||||
-rw-r--r-- | debian/tmp/live-build-cron-manual.config | 50 | ||||
-rw-r--r-- | debian/tmp/live-build-cron-manual.postinst | 111 | ||||
-rw-r--r-- | debian/tmp/live-build-cron-manual.postrm | 37 | ||||
-rw-r--r-- | debian/tmp/live-build-cron-manual.templates | 29 |
16 files changed, 1272 insertions, 2 deletions
@@ -4,7 +4,7 @@ SHELL := sh -e LANGUAGES = $(shell cd manpages/po && ls) -SCRIPTS = cgi/* functions/* examples/*/*.sh examples/auto/* scripts/*.sh scripts/*/* +SCRIPTS = cgi/* cron/* functions/* examples/*/*.sh examples/auto/* scripts/*.sh scripts/*/* all: build @@ -46,6 +46,7 @@ install: # 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 # Installing documentation mkdir -p $(DESTDIR)/usr/share/doc/live-build diff --git a/cron/TODO b/cron/TODO new file mode 100644 index 000000000..231d208fe --- /dev/null +++ b/cron/TODO @@ -0,0 +1,5 @@ +* 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 support for git snapshot packages. diff --git a/cron/live-build-cron-images b/cron/live-build-cron-images new file mode 100755 index 000000000..6e89b77df --- /dev/null +++ b/cron/live-build-cron-images @@ -0,0 +1,341 @@ +#!/bin/sh + +## live-build-cron-images(7) - FIXME +## Copyright (C) 2006-2010 Daniel Baumann <daniel@debian.org> +## +## This program is free software: you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation, either version 3 of the License, or +## (at your option) any later version. +## +## This program is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with this program. If not, see <http://www.gnu.org/licenses/>. +## +## The complete text of the GNU General Public License +## can be found in /usr/share/common-licenses/GPL-3 file. + + +#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 + + if [ -z "${LIVE_BUILD_CRON_IMAGES_DIRECTORY}" ] + then + 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 .stage ] + then + lb clean + fi + + rm -rf cache/stages_rootfs + rm -f config/* || true + + # FIXME: cdebootstrap + lb config --clean \ + --bootstrap cdebootstrap \ + --cache-stages "bootstrap rootfs" \ + --debian-installer ${DEBIAN_INSTALLER} \ + --debian-installer-distribution ${DEBIAN_INSTALLER_DISTRIBUTION} \ + --distribution ${DISTRIBUTION} \ + --mirror-bootstrap ${MIRROR_BOOTSTRAP} \ + --mirror-chroot ${MIRROR_CHROOT} \ + --mirror-chroot-security ${MIRROR_CHROOT_SECURITY} \ + --packages-lists ${FLAVOUR} + + 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 new file mode 100755 index 000000000..7bf9a86e8 --- /dev/null +++ b/cron/live-build-cron-manual @@ -0,0 +1,107 @@ +#!/bin/sh + +## live-build-cron-manual(7) - FIXME +## Copyright (C) 2006-2010 Daniel Baumann <daniel@debian.org> +## +## This program is free software: you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation, either version 3 of the License, or +## (at your option) any later version. +## +## This program is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with this program. If not, see <http://www.gnu.org/licenses/>. +## +## The complete text of the GNU General Public License +## can be found in /usr/share/common-licenses/GPL-3 file. + + +#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 "live-build-cron-manual disabled." + exit 0 + fi + + if [ -z "${LIVE_BUILD_CRON_MANUAL_DIRECTORY}" ] + then + echo "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 "Using the following sisu package versions: " | tee 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/debian/control b/debian/control index facc93032..a720934dd 100644 --- a/debian/control +++ b/debian/control @@ -33,3 +33,12 @@ Description: Debian Live - System Build Scripts (cgi frontend) configuration directory. . This package contains the cgi frontend. + +Package: live-build-cron +Architecture: all +Depends: ${misc:Depends}, live-build (= ${source:Version}), cron +Description: Debian Live - System Build Scripts (cron autobuilder) + live-build contains the scripts that build a Debian Live system image from a + configuration directory. + . + This package contains the cron autobuilder. diff --git a/debian/live-build-cron.config b/debian/live-build-cron.config new file mode 100644 index 000000000..b47922de0 --- /dev/null +++ b/debian/live-build-cron.config @@ -0,0 +1,78 @@ +#!/bin/sh + +set -e + +. /usr/share/debconf/confmodule + +_FILES="/etc/live/build-cron.conf /etc/live/build-cron.d/*" + +for _FILE in "${_FILES}" +do + if [ -e "${_FILE}" ] + then + _DEBCONF="true" + + . "${_FILE}" || true + fi +done + +if [ "${_DEBCONF}" = "true" ] +then + db_set live-build-cron-images/enable "${LIVE_BUILD_CRON_IMAGES}" + db_set live-build-cron-images/directory "${LIVE_BUILD_CRON_IMAGES_DIRECTORY}" + db_set live-build-cron-images/build "${LIVE_BUILD_CRON_IMAGES_BUILD}" + + db_set live-build-cron-images/daily-distributions "${LIVE_BUILD_CRON_IMAGES_DAILY_DISTRIBUTIONS}" + db_set live-build-cron-images/daily-flavours "${LIVE_BUILD_CRON_IMAGES_DAILY_FLAVOURS}" + + db_set live-build-cron-images/weekly-distributions "${LIVE_BUILD_CRON_IMAGES_WEEKLY_DISTRIBUTIONS}" + db_set live-build-cron-images/weekly-flavours "${LIVE_BUILD_CRON_IMAGES_WEEKLY_FLAVOURS}" + + db_set live-build-cron-images/monthly-distributions "${LIVE_BUILD_CRON_IMAGES_MONTHLY_DISTRIBUTIONS}" + db_set live-build-cron-images/monthly-flavours "${LIVE_BUILD_CRON_IMAGES_MONTHLY_FLAVOURS}" + + db_set live-build-cron-images/source "${LIVE_BUILD_CRON_IMAGES_SOURCE}" +fi + +db_settitle live-build-cron-images/title +db_input high live-build-cron-images/enable || true +db_go + +db_get live-build-cron-images/enable +LIVE_BUILD_CRON_IMAGES="${RET}" + +if [ "${LIVE_BUILD_CRON_IMAGES}" != "true" ] +then + db_stop + + exit 0 +fi + +db_settitle live-build-cron-images/title +db_input low live-build-cron-images/directory || true +db_go + +db_settitle live-build-cron-images/title +db_input low live-build-cron-images/build || true +db_go + +for _BUILDS in daily weekly monthly +do + db_settitle live-build-cron-images/title + db_input low live-build-cron-images/${_BUILDS}-distributions || true + db_go + + db_settitle live-build-cron-images/title + db_input low live-build-cron-images/${_BUILDS}-flavours || true + db_go +done + +db_settitle live-build-cron-images/title +db_input low live-build-cron-images/source || true +db_go + +db_settitle live-build-cron-images/title +db_input low live-build-cron-images/cron || true +db_go + +db_stop diff --git a/debian/live-build-cron.postinst b/debian/live-build-cron.postinst new file mode 100644 index 000000000..837d992db --- /dev/null +++ b/debian/live-build-cron.postinst @@ -0,0 +1,176 @@ +#!/bin/sh + +set -e + +. /usr/share/debconf/confmodule + +_FILE="/etc/live/build-cron.d/images.conf" + +case "${1}" in + configure) + db_get live-build-cron-images/enable + LIVE_BUILD_CRON_IMAGES="${RET}" # boolean + + db_get live-build-cron-images/directory + LIVE_BUILD_CRON_IMAGES_DIRECTORY="${RET:-/srv/debian.net/live/cdimage}" # string (w/o empty) + + db_get live-build-cron-images/build + LIVE_BUILD_CRON_IMAGES_BUILD="${RET}" # select + + db_get live-build-cron-images/daily-distributions + LIVE_BUILD_CRON_IMAGES_DAILY_DISTRIBUTIONS="$(echo ${RET} | sed -e 's|,||g')" # multiselect + + db_get live-build-cron-images/daily-flavours + LIVE_BUILD_CRON_IMAGES_DAILY_FLAVOURS="$(echo ${RET} | sed -e 's|,||g')" # multiselect + + db_get live-build-cron-images/weekly-distributions + LIVE_BUILD_CRON_IMAGES_WEEKLY_DISTRIBUTIONS="$(echo ${RET} | sed -e 's|,||g')" # multiselect + + db_get live-build-cron-images/weekly-flavours + LIVE_BUILD_CRON_IMAGES_WEEKLY_FLAVOURS="$(echo ${RET} | sed -e 's|,||g')" # multiselect + + db_get live-build-cron-images/monthly-distributions + LIVE_BUILD_CRON_IMAGES_MONTHLY_DISTRIBUTIONS="$(echo ${RET} | sed -e 's|,||g')" # multiselect + + db_get live-build-cron-images/monthly-flavours + LIVE_BUILD_CRON_IMAGES_MONTHLY_FLAVOURS="$(echo ${RET} | sed -e 's|,||g')" # multiselect + + db_get live-build-cron-images/source + LIVE_BUILD_CRON_IMAGES_SOURCE="${RET}" # boolean + + db_get live-build-cron-images/cron + _CRON="${RET}" # string (w empty) + + db_stop + + if [ ! -e "${_FILE}" ] + then + + mkdir -p "$(dirname ${_FILE})" + +cat > "${_FILE}" << EOF +# /etc/live/build-cron.d/images.conf + +LIVE_BUILD_CRON_IMAGES="${LIVE_BUILD_CRON_IMAGES}" +LIVE_BUILD_CRON_IMAGES_DIRECTORY="${LIVE_BUILD_CRON_IMAGES_DIRECTORY}" +LIVE_BUILD_CRON_IMAGES_BUILD="${LIVE_BUILD_CRON_IMAGES_BUILD}" + +LIVE_BUILD_CRON_IMAGES_DAILY_DISTRIBUTIONS="${LIVE_BUILD_CRON_IMAGES_DAILY_DISTRIBUTIONS}" +LIVE_BUILD_CRON_IMAGES_DAILY_FLAVOURS="${LIVE_BUILD_CRON_IMAGES_DAILY_FLAVOURS}" + +LIVE_BUILD_CRON_IMAGES_WEEKLY_DISTRIBUTIONS="${LIVE_BUILD_CRON_IMAGES_WEEKLY_DISTRIBUTIONS}" +LIVE_BUILD_CRON_IMAGES_WEEKLY_FLAVOURS="${LIVE_BUILD_CRON_IMAGES_WEEKLY_FLAVOURS}" + +LIVE_BUILD_CRON_IMAGES_MONTHLY_DISTRIBUTIONS="${LIVE_BUILD_CRON_IMAGES_MONTHLY_DISTRIBUTIONS}" +LIVE_BUILD_CRON_IMAGES_MONTHLY_FLAVOURS="${LIVE_BUILD_CRON_IMAGES_MONTHLY_FLAVOURS}" + +export LIVE_BUILD_CRON_IMAGES LIVE_BUILD_CRON_IMAGES_DIRECTORY +export LIVE_BUILD_CRON_IMAGES_DAILY_DISTRIBUTIONS LIVE_BUILD_CRON_IMAGES_DAILY_FLAVOURS +export LIVE_BUILD_CRON_IMAGES_WEEKLY_DISTRIBUTIONS LIVE_BUILD_CRON_IMAGES_WEEKLY_FLAVOURS +export LIVE_BUILD_CRON_IMAGES_MONTHLY_DISTRIBUTIONS LIVE_BUILD_CRON_IMAGES_MONTHLY_FLAVOURS +export LIVE_BUILD_CRON_IMAGES_SOURCE +EOF + + fi + + cp -a -f "${_FILE}" "${_FILE}.tmp" + + # If the admin deleted or commented some variables but then set + # them via debconf, (re-)add them to the config file. + + test -z "${LIVE_BUILD_CRON_IMAGES}" || \ + grep -Eq '^ *LIVE_BUILD_CRON_IMAGES=' "${_FILE}" || \ + echo "LIVE_BUILD_CRON_IMAGES=" >> "${_FILE}" + + test -z "${LIVE_BUILD_CRON_IMAGES_DIRECTORY}" || \ + grep -Eq '^ *LIVE_BUILD_CRON_IMAGES_DIRECTORY=' "${_FILE}" || \ + echo "LIVE_BUILD_CRON_IMAGES_DIRECTORY=" >> "${_FILE}" + + test -z "${LIVE_BUILD_CRON_IMAGES_BUILD}" || \ + grep -Eq '^ *LIVE_BUILD_CRON_IMAGES_BUILD=' "${_FILE}" || \ + echo "LIVE_BUILD_CRON_IMAGES_BUILD=" >> "${_FILE}" + + test -z "${LIVE_BUILD_CRON_IMAGES_DAILY_DISTRIBUTIONS}" || \ + grep -Eq '^ *LIVE_BUILD_CRON_IMAGES_DAILY_DISTRIBUTIONS=' "${_FILE}" || \ + echo "LIVE_BUILD_CRON_IMAGES_DAILY_DISTRIBUTIONS=" >> "${_FILE}" + + test -z "${LIVE_BUILD_CRON_IMAGES_DAILY_FLAVOURS}" || \ + grep -Eq '^ *LIVE_BUILD_CRON_IMAGES_DAILY_FLAVOURS=' "${_FILE}" || \ + echo "LIVE_BUILD_CRON_IMAGES_DAILY_FLAVOURS=" >> "${_FILE}" + + test -z "${LIVE_BUILD_CRON_IMAGES_WEEKLY_DISTRIBUTIONS}" || \ + grep -Eq '^ *LIVE_BUILD_CRON_IMAGES_WEEKLY_DISTRIBUTIONS=' "${_FILE}" || \ + echo "LIVE_BUILD_CRON_IMAGES_WEEKLY_DISTRIBUTIONS=" >> "${_FILE}" + + test -z "${LIVE_BUILD_CRON_IMAGES_WEEKLY_FLAVOURS}" || \ + grep -Eq '^ *LIVE_BUILD_CRON_IMAGES_WEEKLY_FLAVOURS=' "${_FILE}" || \ + echo "LIVE_BUILD_CRON_IMAGES_WEEKLY_FLAVOURS=" >> "${_FILE}" + + test -z "${LIVE_BUILD_CRON_IMAGES_MONTHLY_DISTRIBUTIONS}" || \ + grep -Eq '^ *LIVE_BUILD_CRON_IMAGES_MONTHLY_DISTRIBUTIONS=' "${_FILE}" || \ + echo "LIVE_BUILD_CRON_IMAGES_MONTHLY_DISTRIBUTIONS=" >> "${_FILE}" + + test -z "${LIVE_BUILD_CRON_IMAGES_MONTHLY_FLAVOURS}" || \ + grep -Eq '^ *LIVE_BUILD_CRON_IMAGES_MONTHLY_FLAVOURS=' "${_FILE}" || \ + echo "LIVE_BUILD_CRON_IMAGES_MONTHLY_FLAVOURS=" >> "${_FILE}" + + test -z "${LIVE_BUILD_CRON_IMAGES_SOURCE}" || \ + grep -Eq '^ *LIVE_BUILD_CRON_IMAGES_SOURCE=' "${_FILE}" || \ + echo "LIVE_BUILD_CRON_IMAGES_SOURCE=" >> "${_FILE}" + + sed -e "s|^ *LIVE_BUILD_CRON_IMAGES=.*|LIVE_BUILD_CRON_IMAGES=\"${LIVE_BUILD_CRON_IMAGES}\"|" \ + -e "s|^ *LIVE_BUILD_CRON_IMAGES_DIRECTORY=.*|LIVE_BUILD_CRON_IMAGES_DIRECTORY=\"${LIVE_BUILD_CRON_IMAGES_DIRECTORY}\"|" \ + -e "s|^ *LIVE_BUILD_CRON_IMAGES_BUILD=.*|LIVE_BUILD_CRON_IMAGES_BUILD=\"${LIVE_BUILD_CRON_IMAGES_BUILD}\"|" \ + -e "s|^ *LIVE_BUILD_CRON_IMAGES_DAILY_DISTRIBUTIONS=.*|LIVE_BUILD_CRON_IMAGES_DAILY_DISTRIBUTIONS=\"${LIVE_BUILD_CRON_IMAGES_DAILY_DISTRIBUTIONS}\"|" \ + -e "s|^ *LIVE_BUILD_CRON_IMAGES_DAILY_FLAVOURS=.*|LIVE_BUILD_CRON_IMAGES_DAILY_FLAVOURS=\"${LIVE_BUILD_CRON_IMAGES_DAILY_FLAVOURS}\"|" \ + -e "s|^ *LIVE_BUILD_CRON_IMAGES_WEEKLY_DISTRIBUTIONS=.*|LIVE_BUILD_CRON_IMAGES_WEEKLY_DISTRIBUTIONS=\"${LIVE_BUILD_CRON_IMAGES_WEEKLY_DISTRIBUTIONS}\"|" \ + -e "s|^ *LIVE_BUILD_CRON_IMAGES_WEEKLY_FLAVOURS=.*|LIVE_BUILD_CRON_IMAGES_WEEKLY_FLAVOURS=\"${LIVE_BUILD_CRON_IMAGES_WEEKLY_FLAVOURS}\"|" \ + -e "s|^ *LIVE_BUILD_CRON_IMAGES_MONTHLY_DISTRIBUTIONS=.*|LIVE_BUILD_CRON_IMAGES_MONTHLY_DISTRIBUTIONS=\"${LIVE_BUILD_CRON_IMAGES_MONTHLY_DISTRIBUTIONS}\"|" \ + -e "s|^ *LIVE_BUILD_CRON_IMAGES_MONTHLY_FLAVOURS=.*|LIVE_BUILD_CRON_IMAGES_MONTHLY_FLAVOURS=\"${LIVE_BUILD_CRON_IMAGES_MONTHLY_FLAVOURS}\"|" \ + -e "s|^ *LIVE_BUILD_CRON_IMAGES_SOURCE=.*|LIVE_BUILD_CRON_IMAGES_SOURCE=\"${LIVE_BUILD_CRON_IMAGES_SOURCE}\"|" \ + "${_FILE}" > "${_FILE}.tmp" + + mv -f "${_FILE}.tmp" "${_FILE}" + + mkdir -p "${LIVE_BUILD_CRON_IMAGES_DIRECTORY}" + + if [ -n "${_CRON}" ] + then + +cat > /etc/cron.d/live-build-cron-images << EOF +# /etc/cron.d/live-build-cron-images + +PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" + +# m h dom mon dow user command +${_CRON} root /usr/bin/live-build-cron-images +EOF + + else + rm -f /etc/cron.d/live-build-cron-images + fi + + if [ -x "/etc/init.d/cron" ] + then + if [ -x "$(which invoke-rc.d 2>/dev/null)" ] + then + invoke-rc.d cron restart || exit ${?} + else + /etc/init.d/cron restart || exit ${?} + fi + fi + ;; + + abort-upgrade|abort-remove|abort-deconfigure) + + ;; + + *) + echo "postinst called with unknown argument \`${1}'" >&2 + exit 1 + ;; +esac + +#DEBHELPER# + +exit 0 diff --git a/debian/live-build-cron.postrm b/debian/live-build-cron.postrm new file mode 100644 index 000000000..f38627677 --- /dev/null +++ b/debian/live-build-cron.postrm @@ -0,0 +1,31 @@ +#!/bin/sh + +set -e + +_DIRECTORY="/srv/debian.net/live-manual" + +case "${1}" in + remove) + if [ -d "${_DIRECTORY}" ] + then + rmdir --ignore-fail-on-non-empty "${_DIRECTORY}" || true + fi + ;; + + purge) + #rm -rf "${_DIRECTORY}" + ;; + + upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) + + ;; + + *) + echo "postrm called with unknown argument \`${1}'" >&2 + exit 1 + ;; +esac + +#DEBHELPER# + +exit 0 diff --git a/debian/live-build-cron.templates b/debian/live-build-cron.templates new file mode 100644 index 000000000..8e689c199 --- /dev/null +++ b/debian/live-build-cron.templates @@ -0,0 +1,82 @@ +Template: live-build-cron-images/title +Type: title +_Description: Debian Live - System Build Scripts + +Template: live-build-cron-images/enable +Type: boolean +Default: false +_Description: Enable live-build-cron-images? + Do you want to enable live-build-cron-images? + . + If unsure, use 'no' (default). + +Template: live-build-cron-images/directory +Type: string +_Default: /srv/debian.net/live-cdimage +_Description: What directory to put builds to? + Enter the directory where the images should be stored in. + +Template: live-build-cron-images/build +Type: select +_Choices: git, host, release +Default: host +_Description: Which version of live-build to use? + Select the version of live-build to use. + . + If you choose git, the current version of live-build from git will be + used. host will use the live-build from the host system, and release will + use the last released version. + +Template: live-build-cron-images/daily-distributions +Type: multiselect +_Choices: squeeze, wheezy, sid +Default: sid +_Description: What distributions to build for daily images? + Select the distributions you would like to build for daily-images. + +Template: live-build-cron-images/daily-flavours +Type: multiselect +_Choices: standard, rescue, gnome-desktop, kde-desktop, lxde-desktop, xfce-desktop +Default: standard +_Description: What flavours to build for daily images? + Select the flavours you would like to build for daily-images. + +Template: live-build-cron-images/weekly-distributions +Type: multiselect +_Choices: squeeze, wheezy, sid +Default: wheezy +_Description: What distributions to build for weekly images? + Select the distributions you would like to build for weekly-images. + +Template: live-build-cron-images/weekly-flavours +Type: multiselect +_Choices: standard, rescue, gnome-desktop, kde-desktop, lxde-desktop, xfce-desktop +Default: standard +_Description: What flavours to build for weekly images? + Select the flavours you would like to build for weekly-images. + +Template: live-build-cron-images/monthly-distributions +Type: multiselect +_Choices: squeeze, wheezy, sid +Default: squeeze +_Description: What distributions to build for monthly images? + Select the distributions you would like to build for monthly-images. + +Template: live-build-cron-images/monthly-flavours +Type: multiselect +_Choices: standard, rescue, gnome-desktop, kde-desktop, lxde-desktop, xfce-desktop +Default: standard +_Description: What flavours to build for monthly images? + Select the flavours you would like to build for monthly-images. + +Template: live-build-cron-images/source +Type: boolean +Default: false +_Description: Enable source for live-build-cron-images? + Do you sources for live-build-cron-images? + +Template: live-build-cron-images/cron +Type: string +_Default: 0 0 * * * +_Description: What directory to put builds to? + Enter the cron times where the images should be build. diff --git a/debian/po/POTFILES.in b/debian/po/POTFILES.in new file mode 100644 index 000000000..e4c8a55eb --- /dev/null +++ b/debian/po/POTFILES.in @@ -0,0 +1 @@ +[type: gettext/rfc822deb] live-build-cron.templates diff --git a/debian/po/templates.pot b/debian/po/templates.pot new file mode 100644 index 000000000..cc035b762 --- /dev/null +++ b/debian/po/templates.pot @@ -0,0 +1,208 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: live-build@packages.debian.org\n" +"POT-Creation-Date: 2011-07-15 20:31+0200\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" +"Language-Team: LANGUAGE <LL@li.org>\n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Type: title +#. Description +#: ../live-build-cron.templates:1001 +msgid "Debian Live - System Build Scripts" +msgstr "" + +#. Type: boolean +#. Description +#: ../live-build-cron.templates:2001 +msgid "Enable live-build-cron-images?" +msgstr "" + +#. Type: boolean +#. Description +#: ../live-build-cron.templates:2001 +msgid "Do you want to enable live-build-cron-images?" +msgstr "" + +#. Type: boolean +#. Description +#: ../live-build-cron.templates:2001 +msgid "If unsure, use 'no' (default)." +msgstr "" + +#. Type: string +#. Default +#: ../live-build-cron.templates:3001 +msgid "/srv/debian.net/live-cdimage" +msgstr "" + +#. Type: string +#. Description +#. Type: string +#. Description +#: ../live-build-cron.templates:3002 ../live-build-cron.templates:12002 +msgid "What directory to put builds to?" +msgstr "" + +#. Type: string +#. Description +#: ../live-build-cron.templates:3002 +msgid "Enter the directory where the images should be stored in." +msgstr "" + +#. Type: select +#. Choices +#: ../live-build-cron.templates:4001 +msgid "git, host, release" +msgstr "" + +#. Type: select +#. Description +#: ../live-build-cron.templates:4002 +msgid "Which version of live-build to use?" +msgstr "" + +#. Type: select +#. Description +#: ../live-build-cron.templates:4002 +msgid "Select the version of live-build to use." +msgstr "" + +#. Type: select +#. Description +#: ../live-build-cron.templates:4002 +msgid "" +"If you choose git, the current version of live-build from git will be used. " +"host will use the live-build from the host system, and release will use the " +"last released version." +msgstr "" + +#. Type: multiselect +#. Choices +#. Type: multiselect +#. Choices +#. Type: multiselect +#. Choices +#: ../live-build-cron.templates:5001 ../live-build-cron.templates:7001 +#: ../live-build-cron.templates:9001 +msgid "squeeze, wheezy, sid" +msgstr "" + +#. Type: multiselect +#. Description +#: ../live-build-cron.templates:5002 +msgid "What distributions to build for daily images?" +msgstr "" + +#. Type: multiselect +#. Description +#: ../live-build-cron.templates:5002 +msgid "Select the distributions you would like to build for daily-images." +msgstr "" + +#. Type: multiselect +#. Choices +#. Type: multiselect +#. Choices +#. Type: multiselect +#. Choices +#: ../live-build-cron.templates:6001 ../live-build-cron.templates:8001 +#: ../live-build-cron.templates:10001 +msgid "" +"standard, rescue, gnome-desktop, kde-desktop, lxde-desktop, xfce-desktop" +msgstr "" + +#. Type: multiselect +#. Description +#: ../live-build-cron.templates:6002 +msgid "What flavours to build for daily images?" +msgstr "" + +#. Type: multiselect +#. Description +#: ../live-build-cron.templates:6002 +msgid "Select the flavours you would like to build for daily-images." +msgstr "" + +#. Type: multiselect +#. Description +#: ../live-build-cron.templates:7002 +msgid "What distributions to build for weekly images?" +msgstr "" + +#. Type: multiselect +#. Description +#: ../live-build-cron.templates:7002 +msgid "Select the distributions you would like to build for weekly-images." +msgstr "" + +#. Type: multiselect +#. Description +#: ../live-build-cron.templates:8002 +msgid "What flavours to build for weekly images?" +msgstr "" + +#. Type: multiselect +#. Description +#: ../live-build-cron.templates:8002 +msgid "Select the flavours you would like to build for weekly-images." +msgstr "" + +#. Type: multiselect +#. Description +#: ../live-build-cron.templates:9002 +msgid "What distributions to build for monthly images?" +msgstr "" + +#. Type: multiselect +#. Description +#: ../live-build-cron.templates:9002 +msgid "Select the distributions you would like to build for monthly-images." +msgstr "" + +#. Type: multiselect +#. Description +#: ../live-build-cron.templates:10002 +msgid "What flavours to build for monthly images?" +msgstr "" + +#. Type: multiselect +#. Description +#: ../live-build-cron.templates:10002 +msgid "Select the flavours you would like to build for monthly-images." +msgstr "" + +#. Type: boolean +#. Description +#: ../live-build-cron.templates:11001 +msgid "Enable source for live-build-cron-images?" +msgstr "" + +#. Type: boolean +#. Description +#: ../live-build-cron.templates:11001 +msgid "Do you sources for live-build-cron-images?" +msgstr "" + +#. Type: string +#. Default +#: ../live-build-cron.templates:12001 +msgid "0 0 * * *" +msgstr "" + +#. Type: string +#. Description +#: ../live-build-cron.templates:12002 +msgid "Enter the cron times where the images should be build." +msgstr "" diff --git a/debian/rules b/debian/rules index 6a24cd52c..3d268c7b7 100755 --- a/debian/rules +++ b/debian/rules @@ -19,9 +19,13 @@ override_dh_auto_install: rm -f debian/live-build/usr/share/doc/live-build/COPYING rm -f debian/live-build/usr/share/doc/live-build/ChangeLog - # live-buld-cgi + # live-build-cgi mkdir -p debian/live-build-cgi/usr/share/live/build mv debian/live-build/usr/share/live/build/cgi debian/live-build-cgi/usr/share/live/build + # live-build-cron + mkdir -p debian/live-build-cron/usr/bin + mv debian/live-build/usr/bin/live-build-cron* debian/live-build-cron/usr/bin + override_dh_installchangelogs: dh_installchangelogs docs/ChangeLog diff --git a/debian/tmp/live-build-cron-manual.config b/debian/tmp/live-build-cron-manual.config new file mode 100644 index 000000000..264477825 --- /dev/null +++ b/debian/tmp/live-build-cron-manual.config @@ -0,0 +1,50 @@ +#!/bin/sh + +set -e + +. /usr/share/debconf/confmodule + +_FILES="/etc/live/autobuild.conf /etc/live/autobuild.d/*" + +for _FILE in "${_FILES}" +do + if [ -e "${_FILE}" ] + then + _DEBCONF="true" + + . "${_FILE}" || true + fi +done + +if [ "${_DEBCONF}" = "true" ] +then + db_set live-autobuild-manual/enable "${LIVE_AUTOBUILD_MANUAL}" +fi + +db_settitle live-autobuild-manual/title +db_input high live-autobuild-manual/enable || true +db_go + +db_get live-autobuild-manual/enable +LIVE_AUTOBUILD_MANUAL="${RET}" + +if [ "${LIVE_AUTOBUILD_MANUAL}" != "true" ] +then + db_stop + + exit 0 +fi + +db_settitle live-autobuild-manual/title +db_input low live-autobuild-manual/username || true +db_go + +db_settitle live-autobuild-manual/title +db_input low live-autobuild-manual/directory || true +db_go + +db_settitle live-autobuild-manual/title +db_input low live-autobuild-manual/cron || true +db_go + +db_stop diff --git a/debian/tmp/live-build-cron-manual.postinst b/debian/tmp/live-build-cron-manual.postinst new file mode 100644 index 000000000..45c645dfe --- /dev/null +++ b/debian/tmp/live-build-cron-manual.postinst @@ -0,0 +1,111 @@ +#!/bin/sh + +set -e + +. /usr/share/debconf/confmodule + +_FILE="/etc/live/autobuild.d/manual.conf" + +case "${1}" in + configure) + db_get live-autobuild-manual/enable + LIVE_AUTOBUILD_MANUAL="${RET}" # boolean + + db_get live-autobuild-manual/username + _USERNAME="${RET:-live-autobuild-manual}" # string (w/o empty) + + db_get live-autobuild-manual/directory + LIVE_AUTOBUILD_MANUAL_DIRECTORY="${RET:-/srv/debian.net/live/cdimage}" # string (w/o empty) + + db_get live-autobuild-manual/cron + _CRON="${RET}" # string (w empty) + + db_stop + + if [ ! -e "${_FILE}" ] + then + + mkdir -p "$(dirname ${_FILE})" + +cat > "${_FILE}" << EOF +# /etc/live/autobuild.d/manual.conf + +LIVE_AUTOBUILD_MANUAL="${LIVE_AUTOBUILD_MANUAL}" +LIVE_AUTOBUILD_MANUAL_DIRECTORY="${LIVE_AUTOBUILD_MANUAL_DIRECTORY}" + +export LIVE_AUTOBUILD_MANUAL LIVE_AUTOBUILD_MANUAL_DIRECTORY +EOF + + fi + + cp -a -f "${_FILE}" "${_FILE}.tmp" + + # If the admin deleted or commented some variables but then set + # them via debconf, (re-)add them to the config file. + + test -z "${LIVE_AUTOBUILD_MANUAL}" || \ + grep -Eq '^ *LIVE_AUTOBUILD_MANUAL=' "${_FILE}" || \ + echo "LIVE_AUTOBUILD_MANUAL=" >> "${_FILE}" + + test -z "${LIVE_AUTOBUILD_MANUAL_DIRECTORY}" || \ + grep -Eq '^ *LIVE_AUTOBUILD_MANUAL_DIRECTORY=' "${_FILE}" || \ + echo "LIVE_AUTOBUILD_MANUAL_DIRECTORY=" >> "${_FILE}" + + sed -e "s|^ *LIVE_AUTOBUILD_MANUAL=.*|LIVE_AUTOBUILD_MANUAL=\"${LIVE_AUTOBUILD_MANUAL}\"|" \ + -e "s|^ *LIVE_AUTOBUILD_MANUAL_DIRECTORY=.*|LIVE_AUTOBUILD_MANUAL_DIRECTORY=\"${LIVE_AUTOBUILD_MANUAL_DIRECTORY}\"|" \ + "${_FILE}" > "${_FILE}.tmp" + + mv -f "${_FILE}.tmp" "${_FILE}" + + if ! getent passwd "${_USERNAME}" + then + adduser --quiet --system --home ${LIVE_AUTOBUILD_MANUAL_DIRECTORY} --shell /bin/sh --disabled-password --no-create-home --gecos 'live-autobuild-manual' --group ${_USERNAME} + elif ! getent group "${_USERNAME}" + then + addgroup --system --quiet ${_USERNAME} + gpasswd -a ${_USERNAME} ${_USERNAME} + fi + + mkdir -p "${LIVE_AUTOBUILD_MANUAL_DIRECTORY}" + chown ${_USERNAME}:${_USERNAME} "${LIVE_AUTOBUILD_MANUAL_DIRECTORY}" -R + + if [ -n "${_CRON}" ] + then + +cat > /etc/cron.d/live-autobuild-manual << EOF +# /etc/cron.d/live-autobuild-manual + +PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" + +# m h dom mon dow user command +${_CRON} ${_USERNAME} /usr/bin/live-autobuild-manual +EOF + + else + rm -f /etc/cron.d/live-autobuild-manual + fi + + if [ -x "/etc/init.d/cron" ] + then + if [ -x "$(which invoke-rc.d 2>/dev/null)" ] + then + invoke-rc.d cron restart || exit ${?} + else + /etc/init.d/cron restart || exit ${?} + fi + fi + ;; + + abort-upgrade|abort-remove|abort-deconfigure) + + ;; + + *) + echo "postinst called with unknown argument \`${1}'" >&2 + exit 1 + ;; +esac + +#DEBHELPER# + +exit 0 diff --git a/debian/tmp/live-build-cron-manual.postrm b/debian/tmp/live-build-cron-manual.postrm new file mode 100644 index 000000000..6e15675b5 --- /dev/null +++ b/debian/tmp/live-build-cron-manual.postrm @@ -0,0 +1,37 @@ +#!/bin/sh + +set -e + +_USERNAME="live-autobuild-manual" +_DIRECTORY="/srv/debian.net/live-manual" + +case "${1}" in + remove) + if [ -x /usr/sbin/deluser ] + then + deluser --system ${_USERNAME} || true + fi + + if [ -d "${_DIRECTORY}" ] + then + rmdir --ignore-fail-on-non-empty "${_DIRECTORY}" || true + fi + ;; + + purge) + rm -rf "${_DIRECTORY}" + ;; + + upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) + + ;; + + *) + echo "postrm called with unknown argument \`${1}'" >&2 + exit 1 + ;; +esac + +#DEBHELPER# + +exit 0 diff --git a/debian/tmp/live-build-cron-manual.templates b/debian/tmp/live-build-cron-manual.templates new file mode 100644 index 000000000..9baa0a0e8 --- /dev/null +++ b/debian/tmp/live-build-cron-manual.templates @@ -0,0 +1,29 @@ +Template: live-autobuild-manual/title +Type: title +Description: Debian Live - System Build Scripts + +Template: live-autobuild-manual/enable +Type: boolean +Default: false +Description: Enable live-autobuild-manual? + Do you want to enable live-autobuild-manual? + . + If unsure, use 'no' (default). + +Template: live-autobuild-manual/username +Type: string +Default: live-autobuild-manual +Description: What useraccount to use to build the manual? + Enter the name of the username. + +Template: live-autobuild-manual/directory +Type: string +Default: /srv/debian.net/live-manual +Description: What directory to put builds to? + Enter the directory where the manual should be stored in. + +Template: live-autobuild-manual/cron +Type: string +Default: 0-59/10 * * * * +Description: What directory to put builds to? + Enter the cron times where the manual should be build. |