~tsimonq2/debian-cd/lubuntu-cosmic-changes

30 by Arch Librarian
Initial revision
1
#!/bin/sh
2
3
# Script to build everything possible : sources and binaries for all archs
4
1608 by Colin Watson
Backport from upstream (Frans Pop):
5
. ./CONF.sh
30 by Arch Librarian
Initial revision
6
1064 by Colin Watson
remove previous temporary directory before starting new build
7
rm -rf "$TDIR"
800 by Colin Watson
remove output directory before starting to build
8
rm -rf "$OUT"
114 by Arch Librarian
subdir for archs
9
TMP_OUT=$OUT
10
822 by Colin Watson
make architecture list configurable; default to amd64 i386 ia64 powerpc
11
if [ -z "$ARCHES" ]; then
1048 by Colin Watson
build just the three primary architectures by default
12
	export ARCHES='amd64 i386 powerpc'
822 by Colin Watson
make architecture list configurable; default to amd64 i386 ia64 powerpc
13
fi
14
1049 by Colin Watson
Add subarchitecture support
15
for FULLARCH in $ARCHES
30 by Arch Librarian
Initial revision
16
do
1049 by Colin Watson
Add subarchitecture support
17
	export ARCH="${FULLARCH%%+*}"
1053 by Colin Watson
fix subarchitecture calculation
18
	if [ "$ARCH" = "$FULLARCH" ]; then
19
		export SUBARCH=
20
	else
21
		export SUBARCH="${FULLARCH#*+}"
22
	fi
1049 by Colin Watson
Add subarchitecture support
23
	echo "Now we're going to build CD for $FULLARCH !"
874 by Colin Watson
work out mirror based on architecture, by upcall to cdimage wrapper scripts
24
	if type find-mirror >/dev/null 2>&1; then
25
		# TODO: nasty upcall to cdimage wrapper scripts
26
		export MIRROR="$(find-mirror "$ARCH")"
1145 by Colin Watson
fix up security for ports architectures that use a different mirror
27
		if [ "$SECURITY" ]; then
28
			export SECURITY="$MIRROR"
29
		fi
874 by Colin Watson
work out mirror based on architecture, by upcall to cdimage wrapper scripts
30
	fi
30 by Arch Librarian
Initial revision
31
	echo " ... cleaning"
32
	make distclean
33
	make ${CODENAME}_status
34
	echo " ... checking your mirror"
334 by Arch Librarian
make the make mirrorcheck optional, to save time when t...
35
	if [ "$SKIPMIRRORCHECK" != "yes" ] ; then 
979 by Colin Watson
merge JTE branch
36
		make mirrorcheck-binary
1049 by Colin Watson
Add subarchitecture support
37
      	if [ "$FULLARCH" = "i386" ]; then
979 by Colin Watson
merge JTE branch
38
            make mirrorcheck-source
39
        fi
334 by Arch Librarian
make the make mirrorcheck optional, to save time when t...
40
	else
41
		echo "WARNING: skipping mirrorcheck"
42
	fi
43
30 by Arch Librarian
Initial revision
44
	if [ $? -gt 0 ]; then
45
		echo "ERROR: Your mirror has a problem, please correct it." >&2
46
		exit 1
47
	fi
48
	echo " ... selecting packages to include"
302 by Arch Librarian
Added support for DVD-sized images. Specify default ima...
49
	if [ -e ${MIRROR}/dists/${CODENAME}/main/disks-${ARCH}/current/. ] ; then
50
		disks=`du -sm ${MIRROR}/dists/${CODENAME}/main/disks-${ARCH}/current/. | \
267 by Arch Librarian
Cope with missing boot floppies
51
				awk '{print $1}'`
302 by Arch Librarian
Added support for DVD-sized images. Specify default ima...
52
	else
53
		disks=0
54
	fi
1049 by Colin Watson
Add subarchitecture support
55
	if [ -f $BASEDIR/tools/boot/$CODENAME/boot-$FULLARCH.calc ]; then
56
	    . $BASEDIR/tools/boot/$CODENAME/boot-$FULLARCH.calc
112 by Arch Librarian
Edited boot-alpha
57
	fi
58
	SIZE_ARGS=''
774 by Colin Watson
only build one CD
59
	for CD in 1; do
112 by Arch Librarian
Edited boot-alpha
60
		size=`eval echo '$'"BOOT_SIZE_${CD}"`
61
		[ "$size" = "" ] && size=0
62
		[ $CD = "1" ] && size=$(($size + $disks))
613 by Arch Librarian
Added support for SIZE_MULT_x when calculating full dis...
63
        mult=`eval echo '$'"SIZE_MULT_${CD}"`
64
        [ "$mult" = "" ] && mult=100
302 by Arch Librarian
Added support for DVD-sized images. Specify default ima...
65
        FULL_SIZE=`echo "($DEFBINSIZE - $size) * 1024 * 1024" | bc`
613 by Arch Librarian
Added support for SIZE_MULT_x when calculating full dis...
66
        echo "INFO: Reserving $size MB on CD $CD for boot files.  SIZELIMIT=$FULL_SIZE."
67
        if [ $mult != 100 ]; then
68
            echo "  INFO: Reserving "$((100-$mult))"% of the CD for extra metadata"
69
            FULL_SIZE=`echo "$FULL_SIZE * $mult" / 100 | bc`
