This file is indexed.

postinst is in landscape-client 14.01-0ubuntu3.

This file is a maintainer script. It is executed when installing (*inst) or removing (*rm) the package.

The actual contents of the file can be viewed below.

  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
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
#!/bin/sh
set -e

# summary of how this script can be called:
#        * <postinst> `configure' <most-recently-configured-version>
#        * <old-postinst> `abort-upgrade' <new version>
#        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
#          <new-version>
#        * <postinst> `abort-remove'
#        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
#          <failed-install-package> <version> `removing'
#          <conflicting-package> <version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package

. /usr/share/debconf/confmodule
trap "db_stop || true" EXIT HUP INT QUIT TERM

PACKAGE=landscape-client

# Use the default installed Python.  Running just "python" might run
# something from /usr/local/bin, which doesn't necessarily support
# running the landscape client.
PYTHON=/usr/bin/python

case "$1" in
    configure)

        CONFIG_FILE=/etc/landscape/client.conf
        if [ ! -f $CONFIG_FILE ]; then
            # Create new configuration, with private mode
            TEMPFILE=$(mktemp -p /etc/landscape)
            cat > $TEMPFILE <<END
[client]
log_level = info
url = https://landscape.canonical.com/message-system
ping_url = http://landscape.canonical.com/ping
data_path = /var/lib/landscape/client
END
            chown landscape $TEMPFILE
            mv $TEMPFILE $CONFIG_FILE

            # Get configuration values from debconf
            db_get $PACKAGE/computer_title
            COMPUTER_TITLE="${RET}"
            db_get $PACKAGE/account_name
            ACCOUNT_NAME="${RET}"
            db_get $PACKAGE/registration_key
            REGISTRATION_KEY="${RET}"
            db_get $PACKAGE/url
            URL="${RET}"
            db_get $PACKAGE/exchange_interval
            EXCHANGE_INTERVAL="${RET}"
            db_get $PACKAGE/urgent_exchange_interval
            URGENT_EXCHANGE_INTERVAL="${RET}"
            db_get $PACKAGE/ping_url
            PING_URL="${RET}"
            db_get $PACKAGE/ping_interval
            PING_INTERVAL="${RET}"
            db_get $PACKAGE/http_proxy
            HTTP_PROXY="${RET}"
            db_get $PACKAGE/https_proxy
            HTTPS_PROXY="${RET}"
            db_get $PACKAGE/tags
            TAGS="${RET}"

            # If we got the needed information, actually do the registration.
            if [ -n "$ACCOUNT_NAME" -a -n "$COMPUTER_TITLE" ]; then
                landscape-config --silent --ok-no-register \
                    --computer-title "$COMPUTER_TITLE" \
                    --account-name "$ACCOUNT_NAME" \
                    --registration-key "$REGISTRATION_KEY" \
                    --url "$URL" \
                    --exchange-interval "$EXCHANGE_INTERVAL" \
                    --urgent-exchange-interval "$URGENT_EXCHANGE_INTERVAL" \
                    --ping-url "$PING_URL" \
                    --ping-interval "$PING_INTERVAL" \
                    --http-proxy "$HTTP_PROXY" \
                    --https-proxy "$HTTPS_PROXY" \
                    --tags "$TAGS"
            fi
        else
            # Fix non-private permissions
            chmod 0600 $CONFIG_FILE
            chown landscape $CONFIG_FILE
        fi

        # Remove statoverride for smart-update, if there's one
        smart_update=/usr/lib/landscape/smart-update
        if dpkg-statoverride --list $smart_update >/dev/null 2>&1; then
            dpkg-statoverride --remove $smart_update
        fi

        # Add the setuid flag to apt-update, and make it be executable by
        # users in the landscape group (that normally means landscape itself)
        apt_update=/usr/lib/landscape/apt-update
        if ! dpkg-statoverride --list $apt_update >/dev/null 2>&1; then
            dpkg-statoverride --update --add root landscape 4754 $apt_update
        fi

        # Remove old cron jobs
        old_cron_job=/etc/cron.hourly/landscape-client
        if [ -e $old_cron_job ]; then
            rm $old_cron_job
        fi
        very_old_cron_job=/etc/cron.hourly/smartpm-core
        if [ -e $very_old_cron_job ]; then
            rm $very_old_cron_job
        fi

        # Check if we're upgrading from a D-Bus version like the client in the
        # lucid archives.
        if ! [ -z $2 ]; then
            if dpkg --compare-versions $2 lt 1.5.1; then
                # Launch a proxy service that will forward requests over DBus
                # from the old package-changer to the new AMP-based broker. This
                # is a one-off only needed for the DBus->AMP upgrade
                start-stop-daemon -x /usr/bin/landscape-dbus-proxy -b -c landscape -u landscape -S
            fi
         fi

    ;;

    abort-upgrade|abort-remove|abort-deconfigure)
    ;;

    *)
        echo "postinst called with unknown argument \`$1'" >&2
        exit 1
    ;;
esac

# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.

# Automatically added by dh_installinit
if [ -x "/etc/init.d/landscape-client" ] || [ -e "/etc/init/landscape-client.conf" ]; then
	if [ ! -e "/etc/init/landscape-client.conf" ]; then
		update-rc.d landscape-client start 45 2 3 4 5 . stop 15 0 1 6 . >/dev/null
	fi
	invoke-rc.d landscape-client start || exit $?
fi
# End automatically added section


exit 0