~ubuntu-branches/ubuntu/natty/seyon/natty

« back to all changes in this revision

Viewing changes to debian/seyon/DEBIAN/config

  • Committer: Bazaar Package Importer
  • Author(s): Steve McIntyre
  • Date: 2006-08-13 20:38:54 UTC
  • mfrom: (3.1.3 edgy)
  • Revision ID: james.westby@ubuntu.com-20060813203854-y8z5x7ysf6ry5glt
Tags: 2.20c-22
* Fix bashisms in the debian build (config.include). Closes: #380108
* Added Portuguese debconf template. Thanks to Luisa Lourenco and Rui
  Branco for the patch. Closes: #381712
* Updated Standards-Version.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh -e
 
2
 
 
3
# Some ideas stolen from the cvs package
 
4
 
 
5
# Config script for seyon using debconf
 
6
. /usr/share/debconf/confmodule
 
7
db_version 2.0 || [ $? -lt 30 ]
 
8
 
 
9
db_title "Seyon communication software"
 
10
 
 
11
# Defaults
 
12
MODEMDEFAULTS=/etc/X11/seyon/Seyon-modem
 
13
DEFAULTPORT=/dev/modem
 
14
PORT=$DEFAULTPORT
 
15
 
 
16
read_rcfile() {
 
17
    # Default values
 
18
    if [ -f $MODEMDEFAULTS ]; then
 
19
       PORT=`cat $MODEMDEFAULTS | grep -m1 "^seyon\*modems:" | cut -f2 -d: 2>/dev/null`
 
20
    fi
 
21
    if [ -z $PORT ] ; then
 
22
       PORT=$DEFAULTPORT
 
23
    fi
 
24
}
 
25
 
 
26
write_rcfile() {
 
27
    TEMPFILE=`tempfile`
 
28
    if [ -f $MODEMDEFAULTS ]; then
 
29
       ESCAPEDPORT=`echo $PORT | sed 's/\//\\\\\//g'`
 
30
       sed "s/^seyon\*modems:.*$/seyon\*modems: ${ESCAPEDPORT}/" $MODEMDEFAULTS > $TEMPFILE
 
31
       chmod --reference=$MODEMDEFAULTS $TEMPFILE
 
32
       chown --reference=$MODEMDEFAULTS $TEMPFILE
 
33
    else
 
34
       echo "seyon*modems: $PORT" > $TEMPFILE
 
35
       chmod 640 $TEMPFILE
 
36
       chown root:dialout $TEMPFILE
 
37
    fi
 
38
    if [ ! -d /etc/X11/seyon ] ; then
 
39
        mkdir -p /etc/X11/seyon
 
40
    fi
 
41
    mv $TEMPFILE $MODEMDEFAULTS
 
42
}
 
43
 
 
44
set_debconf() {
 
45
    if [ "$PORT" ]; then
 
46
        db_set seyon/device "$PORT" || true
 
47
    fi
 
48
}
 
49
 
 
50
get_debconf() {
 
51
    db_get seyon/device
 
52
    PORT=$RET
 
53
    # If not present, use default
 
54
    if [ "$PORT" = "" ]
 
55
    then
 
56
       PORT=$DEFAULTPORT
 
57
    fi
 
58
}
 
59
 
 
60
 
 
61
input_settings() {
 
62
    db_input low seyon/device || true
 
63
    db_go
 
64
    db_get seyon/device
 
65
    PORT=$RET
 
66
    # If not present, use default
 
67
    if [ "$PORT" = "" ]
 
68
    then
 
69
       PORT=$DEFAULTPORT
 
70
    fi
 
71
}
 
72
 
 
73
 
 
74
## Main program
 
75
# We first read the settings file
 
76
# in order to get admin-modified settings
 
77
read_rcfile
 
78
# Debconf-stored values are updated accordingly
 
79
set_debconf
 
80
# They are re-read from Debconf
 
81
get_debconf
 
82
# In case the package has never been configured, the settings
 
83
# are asked through debconf
 
84
input_settings
 
85
# They are re-re-read from debconf
 
86
# for updating variables 
 
87
get_debconf
 
88
# The settings file is written
 
89
write_rcfile
 
90
# Then we do some other stuff, which could sometimes lead to
 
91
# debconf showing screens
 
92
# This is why they are here and not in the postinst script