]>
git.saurik.com Git - apt.git/blob - debian/apt.postinst
5 # set the proxy based on the admin users gconf settings
7 set_apt_proxy_from_gconf
() {
9 if [ -n "$SUDO_USER" ]; then
10 admin_user
="$SUDO_USER"
12 admin_user
=$(getent group admin|cut -d: -f4|cut -d, -f1)
14 # test if the user actually exists, getent returns "+" for e.g.
16 if ! id
-u "$admin_user" > /dev
/null
2>&1; then
19 # get the settings from gconf
20 if [ -n "$admin_user" ] && [ -x /usr
/bin
/sudo
] && [ -z "$http_proxy" ] && [ -x /usr
/bin
/gconftool
]; then
21 use
=$(sudo -u "$admin_user" gconftool --get /system/http_proxy/use_http_proxy 2>/dev/null)
22 host=$(sudo -u "$admin_user" gconftool --get /system/http_proxy/host 2>/dev/null)
23 port
=$(sudo -u "$admin_user" gconftool --get /system/http_proxy/port 2>/dev/null)
24 if [ "$use" = "true" ] && [ -n "$host" ] && [ -n "$port" ]; then
26 eval $(apt-config shell APT_CONF_PROXY Acquire::http::proxy)
27 if [ -z "$APT_CONF_PROXY" ]; then
28 echo "Acquire::http::proxy \"http://$host:$port/\";" >> /etc
/apt
/apt.conf
34 # summary of how this script can be called:
35 # * <postinst> `configure' <most-recently-configured-version>
36 # * <old-postinst> `abort-upgrade' <new version>
37 # * <conflictor's-postinst> `abort-remove' `in-favour' <package>
39 # * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
40 # <failed-install-package> <version> `removing'
41 # <conflicting-package> <version>
42 # for details, see http://www.debian.org/doc/debian-policy/ or
43 # the debian-policy package
47 if ! test -f /etc
/apt
/trusted.gpg
; then
48 cp /usr
/share
/apt
/ubuntu
-archive.gpg
/etc
/apt
/trusted.gpg
51 # mvo: get gconf defaults once and write to a file, reason is
52 # that sudo no longer honors http_proxy
53 # this can be removed after lucid is released
54 if dpkg
--compare-versions "$2" lt
-nl "0.7.25.3ubuntu2"; then
55 set_apt_proxy_from_gconf
|| true
59 abort
-upgrade|abort
-remove|abort
-deconfigure)
64 echo "postinst called with unknown argument \`$1'" >&2
69 # dh_installdeb will replace this with shell code automatically
70 # generated by other debhelper scripts.