diff options
Diffstat (limited to 'packaging/Debian/debian/samba-common.postinst')
-rw-r--r-- | packaging/Debian/debian/samba-common.postinst | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/packaging/Debian/debian/samba-common.postinst b/packaging/Debian/debian/samba-common.postinst new file mode 100644 index 00000000000..54b5679932e --- /dev/null +++ b/packaging/Debian/debian/samba-common.postinst @@ -0,0 +1,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# |