|
775
by Colin Watson
add sorting_weights tool |
1 |
#! /bin/sh
|
2 |
#
|
|
3 |
# Create weighting files suitable for 'mkisofs -sort'.
|
|
4 |
#
|
|
5 |
# First argument = CD number
|
|
|
1057
by Colin Watson
sort /isolinux/isolinux.bin and /isolinux/boot.cat to the start of the image |
6 |
# Subsequent arguments = files or directories to be sorted to the start
|
|
1062
by Colin Watson
fix /isolinux/* sorting harder; /isolinux/* live under boot$N, not CD$N |
7 |
# Note that these filenames are relative to $BDIR, not $BDIR/CD$CD.
|
|
775
by Colin Watson
add sorting_weights tool |
8 |
|
|
1049
by Colin Watson
Add subarchitecture support |
9 |
BDIR="$TDIR/$CODENAME-$FULLARCH" |
|
775
by Colin Watson
add sorting_weights tool |
10 |
CD="$1" |
|
1057
by Colin Watson
sort /isolinux/isolinux.bin and /isolinux/boot.cat to the start of the image |
11 |
shift
|
|
775
by Colin Watson
add sorting_weights tool |
12 |
|
13 |
SECTIONS="main non-US/main" |
|
14 |
if [ "${CONTRIB:-0}" != 0 ]; then |
|
15 |
SECTIONS="$SECTIONS contrib non-US/contrib" |
|
16 |
fi
|
|
17 |
if [ "${NONFREE:-0}" != 0 ] || [ "${EXTRANONFREE:-0}" != 0 ]; then |
|
18 |
SECTIONS="$SECTIONS non-free non-US/non-free" |
|
19 |
fi
|
|
20 |
if [ "${RESTRICTED:-0}" != 0 ]; then |
|
21 |
SECTIONS="$SECTIONS restricted non-US/restricted" |
|
22 |
fi
|
|
|
1238
by Colin Watson
add optional support for universe and multiverse |
23 |
if [ "${UNIVERSE:-0}" != 0 ]; then |
24 |
SECTIONS="$SECTIONS universe non-US/universe" |
|
25 |
fi
|
|
26 |
if [ "${MULTIVERSE:-0}" != 0 ]; then |
|
27 |
SECTIONS="$SECTIONS multiverse non-US/multiverse" |
|
28 |
fi
|
|
|
775
by Colin Watson
add sorting_weights tool |
29 |
if [ "$LOCAL" ]; then |
30 |
SECTIONS="$SECTIONS local" |
|
31 |
fi
|
|
32 |
||
|
1057
by Colin Watson
sort /isolinux/isolinux.bin and /isolinux/boot.cat to the start of the image |
33 |
rm -f "$BDIR/$CD.weights_in" "$BDIR/$CD.weights" |
34 |
||
|
1059
by Colin Watson
sort provided start-of-image files in a defined order |
35 |
i="$#" |
|
1057
by Colin Watson
sort /isolinux/isolinux.bin and /isolinux/boot.cat to the start of the image |
36 |
for file in $@; do |
37 |
# These files (or directories) sort before everything else.
|
|
|
1062
by Colin Watson
fix /isolinux/* sorting harder; /isolinux/* live under boot$N, not CD$N |
38 |
echo "$file +$i" >> "$BDIR/$CD.weights" |
|
1059
by Colin Watson
sort provided start-of-image files in a defined order |
39 |
i="$(($i - 1))" |
|
1057
by Colin Watson
sort /isolinux/isolinux.bin and /isolinux/boot.cat to the start of the image |
40 |
done
|
41 |
||
|
775
by Colin Watson
add sorting_weights tool |
42 |
for type in udeb deb; do |
43 |
for section in $SECTIONS; do |
|
44 |
if [ -s "$BDIR/$CD.filelist_$section" ]; then |
|
45 |
grep "\\.$type\$" "$BDIR/$CD.filelist_$section" >> "$BDIR/$CD.weights_in" |
|
46 |
fi
|
|
47 |
done
|
|
48 |
done
|
|
|
1832
by Stéphane Graber
The main squashfs should be the first, then the alternative ones. |
49 |
for file in casper/filesystem.squashfs install/filesystem.squashfs casper/ltsp.squashfs casper/server.squashfs ; do |
|
1566
by Colin Watson
sort squashfs files last so that they occupy less radial distance on the CD; thanks to Louis Simard for the suggestion |
50 |
if [ -e "$BDIR/CD$CD/$file" ]; then |
51 |
echo "$file" >> "$BDIR/$CD.weights_in" |
|
52 |
fi
|
|
53 |
done
|
|
|
775
by Colin Watson
add sorting_weights tool |
54 |
|
55 |
weight=1 |
|
56 |
||
57 |
while read file; do |
|
58 |
# Use negative weight so that everything else sorts to the start
|
|
59 |
echo "CD$CD/$file -$weight" |
|
60 |
weight="$(($weight + 1))" |
|
|
1057
by Colin Watson
sort /isolinux/isolinux.bin and /isolinux/boot.cat to the start of the image |
61 |
done < "$BDIR/$CD.weights_in" >> "$BDIR/$CD.weights" |
|
775
by Colin Watson
add sorting_weights tool |
62 |
|
63 |
rm -f "$BDIR/$CD.weights_in"
|
|
64 |
||
65 |
exit 0
|