Lets keep our version of opftpd in the CVS
[oftpd.git] / debian / oftpd.config
1 #!/bin/sh -e
2
3 . /usr/share/debconf/confmodule
4
5 if [ -e /etc/default/oftpd ]; then
6         USER=""
7         ENABLE="no"
8         DIR=""
9         PORT=""
10         IFACE=""
11         MAXCON=""
12         . /etc/default/oftpd || true
13         if [ "$USER" ]; then
14                 db_set oftpd/which_user $USER
15         fi
16         if [ "$ENABLE" = "yes" ]; then
17                 db_set oftpd/enable_oftpd "true"
18         else
19                 db_set oftpd/enable_oftpd "false"
20         fi
21         if [ "$DIR" ]; then
22                 db_set oftpd/which_dir $DIR
23         fi
24         if [ "$PORT" ]; then
25                 db_set oftpd/which_port $PORT
26         fi
27         if [ "$PASV_RANGE" ]; then
28                 db_set oftpd/which_pasv_range $PASV_RANGE
29         fi
30         if [ "$IFACE" ]; then
31                 db_set oftpd/which_iface $IFACE
32         fi
33         if [ "$MAXCON" ]; then
34                 db_set oftpd/max_conn $MAXCON
35         fi
36 fi      
37
38 db_input high oftpd/log_file_msg || true
39 db_go
40
41 db_input medium oftpd/enable_oftpd || true
42 db_go
43
44 db_get oftpd/enable_oftpd
45
46 if [ "$RET" = "true" ]; then
47         EXIT_LOOP="false"
48         while [ "$EXIT_LOOP" != "true" ]; do
49                 db_input medium oftpd/option_menu || true
50                 db_go
51
52                 db_get oftpd/option_menu
53                 case "$RET" in
54                         "User to run the server as")
55                                 USER_OKAY="false"
56                                 while [ "$USER_OKAY" != "true" ]; do
57                                         db_input medium oftpd/which_user || true
58                                         db_go
59                                         db_get oftpd/which_user
60                                         [ -n "$RET" ] && USER_TEST=$(cut -d ':' -f 1 < /etc/passwd | grep -w "$RET") || true
61                                         if [ -n "$USER_TEST" -o "$RET" = "oftpd" -o -z "$RET" ]; then
62                                                 USER_OKAY="true"
63                                         else
64                                                 db_input medium oftpd/user_does_not_exist || true
65                                                 db_go
66                                                 db_fset oftpd/which_user seen false
67                                         fi
68                                 done
69                                 RET="User to run the server as"
70                                 ;;
71                         "Directory to serve")
72                                 db_input medium oftpd/which_dir || true
73                                 db_go
74                                 ;;
75                         "Port to listen on")
76                                 db_input medium oftpd/which_port || true
77                                 db_go
78                                 ;;
79                         "Passive port range")
80                                 db_input medium oftpd/which_pasv_range || true
81                                 db_go
82                                 ;;
83                         "Interface to listen on")
84                                 db_input medium oftpd/which_iface || true
85                                 db_go
86                                 ;;
87                         "Max number of connections")
88                                 db_input medium oftpd/max_conn || true
89                                 db_go
90                                 ;;
91                         "Exit")
92                                 EXIT_LOOP="true"
93                                 ;;
94                 esac
95                 if [ "$EXIT_LOOP" != "true" ]; then
96                         db_fset oftpd/option_menu seen false
97                 fi
98         done
99 fi
100
101 exit 0