File: 90security

package info (click to toggle)
apt-setup 1%3A0.20etch1
  • links: PTS
  • area: main
  • in suites: etch
  • size: 956 kB
  • ctags: 8
  • sloc: sh: 479; makefile: 26
file content (55 lines) | stat: -rwxr-xr-x 1,261 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/bin/sh
set -e

. /usr/share/debconf/confmodule

file="$1"

db_get apt-setup/security_host
host="$RET"
if [ -z "$host" ]; then
	exit
fi

# To determine if non-free and contrib should be included, grep
# the file to see if they are listed in it.
dists="main"
for dist in contrib non-free; do
	if grep -q '^[^#]* '$dist $ROOT/etc/apt/sources.list.new; then
		dists="$dists $dist"
	fi
done

if ! db_get mirror/codename || [ -z "$RET" ]; then
	db_get cdrom/codename
fi
codename="$RET"

# No updates for sid (unstable). Never mind.
if [ "$codename" = sid ]; then
	exit
fi

# FIXME what if choose-mirror isn't available, i.e. full CD install?
if db_get mirror/http/proxy && [ -n "$RET" ]; then
	proxy="$RET"
	if ! grep -iq "Acquire::http::Proxy" $ROOT/etc/apt/apt.conf.new; then
		echo "Acquire::http::Proxy \"$proxy\";" >> $ROOT/etc/apt/apt.conf.new
	fi
fi

CODE=0
echo "deb http://$host/ $codename/updates $dists" >> $file
export ASV_TIMEOUT="-o Acquire::http::Timeout=30"
if ! apt-setup-verify $file; then
	db_subst apt-setup/security-updates-failed SECURITY_HOST "$host"
	db_input critical apt-setup/security-updates-failed || true
	if ! db_go; then
		exit 10 # back up
	fi
	CODE=9
fi

echo "deb-src http://$host/ $codename/updates $dists" >> $file

exit $CODE