~free.ekanayaka/landscape-client/lucid-1.5.0-0ubuntu0.10.04.0

« back to all changes in this revision

Viewing changes to debian/landscape-common.postinst

  • Committer: Bazaar Package Importer
  • Author(s): Mathias Gug, Mathias Gug, Christopher Armstrong
  • Date: 2008-09-15 17:21:53 UTC
  • Revision ID: james.westby@ubuntu.com-20080915172153-nup9oqce6gv3pv8h
Tags: 1.0.18-0ubuntu2
[ Mathias Gug ]
* Split the package into two packages:
  - landscape-common: has the python libraries and the landscape-sysinfo
    command. A landscape account is not required to use this package.
  - landscape-client: has all the binaries required to run the
    landscape-client. Requires a landscape account.
  - debian/control: 
    + move some dependencies to landscape-client so that
      landscape-common doesn't install unecessary packages in the 
      default -server install.
    + move python-gobject to a Pre-Depends so that landscape-config can
      register the system during the postinst (LP: #268838).
* debian/control:
  - depend on python-smartpm instead of smartpm-core.
* debian/landscape-client.postrm: delete /etc/landscape/client.conf when 
  the package is purged.
* debian/landscape-client.postinst: remove sysinfo_in_motd debconf question
  as it wasn't used.

[ Christopher Armstrong ]
* Fixes for (LP: #268352).
  - scripts/landscape-sysinfo.wrapper: New script to run landscape-sysinfo
    with leading whitespace.
  - debian/rules: Install wrapper into /usr/share/landscape.
  - debian/landscape-client.postinst: Link wrapper into place.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
2
set -e
 
3
 
 
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>
 
8
#          <new-version>
 
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
 
15
 
 
16
. /usr/share/debconf/confmodule
 
17
trap "db_stop || true" EXIT HUP INT QUIT TERM
 
18
 
 
19
PACKAGE=landscape-common
 
20
 
 
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
 
25
 
 
26
case "$1" in
 
27
    configure)
 
28
 
 
29
        db_get $PACKAGE/sysinfo
 
30
        # Choices:
 
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
 
45
        else
 
46
            rm -f $UPDATE_MOTD_LOCATION 2>/dev/null &&  /etc/init.d/update-motd refresh || true
 
47
            rm -f $PROFILE_LOCATION || true
 
48
        fi
 
49
 
 
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
 
54
 
 
55
        if [ -d $DATA_DIR/data ]; then
 
56
            rm -rf $DATA_DIR/*
 
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
 
60
                rm -rf $DATA_DIR/*
 
61
            fi
 
62
        fi
 
63
 
 
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
 
69
        fi
 
70
 
 
71
        # Fix prior ownerships
 
72
        chown -R landscape /var/log/landscape /var/lib/landscape
 
73
 
 
74
    ;;
 
75
 
 
76
    abort-upgrade|abort-remove|abort-deconfigure)
 
77
    ;;
 
78
 
 
79
    *)
 
80
        echo "postinst called with unknown argument \`$1'" >&2
 
81
        exit 1
 
82
    ;;
 
83
esac
 
84
 
 
85
# dh_installdeb will replace this with shell code automatically
 
86
# generated by other debhelper scripts.
 
87
 
 
88
#DEBHELPER#
 
89
 
 
90
exit 0