File: auto-install.postinst

package info (click to toggle)
auto-install 0.03
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 44 kB
  • sloc: sh: 28; makefile: 24
file content (35 lines) | stat: -rwxr-xr-x 596 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
#!/bin/sh

set -e

. /usr/share/debconf/confmodule

db_get preseed/url && url="$RET"

[ "$url" ] || exit 0

if [ "${url%%://*}" != "$url" ]; then
	proto="${url%%://*}"
	base="${url#*://}"
else
	proto=http
	base="$url"
fi

if ! expr "$base" : [^/]*$ >/dev/null; then
	host="${base%%/*}"
	dir="${base#*/}"
else
	host="$base"
	db_get auto-install/defaultroot && dir="$RET"
fi

if expr $host : [^.]*$ >/dev/null; then
	db_get netcfg/get_domain && domain="$RET"

	if [ -n "$domain" ] && [ "$domain" != "unnassigned-domain" ]; then
		host="$host.$domain"
	fi
fi

db_set preseed/url $proto://$host/$dir