diff options
Diffstat (limited to 'packaging/Debian/debian/samba-common.config')
-rw-r--r-- | packaging/Debian/debian/samba-common.config | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/packaging/Debian/debian/samba-common.config b/packaging/Debian/debian/samba-common.config new file mode 100644 index 00000000000..c82dd887b06 --- /dev/null +++ b/packaging/Debian/debian/samba-common.config @@ -0,0 +1,61 @@ +#/bin/sh -e + +# Source debconf library. +. /usr/share/debconf/confmodule + +FILE=/etc/samba/smb.conf + +db_title "Samba Server" + +db_input medium samba-common/do_debconf || true +db_go + +# If user doesn't want to use debconf to configure Samba the leave... +db_get samba-common/do_debconf || true +if [ "${RET}" = "false" ]; then + exit 0 +fi + +# User wants to use debconf, let's continue... + +# Adjust priority of the question about the workgroup name depending +# on whether a workgroup name has already being specified. +db_get samba-common/workgroup || true +if [ "${RET}" ]; then + WGPRIORITY=medium +else + WGPRIORITY=high +fi + +# Preload any values from the existing smb.conf file +if [ -f $FILE ]; then + WORKGROUP=`grep -i '^[[:space:]]*workgroup[[:space:]]*=' $FILE \ + | sed -e's/^[[:space:]]*workgroup[[:space:]]*=[[:space:]]*//i' \ + | tail -1` + if [ "$WORKGROUP" ]; then + db_set samba-common/workgroup "$WORKGROUP" + fi + + ENCRYPT=`grep -i '^[[:space:]]*encrypt passwords[[:space:]]*=' $FILE \ + | sed -e's/^[[:space:]]*encrypt passwords[[:space:]]*=[[:space:]]*//i' \ + | tail -1` + if [ "$ENCRYPT" ]; then + ENCRYPT=`echo $ENCRYPT | tr '[A-Z]' '[a-z]'` + if [ "$ENCRYPT" = "yes" ]; then + ENCRYPT=true + elif [ "$ENCRYPT" = "no" ]; then + ENCRYPT=false + fi + + db_set samba-common/encrypt_passwords "$ENCRYPT" + fi +fi + +# Get workgroup name +db_input $WGPRIORITY samba-common/workgroup || true +db_go + +# Use encrypted passwords? +db_input medium samba-common/encrypt_passwords || true +db_go + |