File: config

package info (click to toggle)
otrs2 2.0.4p01-18
  • links: PTS
  • area: main
  • in suites: etch
  • size: 7,900 kB
  • ctags: 4,437
  • sloc: perl: 81,607; xml: 8,135; sql: 8,013; sh: 1,113; makefile: 22; php: 16
file content (74 lines) | stat: -rw-r--r-- 1,453 bytes parent folder | download | duplicates (4)
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
#!/bin/sh

set -e

print_config()
{
  cat << EOF
dbname="$dbname"
dbserver="$dbserver"
dbport="$dbport"
dbuser="$dbuser"
dbpass="$dbpass"
dbtype="$dbtype"
EOF
}

get_config()
{
  set +e
  
  DSN=$(/usr/share/otrs/bin/otrs.getConfig DatabaseDSN)
  TYPE=$(echo $DSN | awk -F: '{ print $2 }')
  DSNOPTIONS=$(echo $DSN | awk -F: '{ print $3 }')
  eval $DSNOPTIONS
  case $TYPE in
    Pq)    dbtype="pgqsl"
           dbname=${dbname:-otrs}
           ;;
    mysql) dbtype="mysql"
           dbname=${database:-otrs}
           ;;
  esac

  dbserver=${host:-localhost}
  dbuser=$(/usr/share/otrs/bin/otrs.getConfig DatabaseUser)
  dbuser=${dbuser:-otrs}
  dbpass=$(/usr/share/otrs/bin/otrs.getConfig DatabasePw)

  print_config > $TMPFILE

  set -e
}

. /usr/share/debconf/confmodule
dbc_dbtypes="mysql, pgsql"

TMPFILE=$(mktemp)
if [ -f "/etc/otrs/Kernel/Config.pm" ]; then
  get_config
fi

dbc_dbuser="otrs"
dbc_authmethod_user="ident"
dbc_first_version="2.0.4p01-10"
dbc_load_include="sh:$TMPFILE"
if [ -f /usr/share/dbconfig-common/dpkg/config ]; then
  . /usr/share/dbconfig-common/dpkg/config
  dbc_go otrs2 "$@"
fi

# FIXME: db_get otrs2/database-type = pgsql
db_get otrs2/pgsql/authmethod-user
METHOD="$RET"
db_get otrs2/db/app-user
USER="$RET"
if [ "$METHOD" = ident -a "$USER" != otrs ]; then
  db_input high otrs2/resetdbuser || true
  db_go || true
  db_get otrs2/resetdbuser
  if [ $RET = true ]; then
    db_set otrs2/db/app-user otrs
  fi
fi