summaryrefslogtreecommitdiff
path: root/debian/cron.daily
blob: 26bae00a2dce88b3633c514e2a723693bbae3da0 (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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#!/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 AUTOBUILD_DISTRIBUTION in ${AUTOBUILD_DISTRIBUTIONS}
do
	for AUTOBUILD_FLAVOUR in ${AUTOBUILD_FLAVOURS}
	do
		if [ ! -f "${AUTOBUILD_SERVER}"/daily-builds/${AUTOBUILD_DATE}/log/debian-live-${AUTOBUILD_DISTRIBUTION}-${AUTOBUILD_ARCHITECTURE}-${AUTOBUILD_FLAVOUR}_${AUTOBUILD_DATE}-iso-log.txt ]
		then
			# Generating images
			mkdir debian-live
			make-live -t iso -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-builds/${AUTOBUILD_DATE}/log
			mv debian-live/log.txt "${AUTOBUILD_SERVER}"/daily-builds/${AUTOBUILD_DATE}/log/debian-live-${AUTOBUILD_DISTRIBUTION}-${AUTOBUILD_ARCHITECTURE}-${AUTOBUILD_FLAVOUR}_${AUTOBUILD_DATE}-iso-log.txt
			mv debian-live/packages.txt "${AUTOBUILD_SERVER}"/daily-builds/${AUTOBUILD_DATE}/log/debian-live-${AUTOBUILD_DISTRIBUTION}-${AUTOBUILD_ARCHITECTURE}-${AUTOBUILD_FLAVOUR}_${AUTOBUILD_DATE}-iso-packages.txt

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

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

		# Cleanup
		rm -rf debian-live

		if [ ! -f "${AUTOBUILD_SERVER}"/daily-builds/${AUTOBUILD_DATE}/log/debian-live-${AUTOBUILD_DISTRIBUTION}-${AUTOBUILD_ARCHITECTURE}-${AUTOBUILD_FLAVOUR}_${AUTOBUILD_DATE}-usb-log.txt ]
		then
			# Generating images
			mkdir debian-live
			make-live -t usb -d ${AUTOBUILD_DISTRIBUTION} -p ${AUTOBUILD_FLAVOUR} -m ${LIVE_MIRROR} ${AUTOBUILD_OPTIONS} > debian-live/log.txt 2>&1
		fi

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

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

		# Cleanup
		rm -rf debian-live
	done
done

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

# MD5SUMS
for DIRECTORY in "${AUTOBUILD_SERVER}"/daily-builds/${AUTOBUILD_DATE}/*
do
	cd "${DIRECTORY}"
	md5sum * > MD5SUMS
done

# Current symlink
rm -f "${AUTOBUILD_SERVER}"/daily-builds/current
ln -s ${AUTOBUILD_DATE} "${AUTOBUILD_SERVER}"/daily-builds/current