blob: 2013692dbb82d4ecb729797a50e9e5780dad92e0 (
plain)
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
|
#!/bin/sh -e
#
#
# Source debconf library.
. /usr/share/debconf/confmodule
RCFILE=/etc/default/samba
# Function for grabbing a parameter from an smb.conf file
smbconf_retr() {
if [ -z "$1" ]; then
return
fi
if [ -n "$2" ]; then
local FILE="$2"
fi
if [ -z "$FILE" ]; then
return
fi
sed -n -e"
s/^[[:space:]]*\[global\]/\[global\]/i
/^\[global\]/,/^[[:space:]]*\[/ {
s/^[[:space:]]*$1[[:space:]]*=[[:space:]]*//pi
}" $FILE \
| tail -n 1
}
read_rcfile() {
# Default values
if [ -f $RCFILE ]; then
. $RCFILE || true
fi
}
set_debconf() {
if [ -n "$RUN_MODE" ]; then
db_set samba/run_mode "$RUN_MODE" || true
fi
}
FILE=/etc/samba/smb.conf
db_title "Samba Server"
# We first read the settings file
# in order to get admin-modified settings
read_rcfile
# Debconf-stored values are updated accordingly
set_debconf
db_input medium samba/run_mode || true
db_go
# We vary the priority of the next question depending on whether
# the password database already exists...
if [ -e /etc/samba/smbpasswd -o -e /var/lib/samba/passdb.tdb ]; then
PRIORITY="low"
else
# If 'encrypt passwords' is true in smb.conf, and smbpasswd
# does not exist, default to yes here.
FILE=/etc/samba/smb.conf
db_fget samba/generate_smbpasswd seen
if [ "$RET" = "false" ] && [ -f "$FILE" ]; then
ENCRYPT=`smbconf_retr "encrypt passwords"`
if [ "$ENCRYPT" ]; then
ENCRYPT=`echo $ENCRYPT | tr '[A-Z]' '[a-z]'`
if [ "$ENCRYPT" = "yes" ]; then
ENCRYPT=true
fi
if [ "$ENCRYPT" = "no" ]; then
ENCRYPT=false
fi
fi
db_set samba/generate_smbpasswd "$ENCRYPT"
fi
PRIORITY="medium"
fi
db_input $PRIORITY samba/generate_smbpasswd || true
db_go
|