source: trunk/packages/xvm-iscsi-config/debian/xvm-iscsi-config.postinst @ 1923

Last change on this file since 1923 was 1923, checked in by price, 15 years ago

xvm-iscsi-config: don't restart on upgrade, only first install

  • Property svn:executable set to *
File size: 2.0 KB
Line 
1#!/bin/sh
2# postinst script for xvm-iscsi-config
3#
4# see: dh_installdeb(1)
5
6set -e
7
8# Source debconf library
9. /usr/share/debconf/confmodule
10
11# summary of how this script can be called:
12#        * <postinst> `configure' <most-recently-configured-version>
13#        * <old-postinst> `abort-upgrade' <new version>
14#        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
15#          <new-version>
16#        * <postinst> `abort-remove'
17#        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
18#          <failed-install-package> <version> `removing'
19#          <conflicting-package> <version>
20# for details, see http://www.debian.org/doc/debian-policy/ or
21# the debian-policy package
22
23# dh_installdeb will replace this with shell code automatically
24# generated by other debhelper scripts.
25
26#DEBHELPER#
27
28case "$1" in
29    configure)
30        db_get xvm-iscsi-config/address
31        ADDRESS="$RET"
32        db_get xvm-iscsi-config/username
33        USERNAME="$RET"
34        db_get xvm-iscsi-config/password
35        PASSWORD="$RET"
36        db_stop
37       
38        cat >/etc/invirt/conf.d/iscsi <<EOF
39iscsi:
40 address: $ADDRESS
41 username: $USERNAME
42 password: $PASSWORD
43EOF
44        if [ -z "$2" ]; then
45            invoke-rc.d xvm-iscsi-config restart
46            invoke-rc.d open-iscsi restart
47            iscsiadm -m discovery -t st -p $(invirt-getconf iscsi.address):3260
48        else
49            # Don't disrupt an existing installation.
50            cat <<EOF
51xvm-iscsi-config: If the configuration has changed, restart iscsi:
52  /etc/init.d/xvm-iscsi-config restart
53  /etc/init.d/open-iscsi restart
54  iscsiadm -m discovery -t st -p $(invirt-getconf iscsi.address):3260
55  lvchange -a ln /dev/xenvg && lvchange -a y /dev/xenvg
56This will leave VMs unable to access their disks, so migrate them first.
57
58EOF
59        fi
60    ;;
61
62    abort-upgrade|abort-remove|abort-deconfigure)
63    ;;
64
65    *)
66        echo "postinst called with unknown argument \`$1'" >&2
67        exit 1
68    ;;
69esac
70
71exit 0
Note: See TracBrowser for help on using the repository browser.