4
# summary of how this script can be called:
5
# * <postinst> `configure' <most-recently-configured-version>
6
# * <old-postinst> `abort-upgrade' <new version>
7
# * <conflictor's-postinst> `abort-remove' `in-favour' <package>
9
# * <postinst> `abort-remove'
10
# * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
11
# <failed-install-package> <version> `removing'
12
# <conflicting-package> <version>
13
# for details, see http://www.debian.org/doc/debian-policy/ or
14
# the debian-policy package
16
. /usr/share/debconf/confmodule
17
trap "db_stop || true" EXIT HUP INT QUIT TERM
19
PACKAGE=landscape-client
21
# Use the default installed Python. Running just "python" might run
22
# something from /usr/local/bin, which doesn't necessarily support
23
# running the landscape client.
24
PYTHON=/usr/bin/python
29
CONFIG_FILE=/etc/landscape/client.conf
30
if [ ! -f $CONFIG_FILE ]; then
31
# Create new configuration, with private mode
32
TEMPFILE=$(mktemp -p /etc/landscape)
36
url = https://landscape.canonical.com/message-system
37
ping_url = http://landscape.canonical.com/ping
38
data_path = /var/lib/landscape/client
40
chown landscape $TEMPFILE
41
mv $TEMPFILE $CONFIG_FILE
43
# Get configuration values from debconf
44
db_get $PACKAGE/computer_title
45
COMPUTER_TITLE="${RET}"
46
db_get $PACKAGE/account_name
48
db_get $PACKAGE/registration_key
49
REGISTRATION_KEY="${RET}"
52
db_get $PACKAGE/exchange_interval
53
EXCHANGE_INTERVAL="${RET}"
54
db_get $PACKAGE/urgent_exchange_interval
55
URGENT_EXCHANGE_INTERVAL="${RET}"
56
db_get $PACKAGE/ping_url
58
db_get $PACKAGE/ping_interval
59
PING_INTERVAL="${RET}"
60
db_get $PACKAGE/http_proxy
62
db_get $PACKAGE/https_proxy
67
# If we got the needed information, actually do the registration.
68
if [ -n "$ACCOUNT_NAME" -a -n "$COMPUTER_TITLE" ]; then
69
landscape-config --silent --ok-no-register \
70
--computer-title "$COMPUTER_TITLE" \
71
--account-name "$ACCOUNT_NAME" \
72
--registration-key "$REGISTRATION_KEY" \
74
--exchange-interval "$EXCHANGE_INTERVAL" \
75
--urgent-exchange-interval "$URGENT_EXCHANGE_INTERVAL" \
76
--ping-url "$PING_URL" \
77
--ping-interval "$PING_INTERVAL" \
78
--http-proxy "$HTTP_PROXY" \
79
--https-proxy "$HTTPS_PROXY" \
83
# Fix non-private permissions
84
chmod 0600 $CONFIG_FILE
85
chown landscape $CONFIG_FILE
88
# Remove statoverride for smart-update, if there's one
89
smart_update=/usr/lib/landscape/smart-update
90
if dpkg-statoverride --list $smart_update >/dev/null 2>&1; then
91
dpkg-statoverride --remove $smart_update
94
# Add the setuid flag to apt-update, and make it be executable by
95
# users in the landscape group (that normally means landscape itself)
96
apt_update=/usr/lib/landscape/apt-update
97
if ! dpkg-statoverride --list $apt_update >/dev/null 2>&1; then
98
dpkg-statoverride --update --add root landscape 4754 $apt_update
101
# Remove old cron jobs
102
old_cron_job=/etc/cron.hourly/landscape-client
103
if [ -e $old_cron_job ]; then
106
very_old_cron_job=/etc/cron.hourly/smartpm-core
107
if [ -e $very_old_cron_job ]; then
108
rm $very_old_cron_job
111
# Check if we're upgrading from a D-Bus version like the client in the
114
if dpkg --compare-versions $2 lt 1.5.1; then
115
# Launch a proxy service that will forward requests over DBus
116
# from the old package-changer to the new AMP-based broker. This
117
# is a one-off only needed for the DBus->AMP upgrade
118
start-stop-daemon -x /usr/bin/landscape-dbus-proxy -b -c landscape -u landscape -S
124
abort-upgrade|abort-remove|abort-deconfigure)
128
echo "postinst called with unknown argument \`$1'" >&2
133
# dh_installdeb will replace this with shell code automatically
134
# generated by other debhelper scripts.