remove $Id
[Samba.git] / packaging / Debian / debian / samba-common.postinst
blob8d256f4146f0976235b9c863d929d107e1060d24
1 #!/bin/sh
5 set -e
7 # Do debconf stuff here
8 . /usr/share/debconf/confmodule
10 # We need a default smb.conf file. If one doesn't exist we put in place
11 # one that has some basic defaults.
12 if [ ! -e /etc/samba/smb.conf ]; then
13 cp -a /usr/share/samba/smb.conf /etc/samba/
16 # ------------------------- Debconf questions start ---------------------
18 # Is the user configuring with debconf, or he/she prefers swat/manual
19 # config?
20 db_get samba-common/do_debconf || true
21 if [ "${RET}" = "true" ]; then
22 # Get workgroup name
23 db_get samba-common/workgroup || true
24 WORKGROUP="${RET}"
26 TMPFILE=`mktemp -q /tmp/smb.conf.XXXXXX`
27 sed -e "s/^\([[:space:]]*\)workgroup[[:space:]]*=.*/\1workgroup = ${WORKGROUP}/" \
28 < /etc/samba/smb.conf >${TMPFILE}
29 mv -f ${TMPFILE} /etc/samba/smb.conf
31 # Encrypt passwords?
32 db_get samba-common/encrypt_passwords || true
33 ENCRYPT_PASSWORDS="${RET}"
35 TMPFILE=`mktemp -q /tmp/smb.conf.XXXXXX`
36 sed -e "s/^\([[:space:]]*\)encrypt passwords[[:space:]]*=.*/\1encrypt passwords = ${ENCRYPT_PASSWORDS}/" \
37 < /etc/samba/smb.conf >${TMPFILE}
38 mv -f ${TMPFILE} /etc/samba/smb.conf
41 chmod a+r /etc/samba/smb.conf
43 # ------------------------- Debconf questions end ---------------------
45 db_stop
47 #DEBHELPER#