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

831 by Colin Watson
automatically select newest of installer/daily-installer
1
#! /bin/sh
2
set -e
3
4
# Find the newest installer build available for $DI_DIST/$ARCH.
5
853 by Colin Watson
default $DI_DIST to $DI_CODENAME
6
if [ -z "$DI_DIST" ]; then
7
	DI_DIST="$DI_CODENAME"
8
fi
9
1110 by Colin Watson
make find-newest-installer output a path instead of a type, and look in -security/-updates if necessary
10
current_path="$MIRROR/dists/$DI_DIST/main/installer-$ARCH"
831 by Colin Watson
automatically select newest of installer/daily-installer
11
current_version=
12
1110 by Colin Watson
make find-newest-installer output a path instead of a type, and look in -security/-updates if necessary
13
try_suites="$DI_DIST"
14
if [ -n "$SECURITY" ]; then
15
	try_suites="$try_suites $DI_DIST-security"
16
fi
1264 by Colin Watson
fetch d-i from -proposed if configured to do so
17
if [ "${PROPOSED:-0}" != "0" ]; then
18
	try_suites="$try_suites $DI_DIST-proposed"
19
fi
1110 by Colin Watson
make find-newest-installer output a path instead of a type, and look in -security/-updates if necessary
20
if [ "${UPDATES:-0}" != "0" ]; then
21
	try_suites="$try_suites $DI_DIST-updates"
22
fi
23
24
for try_suite in $try_suites; do
25
	for try_type in installer daily-installer; do
26
		dir="$MIRROR/dists/$try_suite/main/$try_type-$ARCH"
27
		if [ ! -h "$dir/current" ] || \
28
		   ! version="$(readlink "$dir/current")"; then
29
			continue
30
		fi
31
		if dpkg --compare-versions \
32
		    "$current_version" lt "$version"; then
33
			current_path="$dir"
34
			current_version="$version"
35
		fi
36
	done
831 by Colin Watson
automatically select newest of installer/daily-installer
37
done
38
1110 by Colin Watson
make find-newest-installer output a path instead of a type, and look in -security/-updates if necessary
39
echo "$current_path"