File: README.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 (58 lines) | stat: -rw-r--r-- 2,713 bytes parent folder | download | duplicates (3)
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
The preseed_fetch script takes a source and destination address, and
copies the specified file from the source to the destination.  It also
takes an optional checksum as a third parameter.

fetch-url from di-utils actually does the heavy lifting, with
preseed_fetch only adding the relative path functionality.

preseed_fetch accepts the same options (-r -c) as fetch-url which are
documented in the debian-installer-utils source, in the README file.

The source can be a fully qualified URL, an absolute path, or a relative path.

If the source is not a full URL, the contents of /var/run/preseed.last_location
is used to construct one before proceeding further.
This is done as follows:

  if the source is a relative path, the contents of preseed.last_location
  is stripped of its last slash and beyond, and the relative path is
  appended to it.

  if the source starts with a /, and preseed.last_location does not
  contain '/./' anywhere in it, the content of preseed.last_location is
  truncated at the start of the path component, and the source is appended
  to that.
  If on the other hand, the content of preseed.last_location does contain
  '/./', this is used as the point to truncate it at.  This allows a
  chroot-style offset into the directory tree.

Examples:

source			last_location			actual source
======			=============			=============
http://foo.com/bar/baz	whatever			http://foo.com/bar/baz
/local/path		http://foo.com/bar/baz		http://foo.com/local/path
local/path		http://foo.com/bar/baz		http://foo.com/bar/local/path
/local/path		http://foo.com/wibble/./bar/baz	http://foo.com/wibble/local/path
/local/path		file:///bar/baz			file:///local/path

Once the full URL is known, we select a method based on it, source its
file, and execute the protocol_fetch function defined therein.

As seen with the floppy method, if special processing is needed to ensure
that the files are available, this can be done thus:

floppy://foo/bar which mounts the floppy (to /media), then does a file copy
from /media/foo/bar

BTW the value of preseed/last_location defaults to file:///, which
should ensure vaguely normal behaviour if it is somehow invoked before
one of the preseed postinst scripts.  Once we get into preseeding via
the preseed.sh script, it will get set to the most recently fetched
preseed/include.  There are some slight wrinkles to this at present:

  if you invoke preseed_fetch in a preseed/include_command you'll probably
  have to specify a full path, or be very careful about the order that
  things get done, because you'll probably be using the last_location
  one older than you might expect (but using preseed_fetch in such a place
  would be very naughty, so just don't :-)