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 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94
|
#!/bin/sh -e
. /usr/share/debconf/confmodule
if [ -e /etc/default/oftpd ]; then
USER=""
ENABLE="no"
DIR=""
PORT=""
IFACE=""
MAXCON=""
. /etc/default/oftpd || true
if [ "$USER" ]; then
db_set oftpd/which_user $USER
fi
if [ "$ENABLE" = "yes" ]; then
db_set oftpd/enable_oftpd "true"
else
db_set oftpd/enable_oftpd "false"
fi
if [ "$DIR" ]; then
db_set oftpd/which_dir $DIR
fi
if [ "$PORT" ]; then
db_set oftpd/which_port $PORT
fi
if [ "$IFACE" ]; then
db_set oftpd/which_iface $IFACE
fi
if [ "$MAXCON" ]; then
db_set oftpd/max_conn $MAXCON
fi
fi
db_input high oftpd/log_file_msg || true
db_go
db_input medium oftpd/enable_oftpd || true
db_go
db_get oftpd/enable_oftpd
if [ "$RET" = "true" ]; then
EXIT_LOOP="false"
while [ "$EXIT_LOOP" != "true" ]; do
db_input medium oftpd/option_menu || true
db_go
db_get oftpd/option_menu
case "$RET" in
"User to run the server as")
USER_OKAY="false"
while [ "$USER_OKAY" != "true" ]; do
db_input medium oftpd/which_user || true
db_go
db_get oftpd/which_user
[ -n "$RET" ] && USER_TEST=$(cut -d ':' -f 1 < /etc/passwd | grep -w "$RET") || true
if [ -n "$USER_TEST" -o "$RET" = "oftpd" -o -z "$RET" ]; then
USER_OKAY="true"
else
db_input medium oftpd/user_does_not_exist || true
db_go
db_fset oftpd/which_user seen false
fi
done
RET="User to run the server as"
;;
"Directory to serve")
db_input medium oftpd/which_dir || true
db_go
;;
"Port to listen on")
db_input medium oftpd/which_port || true
db_go
;;
"Interface to listen on")
db_input medium oftpd/which_iface || true
db_go
;;
"Max number of connections")
db_input medium oftpd/max_conn || true
db_go
;;
"Exit")
EXIT_LOOP="true"
;;
esac
if [ "$EXIT_LOOP" != "true" ]; then
db_fset oftpd/option_menu seen false
fi
done
fi
exit 0
|