File: 60local

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 (49 lines) | stat: -rwxr-xr-x 978 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
#!/bin/sh
set -e

. /usr/share/debconf/confmodule

file="$1"

chroot=
if [ "$ROOT" ]; then
	chroot=chroot
fi

i=0
while db_get "apt-setup/local$i/repository" && [ "$RET" ]; do
	repository="$RET"
	comment=
	if db_get "apt-setup/local$i/comment"; then
		comment="$RET"
	fi
	key=
	if db_get "apt-setup/local$i/key"; then
		key="$RET"
	fi
	echo >> $file
	if [ -n "$comment" ]; then
		echo "## $comment" >> $file
	fi
	echo "deb $repository" >> $file
	# if true, add a line for deb-src
	if db_get "apt-setup/local$i/source" && [ "$RET" = true ]; then
		echo "deb-src $repository" >> $file
	fi
	if [ -n "$key" ]; then
		# make wget use the proxy
		protocol=${repository%%:*}
		if db_get mirror/$protocol/proxy && [ "$RET" ]; then
			proxy="$RET"
			eval "export ${protocol}_proxy=$proxy"
		fi
		# fetch the key
		wget "$key" -O "$ROOT/tmp/key$i.pub"
		# add it to the keyring
		$chroot $ROOT apt-key add "/tmp/key$i.pub"
		rm -f "$ROOT/tmp/key$i.pub"
	fi
	i="$(($i + 1))"
done

exit 0