]>
Commit | Line | Data |
---|---|---|
1 | #! /bin/sh | |
2 | ||
3 | set -e | |
4 | ||
5 | # set the proxy based on the admin users gconf settings | |
6 | # | |
7 | set_apt_proxy_from_gconf() { | |
8 | admin_user=$(getent group admin|cut -d: -f4|cut -d, -f1) | |
9 | if [ -n "$admin_user" ] && [ -x /usr/bin/sudo ] && [ -z "$http_proxy" ] && [ -x /usr/bin/gconftool ]; then | |
10 | use=$(sudo -u "$admin_user" gconftool --get /system/http_proxy/use_http_proxy 2>/dev/null) | |
11 | host=$(sudo -u "$admin_user" gconftool --get /system/http_proxy/host 2>/dev/null) | |
12 | port=$(sudo -u "$admin_user" gconftool --get /system/http_proxy/port 2>/dev/null) | |
13 | if [ "$use" = "true" ] && [ -n "$host" ] && [ -n "$port" ]; then | |
14 | APT_CONF_PROXY="" | |
15 | eval $(apt-config shell APT_CONF_PROXY Acquire::http::proxy) | |
16 | if [ -z "$APT_CONF_PROXY" ]; then | |
17 | echo "Acquire::http::proxy \"http://$host:$port/\";" >> /etc/apt/apt.conf | |
18 | fi | |
19 | fi | |
20 | fi | |
21 | } | |
22 | ||
23 | # summary of how this script can be called: | |
24 | # * <postinst> `configure' <most-recently-configured-version> | |
25 | # * <old-postinst> `abort-upgrade' <new version> | |
26 | # * <conflictor's-postinst> `abort-remove' `in-favour' <package> | |
27 | # <new-version> | |
28 | # * <deconfigured's-postinst> `abort-deconfigure' `in-favour' | |
29 | # <failed-install-package> <version> `removing' | |
30 | # <conflicting-package> <version> | |
31 | # for details, see http://www.debian.org/doc/debian-policy/ or | |
32 | # the debian-policy package | |
33 | ||
34 | case "$1" in | |
35 | configure) | |
36 | if ! test -f /etc/apt/trusted.gpg; then | |
37 | cp /usr/share/apt/ubuntu-archive.gpg /etc/apt/trusted.gpg | |
38 | fi | |
39 | ||
40 | # mvo: get gconf defaults once and write to a file, reason is | |
41 | # that sudo no longer honors http_proxy | |
42 | # this can be removed after lucid is released | |
43 | if dpkg --compare-versions "$2" lt-nl "0.7.25.3ubuntu2"; then | |
44 | set_apt_proxy_from_gconf | |
45 | fi | |
46 | ;; | |
47 | ||
48 | abort-upgrade|abort-remove|abort-deconfigure) | |
49 | ||
50 | ;; | |
51 | ||
52 | *) | |
53 | echo "postinst called with unknown argument \`$1'" >&2 | |
54 | exit 1 | |
55 | ;; | |
56 | esac | |
57 | ||
58 | # dh_installdeb will replace this with shell code automatically | |
59 | # generated by other debhelper scripts. | |
60 | ||
61 | #DEBHELPER# | |
62 | ||
63 | exit 0 | |
64 | ||
65 |