5 # Source debconf library.
6 . /usr/share/debconf/confmodule
8 RCFILE=/etc/default/samba
10 # Function for grabbing a parameter from an smb.conf file
20 if [ -z "$FILE" ]; then
25 s/^[[:space:]]*\[global\]/\[global\]/i
26 /^\[global\]/,/^[[:space:]]*\[/ {
27 s/^[[:space:]]*$1[[:space:]]*=[[:space:]]*//pi
34 if [ -f $RCFILE ]; then
40 if [ -n "$RUN_MODE" ]; then
41 db_set samba/run_mode "$RUN_MODE" || true
45 FILE=/etc/samba/smb.conf
47 db_title "Samba Server"
49 # Babysit users who don't read README.Debian
50 if [ -n "$2" ] && dpkg --compare-versions "$2" lt "2.2"
52 db_input medium samba/log_files_moved || true
57 # We first read the settings file
58 # in order to get admin-modified settings
60 # Debconf-stored values are updated accordingly
62 db_input medium samba/run_mode || true
66 # Offer to move the password database for existing users
67 if [ "$1" = "configure" -a -n "$2" -a -e /etc/samba/smbpasswd \
68 -a ! -e /var/lib/samba/passdb.tdb ] \
69 && dpkg --compare-versions "$2" lt 2.99.cvs.20020713-2
71 FILE=/etc/samba/smb.conf
73 if [ -f "$FILE" ]; then
74 PASSDB=`smbconf_retr "passdb backend"`
77 if echo "$PASSDB" | grep -q ldapsam; then
80 db_get samba-common/do_debconf || true
81 if [ "${RET}" = "false" ]; then
85 db_input "$TDBPRIORITY" samba/tdbsam || true
88 # We vary the priority of the next question depending on whether
89 # the password database already exists...
90 if [ -e /etc/samba/smbpasswd -o -e /var/lib/samba/passdb.tdb ]; then
93 # If 'encrypt passwords' is true in smb.conf, and smbpasswd
94 # does not exist, default to yes here.
95 FILE=/etc/samba/smb.conf
96 if [ -f "$FILE" ]; then
97 ENCRYPT=`smbconf_retr "encrypt passwords"`
98 if [ "$ENCRYPT" ]; then
99 ENCRYPT=`echo $ENCRYPT | tr '[A-Z]' '[a-z]'`
100 if [ "$ENCRYPT" = "yes" ]; then
103 if [ "$ENCRYPT" = "no" ]; then
107 db_set samba/generate_smbpasswd "$ENCRYPT"
112 db_input $PRIORITY samba/generate_smbpasswd || true