live-build/debian/cron.daily

155 lines
5.4 KiB
Plaintext
Raw Normal View History

2007-09-23 08:05:09 +00:00
#!/bin/sh
2007-09-23 08:04:51 +00:00
set -e
BUILD="daily"
2007-09-23 08:05:09 +00:00
# Checking for live-helper availability
2007-09-23 08:05:17 +00:00
if [ ! -x /usr/bin/lh_config ]
2007-09-23 08:04:51 +00:00
then
exit 0
fi
2007-09-23 08:05:09 +00:00
# Checking for live-helper defaults
2007-09-23 08:04:51 +00:00
if [ -r /etc/default/live-helper ]
then
. /etc/default/live-helper
else
echo "E: /etc/default/live-helper missing."
exit 1
fi
2007-09-23 08:05:09 +00:00
# Checking for autobuild
2007-09-23 08:04:51 +00:00
if [ "${AUTOBUILD}" != "enabled" ]
then
exit 0
fi
2007-09-23 08:05:09 +00:00
# Checking for build directory
if [ ! -d "${TEMPDIR}" ]
2007-09-23 08:04:51 +00:00
then
2007-09-23 08:05:09 +00:00
mkdir -p "${TEMPDIR}"/debian-live
2007-09-23 08:04:51 +00:00
else
# FIXME: maybe we should just remove the left overs.
2007-09-23 08:05:09 +00:00
echo "E: ${TEMPDIR} needs cleanup."
2007-09-23 08:04:51 +00:00
exit 1
fi
echo "$(date +%b\ %d\ %H:%M:%S) ${HOSTNAME} live-helper: begin daily build." >> /var/log/live
2007-09-23 08:05:10 +00:00
2007-09-23 08:05:09 +00:00
for ARCHITECTURE in ${ARCHITECTURES}
2007-09-23 08:04:51 +00:00
do
2007-09-23 08:05:09 +00:00
for DISTRIBUTION in ${DISTRIBUTIONS}
2007-09-23 08:04:51 +00:00
do
2007-09-23 08:05:09 +00:00
for PACKAGES_LIST in ${PACKAGES_LISTS}
2007-09-23 08:04:51 +00:00
do
2007-09-23 08:05:09 +00:00
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
2007-09-23 08:05:17 +00:00
cd "${TEMPDIR}"/debian-live
echo "Begin: $(date -R)" > "${TEMPDIR}"/debian-live/log.txt
2007-09-23 08:05:09 +00:00
# Generating images
2007-09-23 08:05:17 +00:00
lh_config -b iso -s tar --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}
lh_build >> "${TEMPDIR}"/debian-live/log.txt 2>&1
2007-09-23 08:05:09 +00:00
echo "End: $(date -R)" >> "${TEMPDIR}"/debian-live/log.txt
2007-09-23 08:05:09 +00:00
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
2007-09-23 08:05:17 +00:00
cd "${TEMPDIR}"/debian-live
echo "Begin: $(date -R)" > "${TEMPDIR}"/debian-live/log.txt
2007-09-23 08:05:09 +00:00
# Generating images
2007-09-23 08:05:17 +00:00
lh_config -b usb-hdd -s tar --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}
lh_build >> "${TEMPDIR}"/debian-live/log.txt 2>&1
2007-09-23 08:05:09 +00:00
echo "End: $(date -R)" >> "${TEMPDIR}"/debian-live/log.txt
2007-09-23 08:05:09 +00:00
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
2007-09-23 08:04:51 +00:00
done
2007-09-23 08:05:09 +00:00
# Cleanup
cd "${TEMPDIR}"/debian-live
lh_clean purge
2007-09-23 08:04:51 +00:00
done
done
2007-09-23 08:05:09 +00:00
# Cleaning up
if [ -f "${TEMPDIR}"/debian-live/chroot/proc/version ]
2007-09-23 08:04:51 +00:00
then
2007-09-23 08:05:09 +00:00
umount "${TEMPDIR}"/debian-live/chroot/proc
2007-09-23 08:04:51 +00:00
fi
2007-09-23 08:05:09 +00:00
if [ -d "${TEMPDIR}"/debian-live/chroot/sys/kernel ]
2007-09-23 08:04:51 +00:00
then
2007-09-23 08:05:09 +00:00
umount "${TEMPDIR}"/debian-live/chroot/sys
2007-09-23 08:04:51 +00:00
fi
2007-09-23 08:05:09 +00:00
# Removing build directory
rm -rf "${TEMPDIR}"
2007-09-23 08:04:51 +00:00
2007-09-23 08:05:09 +00:00
# Creating md5sums
for DIRECTORY in "${DESTDIR}"/"${BUILD}"-builds/${DATE}/*
2007-09-23 08:04:51 +00:00
do
cd "${DIRECTORY}"
md5sum * > MD5SUMS
done
2007-09-23 08:05:09 +00:00
# Creating current symlink
rm -f "${DESTDIR}"/"${BUILD}"-builds/current
ln -s ${DATE} "${DESTDIR}"/"${BUILD}"-builds/current
2007-09-23 08:05:10 +00:00
echo "$(date +%b\ %d\ %H:%M:%S) ${HOSTNAME} live-helper: end daily build." >> /var/log/live