File: preseed_fetch

package info (click to toggle)
preseed 1.102
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 812 kB
  • sloc: sh: 435; perl: 153; makefile: 5
file content (38 lines) | stat: -rw-r--r-- 880 bytes parent folder | download | duplicates (2)
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
#!/bin/sh -e

. /lib/preseed/preseed.sh

while true; do
	case "$1" in
	    -C)
		LOOKUP_CHECKSUM=1
		;;
	    -*)
		# eat options starting with a -, so we can pass them on
		OPTS="$OPTS $1"
		;;
	    *)
		break
		;;
	esac
	shift
done

src="$1" ; shift
dst="$1" ; shift

if [ "$LOOKUP_CHECKSUM" = 1 ] ; then
	# this is yet to be written, so leave room for dropping it into place during preseeding
	if [ -x /bin/preseed_lookup_checksum ] ; then
		# "$@" should be empty, but we might as well pass it in, so that we can pass it back out if need be
		set -- $(/bin/preseed_lookup_checksum "$src" "$@")
	else
		log "error fetching \"$src\": -C specified, but there is no /bin/preseed_lookup_checksum executable"
		error retrieve_error "$src"
	fi
fi

last=/var/run/preseed.last_location
url=$(make_absolute_url "$src" "$(test -r $last && cat $last)")

fetch-url $OPTS "$url" "$dst" "$@"