summaryrefslogtreecommitdiff
path: root/debian/cron.daily
blob: f330e1f29c37c346b216588ae98f7acbb7c66d7a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/bin/sh

# Check for make-live executable
if [ ! -x /usr/sbin/make-live ]
then
	exit 0
fi

# Check for make-live default
if [ -r /etc/default/make-live ]
then
	. /etc/default/make-live
else
	echo "E: /etc/default/make-live missing."
	exit 1
fi

# Check for autobuild
if [ "${AUTOBUILD}" = "false" ]
then
	exit 0
fi

# Check for build directory
if [ ! -d "${AUTOBUILD_DIRECTORY}" ]
then
	mkdir -p "${AUTOBUILD_DIRECTORY}"
else
	# FIXME: maybe we should just remove the left overs.
	echo "E: ${AUTOBUILD_DIRECTORY} needs cleanup."
	exit 1
fi

# Process image autobuilding
cd "${AUTOBUILD_DIRECTORY}"

for DISTRIBUTION in ${AUTOBUILD_DISTRIBUTIONS}
do
	for FLAVOUR in ${AUTOBUILD_FLAVOURS}
	do
		if [ ! -f "${AUTOBUILD_SERVER}"/daily-release/${AUTOBUILD_DATE}/log/debian-live-${AUTOBUILD_DISTRIBUTION}-${AUTOBUILD_ARCHITECTURE}-${AUTOBUILD_FLAVOUR}_${AUTOBUILD_DATE}.txt ]
		then
			# Generating images
			mkdir debian-live
			make-live -d ${AUTOBUILD_DISTRIBUTION} -p ${AUTOBUILD_FLAVOUR} -m ${LIVE_MIRROR} ${AUTOBUILD_OPTIONS} > debian-live/log.txt 2>&1
		fi

		if [ -f debian-live/binary.iso ] && [ -f debian-live/source.iso ]
		then
			# Moving logs
			mkdir -p "${AUTOBUILD_SERVER}"/daily-release/${AUTOBUILD_DATE}/log
			mv debian-live/log.txt "${AUTOBUILD_SERVER}"/daily-release/${AUTOBUILD_DATE}/log/debian-live-${AUTOBUILD_DISTRIBUTION}-${AUTOBUILD_ARCHITECTURE}-${AUTOBUILD_FLAVOUR}_${AUTOBUILD_DATE}-log.txt
			mv debian-live/packages.txt "${AUTOBUILD_SERVER}"/daily-release/${AUTOBUILD_DATE}/log/debian-live-${AUTOBUILD_DISTRIBUTION}-${AUTOBUILD_ARCHITECTURE}-${AUTOBUILD_FLAVOUR}_${AUTOBUILD_DATE}-packages.txt

			# Moving images
			mkdir -p "${AUTOBUILD_SERVER}"/daily-release/${AUTOBUILD_DATE}/${AUTOBUILD_ARCHITECTURE}
			mv debian-live/binary.iso "${AUTOBUILD_SERVER}"/daily-release/${AUTOBUILD_DATE}/${AUTOBUILD_ARCHITECTURE}/debian-live-${AUTOBUILD_DISTRIBUTION}-${AUTOBUILD_ARCHITECTURE}-${AUTOBUILD_FLAVOUR}.iso

			mkdir -p "${AUTOBUILD_SERVER}"/daily-release/${AUTOBUILD_DATE}/source
			mv debian-live/source.iso "${AUTOBUILD_SERVER}"/daily-release/${AUTOBUILD_DATE}/source/debian-live-${AUTOBUILD_DISTRIBUTION}-source-${AUTOBUILD_FLAVOUR}.iso
		fi

		rm -rf debian-live
	done
done

# Cleanup
umount -f "${AUTOBUILD_DIRECTORY}"/debian-live/chroot/proc > /dev/null 2>&1
rm -rf "${AUTOBUILD_DIRECTORY}"