File: plptools.postinst

package info (click to toggle)
plptools 1.0.13-1
  • links: PTS
  • area: main
  • in suites: buster
  • size: 4,452 kB
  • sloc: ansic: 17,622; sh: 12,838; cpp: 12,823; makefile: 650; yacc: 291; sed: 16
file content (117 lines) | stat: -rw-r--r-- 3,196 bytes parent folder | download | duplicates (5)
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
#! /bin/sh
# postinst script for plptools
#
# see: dh_installdeb(1)

set -e
. /usr/share/debconf/confmodule

# 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>
#        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
#          <failed-install-package> <version> `removing'
#          <conflicting-package> <version>
# for details, see /usr/share/doc/packaging-manual/
#
# quoting from the policy:
#     Any necessary prompting should almost always be confined to the
#     post-installation script, and should be protected with a conditional
#     so that unnecessary prompting doesn't happen if a package's
#     installation fails and the `postinst' is called with `abort-upgrade',
#     `abort-remove' or `abort-deconfigure'.

case "$1" in
	configure)
		START_NCPD=no
		START_PLPFUSE=no
		START_PLPPRINTD=no
		NCPD_ARGS=
		PLPFUSE_ARGS=
		PLPPRINTD_ARGS=
		FREM=
		db_get plptools/ncpd/start
		if [ "$RET" = "true" ] ; then
			START_NCPD=yes
			db_get plptools/ncpd/serial
			if [ "$RET" != "/dev/ttyS0" ] ; then
				NCPD_ARGS="$NCPD_ARGS -s $RET"
			fi
			db_get plptools/ncpd/listenat
			case "$RET" in
				127.0.0.1)
					;;
				127.0.0.1:7501)
					;;
				*)
					NCPD_ARGS="$NCPD_ARGS -p $RET"
					;;
			esac
		else
			db_get plptools/frontends/remoteaddr
			case "$RET" in
				127.0.0.1)
					;;
				127.0.0.1:7501)
					;;
				*)
					FREM="-p $RET"
					;;
			esac
		fi
	 	db_get plptools/plpfuse/start
		if [ "$RET" = "true" ] ; then
			START_PLPFUSE=yes
			PLPFUSE_ARGS="$FREM"
		fi
		db_get plptools/plpprintd/start
		if [ "$RET" = "true" ] ; then
			START_PLPPRINTD=yes
			PLPPRINTD_ARGS="$FREM"
			db_get plptools/plpprintd/printqueue
			if [ "$RET" != "psion" ] ; then
				PLPPRINTD_ARGS="$PLPPRINTD_ARGS -c 'lpr -P$RET'"
			fi
		fi
                # Strip leading whitespace from argument lists
                NCPD_ARGS=${NCPD_ARGS## }
                PLPFUSE_ARGS=${PLPFUSE_ARGS## }
                PLPPRINTD_ARGS=${PLPPRINTD_ARGS## }
                # Move /etc/plptools.conf to /etc/default/plptools if it exists
		if test -f /etc/plptools.conf; then
			mv /etc/plptools.conf /etc/default/plptools
		fi
		cp /etc/default/plptools /etc/default/plptools.$$
		cat /etc/default/plptools.$$ | sed \
			-e "s@START_NCPD=.*@START_NCPD=$START_NCPD@" \
			-e "s@START_PLPFUSE=.*@START_PLPFUSE=$START_PLPFUSE@" \
			-e "s@START_PLPPRINTD=.*@START_PLPPRINTD=$START_PLPPRINTD@" \
			-e "s@NCPD_ARGS=.*@NCPD_ARGS=\"$NCPD_ARGS\"@" \
			-e "s@PLPFUSE_ARGS=.*@PLPFUSE_ARGS=\"$PLPFUSE_ARGS\"@" \
			-e "s@PLPPRINTD_ARGS=.*@PLPPRINTD_ARGS=\"$PLPPRINTD_ARGS\"@" \
			> /etc/default/plptools \
		&& rm -f /etc/default/plptools.$$ \
		|| mv /etc/default/plptools.$$ /etc/default/plptools || :
	;;

	abort-upgrade|abort-remove|abort-deconfigure)
	;;

	*)
		echo "postinst called with unknown argument \`$1'" >&2
		exit 0
	;;
esac

# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.

#DEBHELPER#

db_stop

exit 0