70
            echo "  INFO: SIZELIMIT now $FULL_SIZE."
71
        fi
302 by Arch Librarian
Added support for DVD-sized images. Specify default ima...
72
        SIZE_ARGS="$SIZE_ARGS SIZELIMIT${CD}=$FULL_SIZE"
112 by Arch Librarian
Edited boot-alpha
73
	done
302 by Arch Librarian
Added support for DVD-sized images. Specify default ima...
74
    FULL_SIZE=`echo "($DEFSRCSIZE - $size) * 1024 * 1024" | bc`
30 by Arch Librarian
Initial revision
75
	echo " ... building the images"
1621 by Colin Watson
allow for source-only image build passes (LP: #661382)
76
	if [ "$FULLARCH" = "i386" ] && \
77
	   ([ "$CDIMAGE_INSTALL" = 1 ] || [ "$CDIMAGE_ONLYSOURCE" = 1 ]) && \
825 by Colin Watson
avoid building source images for DVDs, warty builds, and special custom builds
78
	   [ "$CDIMAGE_DVD" != 1 ] && [ "$DIST" != warty ] && \
909 by Colin Watson
CDIMAGE_NOSOURCE=1 disables source CDs
79
	   [ "$SPECIAL" != 1 ] && [ "$CDIMAGE_NOSOURCE" != 1 ]; then
1621 by Colin Watson
allow for source-only image build passes (LP: #661382)
80
		if [ "$CDIMAGE_ONLYSOURCE" != 1 ]; then
81
			make list $SIZE_ARGS SRCSIZELIMIT=$FULL_SIZE
1767 by Adam Conrad
Fix compress/sum ordering in build_all, and add sha256sums to Makefile
82
		else
83
			make src-list SRCSIZELIMIT=$FULL_SIZE
84
		fi
85
		export OUT="$TMP_OUT/src"; mkdir -p $OUT
86
		make src-official_images $SIZE_ARGS SRCSIZELIMIT=$FULL_SIZE
87
		echo Generating MD5Sums of the source images
88
		make imagesums
89
		echo Generating list files for source images
90
		make pi-makelist
91
		if [ "$CDIMAGE_ONLYSOURCE" != 1 ]; then
1621 by Colin Watson
allow for source-only image build passes (LP: #661382)
92
			export OUT="$TMP_OUT/$FULLARCH"; mkdir -p $OUT
93
			make bin-official_images $SIZE_ARGS SRCSIZELIMIT=$FULL_SIZE
94
			echo Generating list files for images
95
			make pi-makelist
96
		fi
1564.1.5 by Michael Casadevall
Refactored preinstalled image support to be somewhat more sane
97
	elif [ "$CDIMAGE_PREINSTALLED" = 1 ]; then
98
		export OUT="$TMP_OUT/$FULLARCH"; mkdir -p $OUT
99
		make bin-preinstalled_images
30 by Arch Librarian
Initial revision
100
	else
1564.1.5 by Michael Casadevall
Refactored preinstalled image support to be somewhat more sane
101
		make bin-list $SIZE_ARGS SRCSIZELIMIT=$FULL_SIZE
1049 by Colin Watson
Add subarchitecture support
102
		export OUT=$TMP_OUT/$FULLARCH; mkdir -p $OUT
850 by Colin Watson
pass size arguments to image targets too (e.g. bootable may need them)
103
		make bin-official_images $SIZE_ARGS SRCSIZELIMIT=$FULL_SIZE
30 by Arch Librarian
Initial revision
104
		if [ $? -gt 0 ]; then
105
			echo "ERROR WHILE BUILDING OFFICIAL IMAGES !!" >&2
157 by Arch Librarian
CONF.sh:
106
			if [ "$ATTEMPT_FALLBACK" = "yes" ]; then
107
				echo "I'll try to build a simple (non-bootable) CD" >&2
108
				make clean
109
				make installtools
850 by Colin Watson
pass size arguments to image targets too (e.g. bootable may need them)
110
				make bin-images $SIZE_ARGS SRCSIZELIMIT=$FULL_SIZE
157 by Arch Librarian
CONF.sh:
111
			else
824 by Colin Watson
if one architecture fails, continue rather than exiting
112
				# exit 1
113
				continue
157 by Arch Librarian
CONF.sh:
114
			fi
30 by Arch Librarian
Initial revision
115
		fi
982 by Colin Watson
put pi-makelist stuff back
116
		echo Generating list files for images
117
		make pi-makelist
30 by Arch Librarian
Initial revision
118
	fi
1564.1.7 by Michael Casadevall
Add initial support for compressed images
119
	if [ "$CDIMAGE_COMPRESS" = 1 ]; then
1714 by Oliver Grawert
remove the compression suppresiion code from build_all.sh, that should happen in the Makefile and just check if a file is already compressed
120
		echo Compressing CD images
121
		make bin-compress_images
1564.1.7 by Michael Casadevall
Add initial support for compressed images
122
	fi
1767 by Adam Conrad
Fix compress/sum ordering in build_all, and add sha256sums to Makefile
123
	if [ "$CDIMAGE_ONLYSOURCE" != 1 ]; then
124
		echo Generating MD5Sums of the binary images
125
		make imagesums
126
	fi
30 by Arch Librarian
Initial revision
127
	echo "--------------- `date` ---------------"
128
done