~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
#! /bin/sh
set -e

# Find the newest installer build available for $DI_DIST/$ARCH.

if [ -z "$DI_DIST" ]; then
	DI_DIST="$DI_CODENAME"
fi

current_path="$MIRROR/dists/$DI_DIST/main/installer-$ARCH"
current_version=

try_suites="$DI_DIST"
if [ -n "$SECURITY" ]; then
	try_suites="$try_suites $DI_DIST-security"
fi
if [ "${PROPOSED:-0}" != "0" ]; then
	try_suites="$try_suites $DI_DIST-proposed"
fi
if [ "${UPDATES:-0}" != "0" ]; then
	try_suites="$try_suites $DI_DIST-updates"
fi

for try_suite in $try_suites; do
	for try_type in installer daily-installer; do
		dir="$MIRROR/dists/$try_suite/main/$try_type-$ARCH"
		if [ ! -h "$dir/current" ] || \
		   ! version="$(readlink "$dir/current")"; then
			continue
		fi
		if dpkg --compare-versions \
		    "$current_version" lt "$version"; then
			current_path="$dir"
			current_version="$version"
		fi
	done
done

echo "$current_path"