File: cyphesis-cpp.postinst

package info (click to toggle)
cyphesis-cpp 0.5.16-1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 5,084 kB
  • ctags: 3,627
  • sloc: cpp: 30,418; python: 4,812; xml: 4,674; sh: 4,118; makefile: 902; ansic: 617
file content (70 lines) | stat: -rw-r--r-- 1,608 bytes parent folder | download | duplicates (3)
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
#!/bin/sh

set -e

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

CONFFILE=/etc/cyphesis/cyphesis.vconf

if [ "$1" = configure ] ;
then

    # check if user cyphesis already exists
    getent passwd cyphesis >/dev/null 2>&1 ||
        {
            # adding user cyphesis as system user
            adduser --system --no-create-home --home /usr/share/cyphesis --shell /bin/bash --gecos "Cyphesis C++ Administrator" --disabled-password cyphesis
        }

    if [ ! -f $CONFFILE ] ;
    then
        cp /usr/share/cyphesis/cyphesis.vconf $CONFFILE
    fi

    # get the return values
    db_get cyphesis-cpp/postgresql/local_server
    LOCAL=$RET
    
    db_get cyphesis-cpp/postgresql/server
    DB_HOST=$RET

    db_get cyphesis-cpp/postgresql/database
    DB_NAME=$RET

    db_get cyphesis-cpp/postgresql/username
    DB_USER=$RET

    db_get cyphesis-cpp/postgresql/password
    DB_PWD=$RET

    db_get cyphesis-cpp/usemetaserver
    USE_META=$RET

    # set values in conffile
    sed -e "s/^.*dbserver *=.*/dbserver=\"$DB_HOST\"/" \
        -e "s/^.*dbname *=.*/dbname=\"$DB_NAME\"/" \
        -e "s/^.*dbuser *=.*/dbuser=\"$DB_USER\"/" \
        -e "s/^.*dbpasswd *=.*/dbpasswd=\"$DB_PWD\"/" \
        -e "s/^.*usemetaserver *=.*/usemetaserver=\"$USE_META\"/" \
        < $CONFFILE \
	> $CONFFILE.tmp
    mv $CONFFILE.tmp $CONFFILE

    # comment out dbserver if unix sockets should be used
    if [ "x$LOCAL" = xtrue ] ;
    then
        sed -e "s/^dbserver/#dbserver/" \
        < $CONFFILE \
	> $CONFFILE.tmp
        mv $CONFFILE.tmp $CONFFILE
    fi

fi

db_stop

#DEBHELPER#

exit 0