44f3010b4b537ed9f8750069935404e0f266704d
[kivitendo-erp.git] / DEBIAN / DEBIAN / config
1 #!/bin/sh
2
3 set -e
4 #set -x
5
6
7 # Source debconf library
8 . /usr/share/debconf/confmodule
9 db_version 2.0
10
11 STATE=1
12 LASTSTATE=4
13 while [ "$STATE" != 0 ] && [ "$STATE" -le "$LASTSTATE" ]; do
14     case "$STATE" in
15     1)
16             db_set lx-office-erp/admin-password-conf true || true
17         db_input high lx-office-erp/admin-password-conf || true
18             db_go || true
19             ;;
20         2)
21             db_get lx-office-erp/admin-password-conf 
22             if [ "$RET" = "true" ]; then
23                 db_input high lx-office-erp/admin-password || true
24                                 db_go || true
25                                 db_input high lx-office-erp/admin-password2 || true
26                                 db_go || true
27
28             fi
29            ;;
30         3)
31             db_get lx-office-erp/admin-password-conf 
32             if [ "$RET" = "true" ]; then
33                 db_get lx-office-erp/admin-password || true
34                 PASSPHRASE="$RET"
35                 db_get lx-office-erp/admin-password2 || true
36                 if [ "$RET" != "$PASSPHRASE" ]; then
37                     db_input high lx-office-erp/password-mismatch 
38                     db_reset lx-office-erp/admin-password || true
39                     db_reset lx-office-erp/admin-password2 || true
40                     db_fset lx-office-erp/admin-password seen false || true
41                     db_fset lx-office-erp/admin-password2 seen false || true
42                     STATE=1
43                 fi
44             fi
45             ;;
46         4)
47            db_input high lx-office-erp/lx-office-erp-user-postgresql-password || true
48            db_go || true
49            db_get lx-office-erp/lx-office-erp-user-postgresql-password || true
50            POSTGRESQLPWD="$RET"
51            if [ "#$POSTGRESQLPWD" != "#" ]; then
52                     db_input high lx-office-erp/lx-office-erp-user-postgresql-password2 || true
53                 db_go || true
54                 db_get lx-office-erp/lx-office-erp-user-postgresql-password2 || true
55             if [ "$RET" != "$POSTGRESQLPWD" ]; then
56                                         db_input high lx-office-erp/password-mismatch 
57                                         db_reset lx-office-erp/lx-office-erp-user-postgresql-password || true
58                                         db_reset lx-office-erp/lx-office-erp-user-postgresql-password2 || true
59                                         db_fset lx-office-erp/lx-office-erp-user-postgresql-password seen false || true
60                                         db_fset lx-office-erp/lx-office-erp-user-postgresql-password2 seen false || true
61                                         STATE=3
62                     fi
63            else
64                         db_input high lx-office-erp/password-empty || true
65                 db_go || true
66                         db_reset lx-office-erp/lx-office-erp-user-postgresql-password || true
67                         db_fset lx-office-erp/lx-office-erp-user-postgresql-password seen false || true
68                         STATE=3
69            fi
70
71            ;;
72         
73     esac
74
75     if db_go; then
76         STATE=$(($STATE + 1))
77     else
78         STATE=$(($STATE - 1))
79     fi
80 done