2 # postinst script for aiccu
4 # Abort if any command returns an error value
7 CONFIGFILE
="/etc/aiccu.conf"
8 TMPCONF
=/etc
/aiccu.conf.dpkg-tmp
9 TEMPLATE
=/usr
/share
/aiccu
/conf-templates
/aiccu.conf
10 CTLINFO
="# Under control from debconf, please use 'dpkg-reconfigure aiccu' to reconfigure"
11 BINARY
=/usr
/sbin
/aiccu
14 configure|reconfigure
)
16 .
/usr
/share
/debconf
/confmodule
18 ### find out what the user answered.
19 db_get aiccu
/username || true
22 db_get aiccu
/password || true
25 AICCUOUT
=$
($BINARY brokers
)
27 db_get aiccu
/brokername || true
28 URL
=$
(echo "$AICCUOUT" |
grep "$RET")
29 PROTO
=$
(echo $URL | cut
-f2 -d'|' | cut
-f1 -d:)
30 SERVER
=$
(echo $URL | cut
-f2 -d'|' | cut
-f3 -d/)
32 db_get aiccu
/tunnelname || true
35 # Register configuration file with ucf
36 ucfr aiccu
$CONFIGFILE
38 if [ "$USERNAME" = "" ]; then
39 # Not configured yet, thus skip
43 # Defaults when nothing gets chosen
44 # This might happen because of broken DNS
45 if [ "$PROTO" = "" ]; then
49 if [ "$SERVER" = "" ]; then
50 SERVER
="tic.sixxs.net"
53 # Make sure that files we create are not readable by anyone but us (root)
56 # Note that it is under debconf control
57 echo $CTLINFO >> $TMPCONF
59 # Replace the example lines so that they become normals
61 /^#username /c username $USERNAME
62 /^#password /c password $PASSWORD
63 /^#protocol /c protocol $PROTO
64 /^#server /c server $SERVER
65 /^#tunnel_id /c tunnel_id $TUNNEL
66 " < $TEMPLATE >> $TMPCONF
68 # Put config file into place
69 if [ -f $CONFIGFILE ]; then
70 ucf
--debconf-ok $TMPCONF $CONFIGFILE
73 mv $TMPCONF $CONFIGFILE
76 # Just in case, make sure the permissions are perfect and dandy
79 ### END (re)configure ###
82 abort-upgrade|abort-remove|abort-deconfigure
)
86 echo "postinst called with unknown argument \`$1'" >&2
91 # dh_installdeb will replace this with shell code automatically
92 # generated by other debhelper scripts.