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

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
#! /bin/sh
#
# Create weighting files suitable for 'mkisofs -sort'.
#
# First argument = CD number

BDIR="$TDIR/$CODENAME-$ARCH"
CD="$1"

SECTIONS="main non-US/main"
if [ "${CONTRIB:-0}" != 0 ]; then
	SECTIONS="$SECTIONS contrib non-US/contrib"
fi
if [ "${NONFREE:-0}" != 0 ] || [ "${EXTRANONFREE:-0}" != 0 ]; then
	SECTIONS="$SECTIONS non-free non-US/non-free"
fi
if [ "${RESTRICTED:-0}" != 0 ]; then
	SECTIONS="$SECTIONS restricted non-US/restricted"
fi
if [ "$LOCAL" ]; then
	SECTIONS="$SECTIONS local"
fi

rm -f "$BDIR/$CD.weights_in"
for type in udeb deb; do
	for section in $SECTIONS; do
		if [ -s "$BDIR/$CD.filelist_$section" ]; then
			grep "\\.$type\$" "$BDIR/$CD.filelist_$section" >> "$BDIR/$CD.weights_in"
		fi
	done
done

weight=1

while read file; do
	# Use negative weight so that everything else sorts to the start
	echo "CD$CD/$file -$weight"
	weight="$(($weight + 1))"
done < "$BDIR/$CD.weights_in" > "$BDIR/$CD.weights"

rm -f "$BDIR/$CD.weights_in"

exit 0