1 #!/bin/sh
2 set -e
3 . /usr/share/debconf/confmodule
4 db_capb backup
5 db_title "GOsa-SI Database Setup"
7 STATE=1
8 while true; do
9 case "$STATE" in
10 1)
11 db_input medium gosa-si/hostname || true
12 ;;
13 2)
14 db_input medium gosa-si/database || true
15 ;;
16 3)
17 db_input high gosa-si/username || true
18 ;;
19 4)
20 db_input high gosa-si/password || true
21 ;;
22 5)
23 db_input critical gosa-si/rootpw || true
24 ;;
25 *)
26 # The default case catches when $STATE is greater than the
27 # last implemented state, and breaks out of the loop. This
28 # requires that states be numbered consecutively from 1
29 # with no gaps, as the default case will also be entered
30 # if there is a break in the numbering
31 break # exits the enclosing "while" loop ;;
32 esac
34 if db_go; then
35 STATE=$(($STATE + 1))
36 else
37 STATE=$(($STATE - 1))
38 fi
39 done
41 if [ $STATE -eq 1 ]; then
42 # The user has asked to back up from the first
43 # question. This case is problematical. Regular
44 # dpkg and apt package installation isn’t capable
45 # of backing up questions between packages as this
46 # is written, so this will exit leaving the package
47 # unconfigured - probably the best way to handle
48 # the situation.
49 exit 10
50 fi