File: postinst

package info (click to toggle)
apt-proxy 1.3.0
  • links: PTS
  • area: main
  • in suites: woody
  • size: 188 kB
  • ctags: 10
  • sloc: sh: 236; makefile: 39
file content (43 lines) | stat: -rw-r--r-- 1,143 bytes parent folder | download
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
#! /bin/sh

#DEBHELPER#

set -e
case "$1" in
    configure)
	# First time installation only.  Upgrades skip this.
	if [ "$2" = "" ]; then
	    APTPROXY_USER=aptproxy
	    APTPROXY_LOGFILE=/var/log/apt-proxy.log

	    echo Adding apt-proxy service at port 9999 and creating $APTPROXY_USER user...
	    # Create user
	    if [ -x /usr/sbin/adduser ]; then
	        id $APTPROXY_USER > /dev/null 2>&1 ||
		    adduser --quiet --system --ingroup nogroup \
		    --home /var/cache/apt-proxy --no-create-home $APTPROXY_USER
	    fi


	    # Add inetd service
	    update-inetd --add "9999           stream  tcp     nowait.400      $APTPROXY_USER    \
			    /usr/sbin/tcpd /usr/sbin/apt-proxy -l $APTPROXY_LOGFILE"

	    # Make apt-proxy user own cache directory
	    chown -R $APTPROXY_USER /var/cache/apt-proxy
	    # Create a blank logfile owned by apt-proxy user
	    touch $APTPROXY_LOGFILE
	    chown $APTPROXY_USER:adm $APTPROXY_LOGFILE
	    chmod 640 $APTPROXY_LOGFILE
	fi
        ;;
    abort-upgrade|abort-remove|abort-deconfigure)
        ;;
    *)
        echo "postinst called with unknown argument \`$1'" >&2
        ;;
esac

exit 0