diff options
Diffstat (limited to 'examples/cron')
-rwxr-xr-x | examples/cron/daily.sh | 166 | ||||
-rwxr-xr-x | examples/cron/etch+beryl.sh | 175 | ||||
-rwxr-xr-x | examples/cron/etch.sh | 166 | ||||
-rwxr-xr-x | examples/cron/snapshots.sh | 130 | ||||
-rwxr-xr-x | examples/cron/weekly.sh | 166 |
5 files changed, 803 insertions, 0 deletions
diff --git a/examples/cron/daily.sh b/examples/cron/daily.sh new file mode 100755 index 000000000..3d93a3375 --- /dev/null +++ b/examples/cron/daily.sh @@ -0,0 +1,166 @@ +#!/bin/sh -x + +set -e + +BUILD="daily" + +# Begin custom defaults +AUTOBUILD="enabled" + +DATE="`date +%Y%m%d`" +DESTDIR="/srv/debian-unofficial/ftp/debian-live" +TEMPDIR="/srv/tmp/live-helper" + +OPTIONS="--binary-indices disabled" + +ARCHITECTURES="`dpkg --print-architecture`" +DISTRIBUTIONS="sid" +MIRROR_BOOTSTRAP="http://ftp.de.debian.org/debian/" +MIRROR_BOOTSTRAP_SECURITY="http://ftp.de.debian.org/debian-security/" +MIRROR_BINARY="http://ftp.debian.org/debian/" +MIRROR_BINARY_SECURITY="http://security.debian.org/" +PACKAGES_LISTS="standard gnome-desktop kde-desktop xfce-desktop" +# End custom defaults + +# Checking for live-helper availability +if [ ! -x /usr/bin/make-live ] +then + exit 0 +fi + +# Checking for live-helper defaults +#if [ -r /etc/default/live-helper ] +#then +# . /etc/default/live-helper +#else +# echo "E: /etc/default/live-helper missing." +# exit 1 +#fi + +# Checking for autobuild +if [ "${AUTOBUILD}" != "enabled" ] +then + exit 0 +fi + +# Checking for build directory +if [ ! -d "${TEMPDIR}" ] +then + mkdir -p "${TEMPDIR}"/debian-live +else + # FIXME: maybe we should just remove the left overs. + echo "E: ${TEMPDIR} needs cleanup." + exit 1 +fi + +for ARCHITECTURE in ${ARCHITECTURES} +do + for DISTRIBUTION in ${DISTRIBUTIONS} + do + for PACKAGES_LIST in ${PACKAGES_LISTS} + do + if [ ! -f "${DESTDIR}"/"${BUILD}"-builds/${DATE}/log/debian-live-${DISTRIBUTION}-${ARCHITECTURE}-${PACKAGES_LIST}_${DATE}-iso-log.txt ] + then + # Creating build directory + mkdir -p "${TEMPDIR}"/debian-live + + cd "${TEMPDIR}" + echo "Begin: `date -R`" > "${TEMPDIR}"/debian-live/log.txt + + # Generating images + make-live -b iso -s generic --distribution ${DISTRIBUTION} --packages-lists ${PACKAGES_LIST} --mirror-bootstrap ${MIRROR_BOOTSTRAP} --mirror-bootstrap-security ${MIRROR_BOOTSTRAP_SECURITY} --mirror-binary ${MIRROR_BINARY} --mirror-binary-security ${MIRROR_BINARY_SECURITY} --source enabled ${OPTIONS} >> "${TEMPDIR}"/debian-live/log.txt 2>&1 + + echo "End: `date -R`" >> "${TEMPDIR}"/debian-live/log.txt + fi + + if [ -f "${TEMPDIR}"/debian-live/binary.iso ] && [ -f "${TEMPDIR}"/debian-live/source.tar ] + then + # Creating log directory + mkdir -p "${DESTDIR}"/"${BUILD}"-builds/${DATE}/log + + # Moving logs + mv "${TEMPDIR}"/debian-live/log.txt "${DESTDIR}"/"${BUILD}"-builds/${DATE}/log/debian-live-${DISTRIBUTION}-${ARCHITECTURE}-${PACKAGES_LIST}_${DATE}-iso-log.txt + mv "${TEMPDIR}"/debian-live/packages.txt "${DESTDIR}"/"${BUILD}"-builds/${DATE}/log/debian-live-${DISTRIBUTION}-${ARCHITECTURE}-${PACKAGES_LIST}_${DATE}-iso-packages.txt + + # Creating images directory + mkdir -p "${DESTDIR}"/"${BUILD}"-builds/${DATE}/${ARCHITECTURE} + mkdir -p "${DESTDIR}"/"${BUILD}"-builds/${DATE}/source + + # Moving images + mv "${TEMPDIR}"/debian-live/binary.iso "${DESTDIR}"/"${BUILD}"-builds/${DATE}/${ARCHITECTURE}/debian-live-${DISTRIBUTION}-${ARCHITECTURE}-${PACKAGES_LIST}.iso + mv "${TEMPDIR}"/debian-live/source.tar "${DESTDIR}"/"${BUILD}"-builds/${DATE}/source/debian-live-${DISTRIBUTION}-source-${PACKAGES_LIST}.tar + fi + + if [ ! -f "${DESTDIR}"/"${BUILD}"-builds/${DATE}/log/debian-live-${DISTRIBUTION}-${ARCHITECTURE}-${PACKAGES_LIST}_${DATE}-usb-hdd-log.txt ] + then + # Workaround of missing multi-binary support in live-helper + mv "${TEMPDIR}"/debian-live/binary/casper "${TEMPDIR}"/debian-live/casper.tmp + rm -rf "${TEMPDIR}"/debian-live/binary* "${TEMPDIR}"/debian-live/.stage/binary_* + mkdir "${TEMPDIR}"/debian-live/binary + mv "${TEMPDIR}"/debian-live/casper.tmp "${TEMPDIR}"/debian-live/binary/casper + touch "${TEMPDIR}"/debian-live/.stage/binary_chroot + touch "${TEMPDIR}"/debian-live/.stage/binary_rootfs + + # Creating build directory + mkdir -p "${TEMPDIR}"/debian-live + + cd "${TEMPDIR}" + echo "Begin: `date -R`" > "${TEMPDIR}"/debian-live/log.txt + + # Generating images + make-live -b usb-hdd -s generic --distribution ${DISTRIBUTION} --packages-lists ${PACKAGES_LIST} --mirror-bootstrap ${MIRROR_BOOTSTRAP} --mirror-bootstrap-security ${MIRROR_BOOTSTRAP_SECURITY} --mirror-binary ${MIRROR_BINARY} --mirror-binary-security ${MIRROR_BINARY_SECURITY} --source disabled ${OPTIONS} >> "${TEMPDIR}"/debian-live/log.txt 2>&1 + + echo "End: `date -R`" >> "${TEMPDIR}"/debian-live/log.txt + fi + + if [ -f "${TEMPDIR}"/debian-live/binary.img ] + then + # Creating log directory + mkdir -p "${DESTDIR}"/"${BUILD}"-builds/${DATE}/log + + # Moving logs + mv "${TEMPDIR}"/debian-live/log.txt "${DESTDIR}"/"${BUILD}"-builds/${DATE}/log/debian-live-${DISTRIBUTION}-${ARCHITECTURE}-${PACKAGES_LIST}_${DATE}-usb-hdd-log.txt + cp "${DESTDIR}"/"${BUILD}"-builds/${DATE}/log/debian-live-${DISTRIBUTION}-${ARCHITECTURE}-${PACKAGES_LIST}_${DATE}-iso-packages.txt "${DESTDIR}"/"${BUILD}"-builds/${DATE}/log/debian-live-${DISTRIBUTION}-${ARCHITECTURE}-${PACKAGES_LIST}_${DATE}-usb-hdd-packages.txt + + # Creating image directory + mkdir -p "${DESTDIR}"/"${BUILD}"-builds/${DATE}/${ARCHITECTURE} + + # Moving images + mv "${TEMPDIR}"/debian-live/binary.img "${DESTDIR}"/"${BUILD}"-builds/${DATE}/${ARCHITECTURE}/debian-live-${DISTRIBUTION}-${ARCHITECTURE}-${PACKAGES_LIST}.img + fi + + # Cleanup + cd "${TEMPDIR}"/debian-live + lh_clean + done + + # Cleanup + cd "${TEMPDIR}"/debian-live + lh_clean purge + done +done + +# Cleaning up +if [ -f "${TEMPDIR}"/debian-live/chroot/proc/version ] +then + umount "${TEMPDIR}"/debian-live/chroot/proc +fi + +if [ -d "${TEMPDIR}"/debian-live/chroot/sys/kernel ] +then + umount "${TEMPDIR}"/debian-live/chroot/sys +fi + +# Removing build directory +rm -rf "${TEMPDIR}" + +# Creating md5sums +for DIRECTORY in "${DESTDIR}"/"${BUILD}"-builds/${DATE}/* +do + cd "${DIRECTORY}" + md5sum * > MD5SUMS +done + +# Creating current symlink +rm -f "${DESTDIR}"/"${BUILD}"-builds/current +ln -s ${DATE} "${DESTDIR}"/"${BUILD}"-builds/current diff --git a/examples/cron/etch+beryl.sh b/examples/cron/etch+beryl.sh new file mode 100755 index 000000000..a3d3defc7 --- /dev/null +++ b/examples/cron/etch+beryl.sh @@ -0,0 +1,175 @@ +#!/bin/sh -x + +set -e + +BUILD="etch+beryl" + +# Begin custom defaults +AUTOBUILD="enabled" + +DATE="r0_1.0~a10-1" +DESTDIR="/srv/debian-unofficial/ftp/debian-live" +TEMPDIR="/srv/tmp/live-helper" + +OPTIONS="--binary-indices disabled" + +ARCHITECTURES="`dpkg --print-architecture`" +DISTRIBUTIONS="etch" +MIRROR_BOOTSTRAP="http://ftp.de.debian.org/debian/" +MIRROR_BOOTSTRAP_SECURITY="http://ftp.de.debian.org/debian-security/" +MIRROR_BINARY="http://ftp.debian.org/debian/" +MIRROR_BINARY_SECURITY="http://security.debian.org/" +PACKAGES_LISTS="standard gnome-desktop kde-desktop xfce-desktop" +# End custom defaults + +# Checking for live-helper availability +if [ ! -x /usr/bin/make-live ] +then + exit 0 +fi + +# Checking for live-helper defaults +#if [ -r /etc/default/live-helper ] +#then +# . /etc/default/live-helper +#else +# echo "E: /etc/default/live-helper missing." +# exit 1 +#fi + +# Checking for autobuild +if [ "${AUTOBUILD}" != "enabled" ] +then + exit 0 +fi + +# Checking for build directory +if [ ! -d "${TEMPDIR}" ] +then + mkdir -p "${TEMPDIR}"/debian-live +else + # FIXME: maybe we should just remove the left overs. + echo "E: ${TEMPDIR} needs cleanup." + exit 1 +fi + +for ARCHITECTURE in ${ARCHITECTURES} +do + for DISTRIBUTION in ${DISTRIBUTIONS} + do + for PACKAGES_LIST in ${PACKAGES_LISTS} + do + if [ ! -f "${DESTDIR}"/"${BUILD}"-builds/${DATE}/log/debian-live-etch+beryl-${ARCHITECTURE}-${PACKAGES_LIST}_${DATE}-iso-log.txt ] + then + # Creating build directory + mkdir -p "${TEMPDIR}"/debian-live + + cd "${TEMPDIR}" + echo "Begin: `date -R`" > "${TEMPDIR}"/debian-live/log.txt + + # Beryl hook + mkdir -p debian-live/config/chroot_local-hooks + cp /usr/share/live-helper/examples/hooks/beryl.sh debian-live/config/chroot_local-hooks/beryl.sh + mkdir -p debian-live/config/chroot_sources + wget http://debian.beryl-project.org/root@lupine.me.uk.gpg -O debian-live/config/chroot_sources/beryl.build.gpg + wget http://debian.beryl-project.org/root@lupine.me.uk.gpg -O debian-live/config/chroot_sources/beryl.image.gpg + cp /usr/share/live-helper/examples/sources.list/beryl debian-live/config/chroot_sources/beryl.build + cp /usr/share/live-helper/examples/sources.list/beryl debian-live/config/chroot_sources/beryl.image + + # Generating images + make-live -b iso -s generic --distribution ${DISTRIBUTION} --packages-lists ${PACKAGES_LIST} --mirror-bootstrap ${MIRROR_BOOTSTRAP} --mirror-bootstrap-security ${MIRROR_BOOTSTRAP_SECURITY} --mirror-binary ${MIRROR_BINARY} --mirror-binary-security ${MIRROR_BINARY_SECURITY} --source enabled ${OPTIONS} >> "${TEMPDIR}"/debian-live/log.txt 2>&1 + + echo "End: `date -R`" >> "${TEMPDIR}"/debian-live/log.txt + fi + + if [ -f "${TEMPDIR}"/debian-live/binary.iso ] && [ -f "${TEMPDIR}"/debian-live/source.tar ] + then + # Creating log directory + mkdir -p "${DESTDIR}"/"${BUILD}"-builds/${DATE}/log + + # Moving logs + mv "${TEMPDIR}"/debian-live/log.txt "${DESTDIR}"/"${BUILD}"-builds/${DATE}/log/debian-live-etch+beryl-${ARCHITECTURE}-${PACKAGES_LIST}_${DATE}-iso-log.txt + mv "${TEMPDIR}"/debian-live/packages.txt "${DESTDIR}"/"${BUILD}"-builds/${DATE}/log/debian-live-etch+beryl-${ARCHITECTURE}-${PACKAGES_LIST}_${DATE}-iso-packages.txt + + # Creating images directory + mkdir -p "${DESTDIR}"/"${BUILD}"-builds/${DATE}/${ARCHITECTURE} + mkdir -p "${DESTDIR}"/"${BUILD}"-builds/${DATE}/source + + # Moving images + mv "${TEMPDIR}"/debian-live/binary.iso "${DESTDIR}"/"${BUILD}"-builds/${DATE}/${ARCHITECTURE}/debian-live-etch+beryl-${ARCHITECTURE}-${PACKAGES_LIST}.iso + mv "${TEMPDIR}"/debian-live/source.tar "${DESTDIR}"/"${BUILD}"-builds/${DATE}/source/debian-live-etch+beryl-source-${PACKAGES_LIST}.tar + fi + + if [ ! -f "${DESTDIR}"/"${BUILD}"-builds/${DATE}/log/debian-live-etch+beryl-${ARCHITECTURE}-${PACKAGES_LIST}_${DATE}-usb-hdd-log.txt ] + then + # Workaround of missing multi-binary support in live-helper + mv "${TEMPDIR}"/debian-live/binary/casper "${TEMPDIR}"/debian-live/casper.tmp + rm -rf "${TEMPDIR}"/debian-live/binary* "${TEMPDIR}"/debian-live/.stage/binary_* + mkdir "${TEMPDIR}"/debian-live/binary + mv "${TEMPDIR}"/debian-live/casper.tmp "${TEMPDIR}"/debian-live/binary/casper + touch "${TEMPDIR}"/debian-live/.stage/binary_chroot + touch "${TEMPDIR}"/debian-live/.stage/binary_rootfs + + # Creating build directory + mkdir -p "${TEMPDIR}"/debian-live + + cd "${TEMPDIR}" + echo "Begin: `date -R`" > "${TEMPDIR}"/debian-live/log.txt + + # Generating images + make-live -b usb-hdd -s generic --distribution ${DISTRIBUTION} --packages-lists ${PACKAGES_LIST} --mirror-bootstrap ${MIRROR_BOOTSTRAP} --mirror-bootstrap-security ${MIRROR_BOOTSTRAP_SECURITY} --mirror-binary ${MIRROR_BINARY} --mirror-binary-security ${MIRROR_BINARY_SECURITY} --source disabled ${OPTIONS} >> "${TEMPDIR}"/debian-live/log.txt 2>&1 + + echo "End: `date -R`" >> "${TEMPDIR}"/debian-live/log.txt + fi + + if [ -f "${TEMPDIR}"/debian-live/binary.img ] + then + # Creating log directory + mkdir -p "${DESTDIR}"/"${BUILD}"-builds/${DATE}/log + + # Moving logs + mv "${TEMPDIR}"/debian-live/log.txt "${DESTDIR}"/"${BUILD}"-builds/${DATE}/log/debian-live-etch+beryl-${ARCHITECTURE}-${PACKAGES_LIST}_${DATE}-usb-hdd-log.txt + cp "${DESTDIR}"/"${BUILD}"-builds/${DATE}/log/debian-live-etch+beryl-${ARCHITECTURE}-${PACKAGES_LIST}_${DATE}-iso-packages.txt "${DESTDIR}"/"${BUILD}"-builds/${DATE}/log/debian-live-etch+beryl-${ARCHITECTURE}-${PACKAGES_LIST}_${DATE}-usb-hdd-packages.txt + + # Creating image directory + mkdir -p "${DESTDIR}"/"${BUILD}"-builds/${DATE}/${ARCHITECTURE} + + # Moving images + mv "${TEMPDIR}"/debian-live/binary.img "${DESTDIR}"/"${BUILD}"-builds/${DATE}/${ARCHITECTURE}/debian-live-etch+beryl-${ARCHITECTURE}-${PACKAGES_LIST}.img + fi + + # Cleanup + cd "${TEMPDIR}"/debian-live + lh_clean + done + + # Cleanup + cd "${TEMPDIR}"/debian-live + lh_clean purge + done +done + +# Cleaning up +if [ -f "${TEMPDIR}"/debian-live/chroot/proc/version ] +then + umount "${TEMPDIR}"/debian-live/chroot/proc +fi + +if [ -d "${TEMPDIR}"/debian-live/chroot/sys/kernel ] +then + umount "${TEMPDIR}"/debian-live/chroot/sys +fi + +# Removing build directory +rm -rf "${TEMPDIR}" + +# Creating md5sums +for DIRECTORY in "${DESTDIR}"/"${BUILD}"-builds/${DATE}/* +do + cd "${DIRECTORY}" + md5sum * > MD5SUMS +done + +# Creating current symlink +rm -f "${DESTDIR}"/"${BUILD}"-builds/current +ln -s ${DATE} "${DESTDIR}"/"${BUILD}"-builds/current diff --git a/examples/cron/etch.sh b/examples/cron/etch.sh new file mode 100755 index 000000000..a53452c44 --- /dev/null +++ b/examples/cron/etch.sh @@ -0,0 +1,166 @@ +#!/bin/sh -x + +set -e + +BUILD="etch" + +# Begin custom defaults +AUTOBUILD="enabled" + +DATE="r0_1.0~a10-1" +DESTDIR="/srv/debian-unofficial/ftp/debian-live" +TEMPDIR="/srv/tmp/live-helper" + +OPTIONS="--binary-indices disabled" + +ARCHITECTURES="`dpkg --print-architecture`" +DISTRIBUTIONS="etch" +MIRROR_BOOTSTRAP="http://ftp.de.debian.org/debian/" +MIRROR_BOOTSTRAP_SECURITY="http://ftp.de.debian.org/debian-security/" +MIRROR_BINARY="http://ftp.debian.org/debian/" +MIRROR_BINARY_SECURITY="http://security.debian.org/" +PACKAGES_LISTS="standard gnome-desktop kde-desktop xfce-desktop" +# End custom defaults + +# Checking for live-helper availability +if [ ! -x /usr/bin/make-live ] +then + exit 0 +fi + +# Checking for live-helper defaults +#if [ -r /etc/default/live-helper ] +#then +# . /etc/default/live-helper +#else +# echo "E: /etc/default/live-helper missing." +# exit 1 +#fi + +# Checking for autobuild +if [ "${AUTOBUILD}" != "enabled" ] +then + exit 0 +fi + +# Checking for build directory +if [ ! -d "${TEMPDIR}" ] +then + mkdir -p "${TEMPDIR}"/debian-live +else + # FIXME: maybe we should just remove the left overs. + echo "E: ${TEMPDIR} needs cleanup." + exit 1 +fi + +for ARCHITECTURE in ${ARCHITECTURES} +do + for DISTRIBUTION in ${DISTRIBUTIONS} + do + for PACKAGES_LIST in ${PACKAGES_LISTS} + do + if [ ! -f "${DESTDIR}"/"${BUILD}"-builds/${DATE}/log/debian-live-${DISTRIBUTION}-${ARCHITECTURE}-${PACKAGES_LIST}_${DATE}-iso-log.txt ] + then + # Creating build directory + mkdir -p "${TEMPDIR}"/debian-live + + cd "${TEMPDIR}" + echo "Begin: `date -R`" > "${TEMPDIR}"/debian-live/log.txt + + # Generating images + make-live -b iso -s generic --distribution ${DISTRIBUTION} --packages-lists ${PACKAGES_LIST} --mirror-bootstrap ${MIRROR_BOOTSTRAP} --mirror-bootstrap-security ${MIRROR_BOOTSTRAP_SECURITY} --mirror-binary ${MIRROR_BINARY} --mirror-binary-security ${MIRROR_BINARY_SECURITY} --source enabled ${OPTIONS} >> "${TEMPDIR}"/debian-live/log.txt 2>&1 + + echo "End: `date -R`" >> "${TEMPDIR}"/debian-live/log.txt + fi + + if [ -f "${TEMPDIR}"/debian-live/binary.iso ] && [ -f "${TEMPDIR}"/debian-live/source.tar ] + then + # Creating log directory + mkdir -p "${DESTDIR}"/"${BUILD}"-builds/${DATE}/log + + # Moving logs + mv "${TEMPDIR}"/debian-live/log.txt "${DESTDIR}"/"${BUILD}"-builds/${DATE}/log/debian-live-${DISTRIBUTION}-${ARCHITECTURE}-${PACKAGES_LIST}_${DATE}-iso-log.txt + mv "${TEMPDIR}"/debian-live/packages.txt "${DESTDIR}"/"${BUILD}"-builds/${DATE}/log/debian-live-${DISTRIBUTION}-${ARCHITECTURE}-${PACKAGES_LIST}_${DATE}-iso-packages.txt + + # Creating images directory + mkdir -p "${DESTDIR}"/"${BUILD}"-builds/${DATE}/${ARCHITECTURE} + mkdir -p "${DESTDIR}"/"${BUILD}"-builds/${DATE}/source + + # Moving images + mv "${TEMPDIR}"/debian-live/binary.iso "${DESTDIR}"/"${BUILD}"-builds/${DATE}/${ARCHITECTURE}/debian-live-${DISTRIBUTION}-${ARCHITECTURE}-${PACKAGES_LIST}.iso + mv "${TEMPDIR}"/debian-live/source.tar "${DESTDIR}"/"${BUILD}"-builds/${DATE}/source/debian-live-${DISTRIBUTION}-source-${PACKAGES_LIST}.tar + fi + + if [ ! -f "${DESTDIR}"/"${BUILD}"-builds/${DATE}/log/debian-live-${DISTRIBUTION}-${ARCHITECTURE}-${PACKAGES_LIST}_${DATE}-usb-hdd-log.txt ] + then + # Workaround of missing multi-binary support in live-helper + mv "${TEMPDIR}"/debian-live/binary/casper "${TEMPDIR}"/debian-live/casper.tmp + rm -rf "${TEMPDIR}"/debian-live/binary* "${TEMPDIR}"/debian-live/.stage/binary_* + mkdir "${TEMPDIR}"/debian-live/binary + mv "${TEMPDIR}"/debian-live/casper.tmp "${TEMPDIR}"/debian-live/binary/casper + touch "${TEMPDIR}"/debian-live/.stage/binary_chroot + touch "${TEMPDIR}"/debian-live/.stage/binary_rootfs + + # Creating build directory + mkdir -p "${TEMPDIR}"/debian-live + + cd "${TEMPDIR}" + echo "Begin: `date -R`" > "${TEMPDIR}"/debian-live/log.txt + + # Generating images + make-live -b usb-hdd -s generic --distribution ${DISTRIBUTION} --packages-lists ${PACKAGES_LIST} --mirror-bootstrap ${MIRROR_BOOTSTRAP} --mirror-bootstrap-security ${MIRROR_BOOTSTRAP_SECURITY} --mirror-binary ${MIRROR_BINARY} --mirror-binary-security ${MIRROR_BINARY_SECURITY} --source disabled ${OPTIONS} >> "${TEMPDIR}"/debian-live/log.txt 2>&1 + + echo "End: `date -R`" >> "${TEMPDIR}"/debian-live/log.txt + fi + + if [ -f "${TEMPDIR}"/debian-live/binary.img ] + then + # Creating log directory + mkdir -p "${DESTDIR}"/"${BUILD}"-builds/${DATE}/log + + # Moving logs + mv "${TEMPDIR}"/debian-live/log.txt "${DESTDIR}"/"${BUILD}"-builds/${DATE}/log/debian-live-${DISTRIBUTION}-${ARCHITECTURE}-${PACKAGES_LIST}_${DATE}-usb-hdd-log.txt + cp "${DESTDIR}"/"${BUILD}"-builds/${DATE}/log/debian-live-${DISTRIBUTION}-${ARCHITECTURE}-${PACKAGES_LIST}_${DATE}-iso-packages.txt "${DESTDIR}"/"${BUILD}"-builds/${DATE}/log/debian-live-${DISTRIBUTION}-${ARCHITECTURE}-${PACKAGES_LIST}_${DATE}-usb-hdd-packages.txt + + # Creating image directory + mkdir -p "${DESTDIR}"/"${BUILD}"-builds/${DATE}/${ARCHITECTURE} + + # Moving images + mv "${TEMPDIR}"/debian-live/binary.img "${DESTDIR}"/"${BUILD}"-builds/${DATE}/${ARCHITECTURE}/debian-live-${DISTRIBUTION}-${ARCHITECTURE}-${PACKAGES_LIST}.img + fi + + # Cleanup + cd "${TEMPDIR}"/debian-live + lh_clean + done + + # Cleanup + cd "${TEMPDIR}"/debian-live + lh_clean purge + done +done + +# Cleaning up +if [ -f "${TEMPDIR}"/debian-live/chroot/proc/version ] +then + umount "${TEMPDIR}"/debian-live/chroot/proc +fi + +if [ -d "${TEMPDIR}"/debian-live/chroot/sys/kernel ] +then + umount "${TEMPDIR}"/debian-live/chroot/sys +fi + +# Removing build directory +rm -rf "${TEMPDIR}" + +# Creating md5sums +for DIRECTORY in "${DESTDIR}"/"${BUILD}"-builds/${DATE}/* +do + cd "${DIRECTORY}" + md5sum * > MD5SUMS +done + +# Creating current symlink +rm -f "${DESTDIR}"/"${BUILD}"-builds/current +ln -s ${DATE} "${DESTDIR}"/"${BUILD}"-builds/current diff --git a/examples/cron/snapshots.sh b/examples/cron/snapshots.sh new file mode 100755 index 000000000..199dc2902 --- /dev/null +++ b/examples/cron/snapshots.sh @@ -0,0 +1,130 @@ +#!/bin/sh + +# Needs: build-essential fakeroot lsb-release svn [...] + +# Static variables +PACKAGES="live-helper live-initramfs live-webbuilder" + +DEBEMAIL="debian-live-devel@lists.alioth.debian.org" +EMAIL="debian-live-devel@lists.alioth.debian.org" +DEBFULLNAME="Debian Live Autobuilder" +NAME="Debian Live Autobuilder" + +export DEBEMAIL EMAIL DEBFULLNAME NAME + +TEMPDIR="/srv/tmp/svn-snapshots" +SERVER="/srv/debian-unofficial/ftp/debian-live/debian-snapshots" + +DATE_START="`date -R`" + +# Checking lock file +if [ -f "${SERVER}"/Archive-Update-in-Progress ] +then + echo "E: locked." + exit 1 +fi + +# Creating server directory +if [ ! -d "${SERVER}" ] +then + mkdir -p "${SERVER}" +fi + +# Creating lock trap +trap "test -f ${SERVER}/Archive-Update-in-Progress && rm -f ${SERVER}/Archive-Update-in-Progress; exit 0" 0 1 2 3 9 15 + +# Creating lock file +echo "${DATE_START}" > "${SERVER}"/Archive-Update-in-Progress + +# Processing packages +for PACKAGE in ${PACKAGES} +do + # Cleaning build directory + if [ -d "${TEMPDIR}" ] + then + rm -rf "${TEMPDIR}" + fi + + # Creating build directory + mkdir -p "${TEMPDIR}" + + # Getting sources + cd "${TEMPDIR}" + svn co svn://svn.debian.org/debian-live/dists/trunk/${PACKAGE} ${PACKAGE} + + # Getting version + cd "${TEMPDIR}"/${PACKAGE} + VERSION="`dpkg-parsechangelog | awk '/Version:/ { print $2 }' | awk -F- '{ print $1 }'`" + + # Getting revision + cd "${TEMPDIR}"/${PACKAGE} + REVISION="`svn info | awk '/Last Changed Rev:/ { print $4 }'`" + + # Check for existing package + if [ ! -f "${SERVER}"/${PACKAGE}_${VERSION}~${REVISION}.dsc ] || [ "${1}" = "--force" ] + then + UPDATE_INDICES="true" + + # Renaming directory + mv "${TEMPDIR}"/${PACKAGE} "${TEMPDIR}"/${PACKAGE}-${VERSION}~${REVISION} + + # Building package + cd "${TEMPDIR}"/${PACKAGE}-${VERSION}~${REVISION} + find . -type d -name .svn | xargs rm -rf + dch --force-bad-version --newversion ${VERSION}~${REVISION} --distribution UNRELEASED Autobuild snapshot of SVN r${REVISION}. + dpkg-buildpackage -rfakeroot -sa -uc -us + + # Removing sources + rm -rf "${TEMPDIR}"/${PACKAGE}-${VERSION}~${REVISION} + + # Creating directory + if [ ! -d "${SERVER}" ] + then + mkdir -p "${SERVER}" + fi + + # Removing old packages + if ls "${SERVER}"/"${PACKAGE}"* &> /dev/null + then + rm -f "${SERVER}"/"${PACKAGE}"* + fi + + # Moving packages + mv "${TEMPDIR}"/${PACKAGE}* "${SERVER}" + else + # Remove sources + rm -rf "${TEMPDIR}"/${PACKAGE} + fi +done + +if [ "${UPDATE_INDICES}" = "true" ] +then + LAST_UPDATE="`date -R`" + + cd "${SERVER}" + + # Updating binary indices + apt-ftparchive packages ./ > Packages + gzip -9 -c Packages > Packages.gz + + # Updating source indices + apt-ftparchive sources ./ > Sources + gzip -9 -c Sources > Sources.gz +fi + +# Reading timestamp +if [ -z "${LAST_UPDATE}" ] +then + LAST_UPDATE="`awk -F: '/Last update:/ { print $2":"$3":"$4 }' ${SERVER}/LAST_BUILD | sed -e 's/ //'`" +fi + +# Writing timestamp +cat > "${SERVER}"/LAST_BUILD << EOF +Last run begin: ${DATE_START} +Last run end: `date -R` + +Last update: ${LAST_UPDATE} +EOF + +# Removing build directory +rm -rf "${TEMPDIR}" diff --git a/examples/cron/weekly.sh b/examples/cron/weekly.sh new file mode 100755 index 000000000..98bd7ffff --- /dev/null +++ b/examples/cron/weekly.sh @@ -0,0 +1,166 @@ +#!/bin/sh -x + +set -e + +BUILD="weekly" + +# Begin custom defaults +AUTOBUILD="enabled" + +DATE="`date +%Y%m%d`" +DESTDIR="/srv/debian-unofficial/ftp/debian-live" +TEMPDIR="/srv/tmp/live-helper" + +OPTIONS="--binary-indices disabled" + +ARCHITECTURES="`dpkg --print-architecture`" +DISTRIBUTIONS="lenny" +MIRROR_BOOTSTRAP="http://ftp.de.debian.org/debian/" +MIRROR_BOOTSTRAP_SECURITY="http://ftp.de.debian.org/debian-security/" +MIRROR_BINARY="http://ftp.debian.org/debian/" +MIRROR_BINARY_SECURITY="http://security.debian.org/" +PACKAGES_LISTS="standard gnome-desktop kde-desktop xfce-desktop" +# End custom defaults + +# Checking for live-helper availability +if [ ! -x /usr/bin/make-live ] +then + exit 0 +fi + +# Checking for live-helper defaults +#if [ -r /etc/default/live-helper ] +#then +# . /etc/default/live-helper +#else +# echo "E: /etc/default/live-helper missing." +# exit 1 +#fi + +# Checking for autobuild +if [ "${AUTOBUILD}" != "enabled" ] +then + exit 0 +fi + +# Checking for build directory +if [ ! -d "${TEMPDIR}" ] +then + mkdir -p "${TEMPDIR}"/debian-live +else + # FIXME: maybe we should just remove the left overs. + echo "E: ${TEMPDIR} needs cleanup." + exit 1 +fi + +for ARCHITECTURE in ${ARCHITECTURES} +do + for DISTRIBUTION in ${DISTRIBUTIONS} + do + for PACKAGES_LIST in ${PACKAGES_LISTS} + do + if [ ! -f "${DESTDIR}"/"${BUILD}"-builds/${DATE}/log/debian-live-${DISTRIBUTION}-${ARCHITECTURE}-${PACKAGES_LIST}_${DATE}-iso-log.txt ] + then + # Creating build directory + mkdir -p "${TEMPDIR}"/debian-live + + cd "${TEMPDIR}" + echo "Begin: `date -R`" > "${TEMPDIR}"/debian-live/log.txt + + # Generating images + make-live -b iso -s generic --distribution ${DISTRIBUTION} --packages-lists ${PACKAGES_LIST} --mirror-bootstrap ${MIRROR_BOOTSTRAP} --mirror-bootstrap-security ${MIRROR_BOOTSTRAP_SECURITY} --mirror-binary ${MIRROR_BINARY} --mirror-binary-security ${MIRROR_BINARY_SECURITY} --source enabled ${OPTIONS} >> "${TEMPDIR}"/debian-live/log.txt 2>&1 + + echo "End: `date -R`" >> "${TEMPDIR}"/debian-live/log.txt + fi + + if [ -f "${TEMPDIR}"/debian-live/binary.iso ] && [ -f "${TEMPDIR}"/debian-live/source.tar ] + then + # Creating log directory + mkdir -p "${DESTDIR}"/"${BUILD}"-builds/${DATE}/log + + # Moving logs + mv "${TEMPDIR}"/debian-live/log.txt "${DESTDIR}"/"${BUILD}"-builds/${DATE}/log/debian-live-${DISTRIBUTION}-${ARCHITECTURE}-${PACKAGES_LIST}_${DATE}-iso-log.txt + mv "${TEMPDIR}"/debian-live/packages.txt "${DESTDIR}"/"${BUILD}"-builds/${DATE}/log/debian-live-${DISTRIBUTION}-${ARCHITECTURE}-${PACKAGES_LIST}_${DATE}-iso-packages.txt + + # Creating images directory + mkdir -p "${DESTDIR}"/"${BUILD}"-builds/${DATE}/${ARCHITECTURE} + mkdir -p "${DESTDIR}"/"${BUILD}"-builds/${DATE}/source + + # Moving images + mv "${TEMPDIR}"/debian-live/binary.iso "${DESTDIR}"/"${BUILD}"-builds/${DATE}/${ARCHITECTURE}/debian-live-${DISTRIBUTION}-${ARCHITECTURE}-${PACKAGES_LIST}.iso + mv "${TEMPDIR}"/debian-live/source.tar "${DESTDIR}"/"${BUILD}"-builds/${DATE}/source/debian-live-${DISTRIBUTION}-source-${PACKAGES_LIST}.tar + fi + + if [ ! -f "${DESTDIR}"/"${BUILD}"-builds/${DATE}/log/debian-live-${DISTRIBUTION}-${ARCHITECTURE}-${PACKAGES_LIST}_${DATE}-usb-hdd-log.txt ] + then + # Workaround of missing multi-binary support in live-helper + mv "${TEMPDIR}"/debian-live/binary/casper "${TEMPDIR}"/debian-live/casper.tmp + rm -rf "${TEMPDIR}"/debian-live/binary* "${TEMPDIR}"/debian-live/.stage/binary_* + mkdir "${TEMPDIR}"/debian-live/binary + mv "${TEMPDIR}"/debian-live/casper.tmp "${TEMPDIR}"/debian-live/binary/casper + touch "${TEMPDIR}"/debian-live/.stage/binary_chroot + touch "${TEMPDIR}"/debian-live/.stage/binary_rootfs + + # Creating build directory + mkdir -p "${TEMPDIR}"/debian-live + + cd "${TEMPDIR}" + echo "Begin: `date -R`" > "${TEMPDIR}"/debian-live/log.txt + + # Generating images + make-live -b usb-hdd -s generic --distribution ${DISTRIBUTION} --packages-lists ${PACKAGES_LIST} --mirror-bootstrap ${MIRROR_BOOTSTRAP} --mirror-bootstrap-security ${MIRROR_BOOTSTRAP_SECURITY} --mirror-binary ${MIRROR_BINARY} --mirror-binary-security ${MIRROR_BINARY_SECURITY} --source disabled ${OPTIONS} >> "${TEMPDIR}"/debian-live/log.txt 2>&1 + + echo "End: `date -R`" >> "${TEMPDIR}"/debian-live/log.txt + fi + + if [ -f "${TEMPDIR}"/debian-live/binary.img ] + then + # Creating log directory + mkdir -p "${DESTDIR}"/"${BUILD}"-builds/${DATE}/log + + # Moving logs + mv "${TEMPDIR}"/debian-live/log.txt "${DESTDIR}"/"${BUILD}"-builds/${DATE}/log/debian-live-${DISTRIBUTION}-${ARCHITECTURE}-${PACKAGES_LIST}_${DATE}-usb-hdd-log.txt + cp "${DESTDIR}"/"${BUILD}"-builds/${DATE}/log/debian-live-${DISTRIBUTION}-${ARCHITECTURE}-${PACKAGES_LIST}_${DATE}-iso-packages.txt "${DESTDIR}"/"${BUILD}"-builds/${DATE}/log/debian-live-${DISTRIBUTION}-${ARCHITECTURE}-${PACKAGES_LIST}_${DATE}-usb-hdd-packages.txt + + # Creating image directory + mkdir -p "${DESTDIR}"/"${BUILD}"-builds/${DATE}/${ARCHITECTURE} + + # Moving images + mv "${TEMPDIR}"/debian-live/binary.img "${DESTDIR}"/"${BUILD}"-builds/${DATE}/${ARCHITECTURE}/debian-live-${DISTRIBUTION}-${ARCHITECTURE}-${PACKAGES_LIST}.img + fi + + # Cleanup + cd "${TEMPDIR}"/debian-live + lh_clean + done + + # Cleanup + cd "${TEMPDIR}"/debian-live + lh_clean purge + done +done + +# Cleaning up +if [ -f "${TEMPDIR}"/debian-live/chroot/proc/version ] +then + umount "${TEMPDIR}"/debian-live/chroot/proc +fi + +if [ -d "${TEMPDIR}"/debian-live/chroot/sys/kernel ] +then + umount "${TEMPDIR}"/debian-live/chroot/sys +fi + +# Removing build directory +rm -rf "${TEMPDIR}" + +# Creating md5sums +for DIRECTORY in "${DESTDIR}"/"${BUILD}"-builds/${DATE}/* +do + cd "${DIRECTORY}" + md5sum * > MD5SUMS +done + +# Creating current symlink +rm -f "${DESTDIR}"/"${BUILD}"-builds/current +ln -s ${DATE} "${DESTDIR}"/"${BUILD}"-builds/current |