summaryrefslogtreecommitdiff
path: root/packaging/Debian/debian/samba-common.postinst
blob: 54b5679932e708c1be6a226c37ece7e6f44c19dc (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
#!/bin/sh
#
#

set -e

# We need a default smb.conf file. If one doesn't exist we put in place
#	one that has some basic defaults.
if [ ! -e /etc/samba/smb.conf ]; then
	cp -a /usr/share/samba/smb.conf /etc/samba/
fi

# Do debconf stuff here
. /usr/share/debconf/confmodule

# ------------------------- Debconf questions start ---------------------

# Is the user configuring with debconf, or he/she prefers swat/manual
#	config?
db_get samba-common/do_debconf || true
if [ "${RET}" = "true" ]; then
	# Get workgroup name
	db_get samba-common/workgroup || true
	WORKGROUP="${RET}"

	TMPFILE=`mktemp -q /tmp/smb.conf.XXXXXX`
	sed -e "s/^\([[:space:]]*\)workgroup[[:space:]]*=.*/\1workgroup = ${WORKGROUP}/" \
		< /etc/samba/smb.conf >${TMPFILE}
	mv -f ${TMPFILE} /etc/samba/smb.conf

	# Encrypt passwords?
	db_get samba-common/encrypt_passwords || true
	ENCRYPT_PASSWORDS="${RET}"

	TMPFILE=`mktemp -q /tmp/smb.conf.XXXXXX`
	sed -e "s/^\([[:space:]]*\)encrypt passwords[[:space:]]*=.*/\1encrypt passwords = ${ENCRYPT_PASSWORDS}/" \
		< /etc/samba/smb.conf >${TMPFILE}
	mv -f ${TMPFILE} /etc/samba/smb.conf
fi

chmod a+r /etc/samba/smb.conf

# ------------------------- Debconf questions end ---------------------

db_stop

#DEBHELPER#