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-common
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
db_get $PACKAGE/sysinfo
31
# * Do not display sysinfo on login
32
# * Cache sysinfo in /etc/motd
33
# * Run sysinfo on every login
34
SYSINFO="${RET:-Cache sysinfo in /etc/motd}"
35
WRAPPER=/usr/share/landscape/landscape-sysinfo.wrapper
36
PROFILE_LOCATION=/etc/profile.d/50-landscape-sysinfo.sh
37
UPDATE_MOTD_LOCATION=/etc/update-motd.d/50-landscape-sysinfo
38
if [ "$RET" = "Cache sysinfo in /etc/motd" ]; then
39
rm -f $PROFILE_LOCATION 2>/dev/null || true
40
ln -s $WRAPPER $UPDATE_MOTD_LOCATION
41
invoke-rc.d update-motd refresh || true
42
elif [ "$RET" = "Run sysinfo on every login" ]; then
43
rm -f $UPDATE_MOTD_LOCATION 2>/dev/null && /etc/init.d/update-motd refresh || true
44
ln -s $WRAPPER $PROFILE_LOCATION
46
rm -f $UPDATE_MOTD_LOCATION 2>/dev/null && /etc/init.d/update-motd refresh || true
47
rm -f $PROFILE_LOCATION || true
50
# 0.9.1 introduces non-backwards compatible changes. This detects
51
# whether or not the data is in the current format. If not, all
52
# existing data is removed.
53
DATA_DIR=/var/lib/landscape
55
if [ -d $DATA_DIR/data ]; then
57
elif [ -f $DATA_DIR/client/data.bpickle ]; then
58
LAST_BYTE=`sed -n '$,$s/.*\(.\)/\1/p' $DATA_DIR/client/data.bpickle`
59
if [ "$LAST_BYTE" = e ]; then
64
# Create landscape system user
65
if ! getent passwd landscape >/dev/null; then
66
adduser --quiet --system --disabled-password \
67
--gecos "Landscape Client Daemon" \
68
--home /var/lib/landscape --no-create-home landscape
71
# Fix prior ownerships
72
chown -R landscape /var/log/landscape /var/lib/landscape
76
abort-upgrade|abort-remove|abort-deconfigure)
80
echo "postinst called with unknown argument \`$1'" >&2
85
# dh_installdeb will replace this with shell code automatically
86
# generated by other debhelper scripts.