blob: 1f8921f4ec4a6c4c1d8b571ae7fb77d6dbc32d42 (
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
|
#!/bin/sh -e
. /usr/share/debconf/confmodule
if [ "$1" = "configure" ]; then
db_get samba4/server-role || true
SERVER_ROLE="$RET"
fi
if [ "$1" = "configure" -a "$SERVER_ROLE" != "none" ]; then
db_get samba-common/workgroup || true
DOMAIN="$RET"
db_get samba4/realm || true
REALM="$RET"
# FIXME: Urgh.. ideally samba-tool would be able to update this:
# Update realm setting and server role setting
if [ -f "/etc/samba/smb.conf" ]; then
/usr/share/samba/setoption.py "realm" "${REALM}"
/usr/share/samba/setoption.py "server role" "${SERVER_ROLE}"
if [ "$SERVER_ROLE" = "domain controller" ]; then
/usr/share/samba/addshare.py sysvol /var/lib/samba/sysvol
/usr/share/samba/addshare.py netlogon "/var/lib/samba/sysvol/$REALM/scripts"
fi
fi
# See if we're upgrading from Samba 3
if [ ! -z "$2" ] && dpkg --compare-versions "$2" lt "3.9.0"; then
db_get samba4/upgrade-from-v3 || true
if [ "$RET" = "true" ]; then
samba-tool domain samba3upgrade --dbdir=/var/lib/samba
fi
elif [ ! -z "$2" ] && dpkg --compare-versions "$2" lt "4.0.0~alpha12"; then
# Upgrade from previous Samba 4 installation
if [ -f /etc/samba/smb.conf ]; then
samba-tool domain upgradeprovision --full
fi
elif [ -e /var/lib/samba/private/sam.ldb ]; then
# Upgrade from previous Samba 4 installation
if [ -f /etc/samba/smb.conf ]; then
samba-tool dbcheck --fix --yes
fi
fi
# Provision from scratch if we need to
if [ ! -e /var/lib/samba/private/sam.ldb ]; then
db_get samba4/admin_password
if [ -z "$RET" ]; then
PASSOPTION=" "
else
PASSOPTION="--adminpass='$RET' "
fi
# Install from scratch
# samba-common.postinst takes care of setting the work group.
samba-tool domain provision --realm="$REALM" --domain="$DOMAIN" \
--server-role="$SERVER_ROLE" --use-ntvfs $PASSOPTION
# Forget we ever saw the password
db_set samba4/admin_password ""
db_set samba4/admin_password_again ""
fi
fi
#DEBHELPER#
db_stop
exit 0
|