File: postinst

package info (click to toggle)
tipcutils 1.0.4-5
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 220 kB
  • ctags: 211
  • sloc: ansic: 1,588; sh: 251; makefile: 59
file content (119 lines) | stat: -rw-r--r-- 3,072 bytes parent folder | download | duplicates (2)
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
#!/bin/sh
# postinst script for tipcutils
#
# see: dh_installdeb(1)

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

TIPC_CONF_FILE=/etc/default/tipcutils

# Source debconf library.
. /usr/share/debconf/confmodule

read_debconf_config() {
	db_get tipcutils/configure || true
	TIPC_CONFIGURED=$RET
	db_get tipcutils/address || true
	TIPC_ADDR=$RET
	db_get tipcutils/netid || true
	TIPC_NETID=$RET
	db_get tipcutils/remote_management || true
	TIPC_REMOTE=$RET
	db_get tipcutils/default_ndd || true
	TIPC_DEF_NDD=$RET
	db_get tipcutils/interfaces || true
	TIPC_INTERFACES=$RET
	db_get tipcutils/script_verbosity || true
	TIPC_SCRIPT_VERBOSITY=$RET
}

write_tmp_config_file() {
	TMP_FILE=$1

read_debconf_config

# write the temporary configfile
	cat > $TMP_FILE << __EOF
################################################################################
# TIPCutils Configuration File
#
# This file is automatically written by the postinst script of the tipcutils
# package.  Manual changes to this file are respected by the init and
# if-{up,down} scripts of tipcutils.  Anyway they might not be respected at
# package upgrade.  Consider updating your TIPC configuration by running
# \`dpkg-reconfigure -plow tipcutils\`.
################################################################################

# "true" or "false" to en-/disable TIPC
TIPC_CONFIGURED=$TIPC_CONFIGURED

# set the verbosity of the init scripts
TIPC_VERBOSITY=$TIPC_SCRIPT_VERBOSITY

# the local tipc address
TIPC_ADDR=$TIPC_ADDR

# the network id used by tipc
TIPC_NETID=$TIPC_NETID

# "true" or "false" to en-/disable TIPC remote management
TIPC_REMOTE_MANAGEMENT=$TIPC_REMOTE

# default neighbour detection domain where TIPC will
# automatically set up links to
TIPC_DEFAULT_NDD=$TIPC_DEF_NDD

# interfaces to enable for TIPC
# the elements of this list are separated by spaces
TIPC_INTERFACES="$TIPC_INTERFACES"
__EOF
}


case "$1" in
    configure)
	umask 0077
	TMP_FILE=`mktemp /tmp/tipcutils.XXXXXX`
	write_tmp_config_file $TMP_FILE

	# XXX actually this should ask the user before doing that
	cp $TMP_FILE $TIPC_CONF_FILE

	if [ -f $TIPC_CONF_FILE ]; then
	    chown root:root $TIPC_CONF_FILE
	    chmod 644 $TIPC_CONF_FILE
	fi
	if [ -f $TMP_FILE ]; then
	    rm -f $TMP_FILE
	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.

#DEBHELPER#

exit 0