2007-09-23 08:05:09 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
2007-09-23 08:05:21 +00:00
|
|
|
# Needs: build-essential fakeroot lsb-release git-core [...]
|
2007-09-23 08:05:09 +00:00
|
|
|
|
|
|
|
# Static variables
|
2007-09-23 14:17:32 +00:00
|
|
|
PACKAGES="live-helper live-initramfs live-initscripts live-webhelper"
|
2007-09-23 08:05:09 +00:00
|
|
|
|
|
|
|
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
|
|
|
|
|
2007-09-23 08:05:15 +00:00
|
|
|
TEMPDIR="/srv/tmp/snapshots"
|
2007-09-23 08:05:14 +00:00
|
|
|
SERVER="/srv/debian-unofficial/ftp/debian-live-snapshots"
|
2007-09-23 08:05:09 +00:00
|
|
|
|
2007-09-24 06:47:42 +00:00
|
|
|
DATE_START="$(date -R)"
|
2007-09-23 08:05:09 +00:00
|
|
|
|
|
|
|
# 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
|
|
|
|
|
2007-09-24 06:47:42 +00:00
|
|
|
echo "$(date +%b\ %d\ %H:%M:%S) ${HOSTNAME} live-helper: begin snapshot build." >> /var/log/live
|
2007-09-23 08:05:10 +00:00
|
|
|
|
2007-09-23 08:05:09 +00:00
|
|
|
# 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}"
|
2007-09-23 08:05:21 +00:00
|
|
|
git clone git://git.debian.org/git/users/daniel/${PACKAGE}.git
|
2007-09-23 08:05:09 +00:00
|
|
|
|
|
|
|
# Getting version
|
|
|
|
cd "${TEMPDIR}"/${PACKAGE}
|
2007-09-24 06:47:42 +00:00
|
|
|
VERSION="$(dpkg-parsechangelog | awk '/Version:/ { print $2 }' | awk -F- '{ print $1 }')"
|
2007-09-23 08:05:09 +00:00
|
|
|
|
|
|
|
# Getting revision
|
|
|
|
cd "${TEMPDIR}"/${PACKAGE}
|
2007-09-24 06:47:42 +00:00
|
|
|
REVISION="$(git log | grep -m1 Date | awk -FDate: '{ print $2 }' | sed -e 's/+.*$//')"
|
|
|
|
REVISION="$(date -d "${REVISION}" +%Y%m%d.%H%M%S)"
|
2007-09-23 08:05:09 +00:00
|
|
|
|
|
|
|
# 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}
|
2007-09-23 08:05:21 +00:00
|
|
|
rm -rf .git
|
2007-09-23 08:05:09 +00:00
|
|
|
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
|
2007-09-23 08:05:11 +00:00
|
|
|
mkdir -p "${SERVER}"
|
2007-09-23 08:05:09 +00:00
|
|
|
|
|
|
|
# Removing old packages
|
2007-09-23 11:59:18 +00:00
|
|
|
if [ -f "${SERVER}"/"${PACKAGE}"*.changes ]
|
|
|
|
then
|
2007-09-24 06:47:42 +00:00
|
|
|
for FILE in $(awk {'print $5'} "${SERVER}"/"${PACKAGE}"*.changes | grep -e ".*\.deb$" -e ".*\.diff.gz$" -e ".*\.dsc$" -e ".*\.tar.gz$" -e ".*\.udeb$")
|
2007-09-23 11:59:18 +00:00
|
|
|
do
|
|
|
|
rm -f "${SERVER}"/"${FILE}"
|
|
|
|
done
|
|
|
|
fi
|
2007-09-23 08:05:09 +00:00
|
|
|
|
2007-09-23 08:05:11 +00:00
|
|
|
rm -f "${SERVER}"/"${PACKAGE}"*.changes
|
|
|
|
|
|
|
|
# Installing new packages
|
2007-09-24 06:47:42 +00:00
|
|
|
for FILE in $(awk {'print $5'} "${TEMPDIR}"/"${PACKAGE}"*.changes | grep -e ".*\.deb$" -e ".*\.diff.gz$" -e ".*\.dsc$" -e ".*\.tar.gz$" -e ".*\.udeb$")
|
2007-09-23 08:05:11 +00:00
|
|
|
do
|
|
|
|
mv "${TEMPDIR}"/"${FILE}" "${SERVER}"
|
|
|
|
done
|
|
|
|
|
|
|
|
mv "${TEMPDIR}"/"${PACKAGE}"*.changes "${SERVER}"
|
2007-09-23 08:05:09 +00:00
|
|
|
else
|
|
|
|
# Remove sources
|
|
|
|
rm -rf "${TEMPDIR}"/${PACKAGE}
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
if [ "${UPDATE_INDICES}" = "true" ]
|
|
|
|
then
|
2007-09-24 06:47:42 +00:00
|
|
|
LAST_UPDATE="$(date -R)"
|
2007-09-23 08:05:09 +00:00
|
|
|
|
|
|
|
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
|
2007-09-24 06:47:42 +00:00
|
|
|
LAST_UPDATE="$(awk -F: '/Last update:/ { print $2":"$3":"$4 }' ${SERVER}/LAST_BUILD | sed -e 's/ //')"
|
2007-09-23 08:05:09 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
# Writing timestamp
|
|
|
|
cat > "${SERVER}"/LAST_BUILD << EOF
|
|
|
|
Last run begin: ${DATE_START}
|
2007-09-24 06:47:42 +00:00
|
|
|
Last run end: $(date -R)
|
2007-09-23 08:05:09 +00:00
|
|
|
|
|
|
|
Last update: ${LAST_UPDATE}
|
|
|
|
EOF
|
|
|
|
|
|
|
|
# Removing build directory
|
|
|
|
rm -rf "${TEMPDIR}"
|
2007-09-23 08:05:10 +00:00
|
|
|
|
2007-09-24 06:47:42 +00:00
|
|
|
echo "$(date +%b\ %d\ %H:%M:%S) ${HOSTNAME} live-helper: end snapshot build." >> /var/log/live
|