summaryrefslogtreecommitdiff
path: root/packaging/Debian/debian-unstable/samba-common.config
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2004-05-14 12:42:42 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 10:51:35 -0500
commitc32c36d96f3a7863ab8514456e8a0eb9e4839264 (patch)
treedfc31bfe53dea0b3460f8c5f823d8d9ed65c13ec /packaging/Debian/debian-unstable/samba-common.config
parent400bed7a68ccdeeb8c50326e817788e01b155907 (diff)
downloadsamba-c32c36d96f3a7863ab8514456e8a0eb9e4839264.tar.gz
samba-c32c36d96f3a7863ab8514456e8a0eb9e4839264.tar.bz2
samba-c32c36d96f3a7863ab8514456e8a0eb9e4839264.zip
r730: move the current debian dir to debian-unstable
(This used to be commit 65022f1dde7012a8c8c1872ad87184531973b5c5)
Diffstat (limited to 'packaging/Debian/debian-unstable/samba-common.config')
-rw-r--r--packaging/Debian/debian-unstable/samba-common.config154
1 files changed, 154 insertions, 0 deletions
diff --git a/packaging/Debian/debian-unstable/samba-common.config b/packaging/Debian/debian-unstable/samba-common.config
new file mode 100644
index 0000000000..766f0ddb7e
--- /dev/null
+++ b/packaging/Debian/debian-unstable/samba-common.config
@@ -0,0 +1,154 @@
+#/bin/sh -e
+
+# Source debconf library.
+. /usr/share/debconf/confmodule
+
+# Function for grabbing a parameter from an smb.conf file
+smbconf_retr() {
+ if [ -z "$1" ]; then
+ return
+ fi
+
+ if [ -n "$2" ]; then
+ local FILE="$2"
+ fi
+
+ if [ -z "$FILE" ]; then
+ return
+ fi
+
+ sed -n -e"
+ s/^[[:space:]]*\[global\]/\[global\]/i
+ /^\[global\]/,/^[[:space:]]*\[/ {
+ s/^[[:space:]]*$1[[:space:]]*=[[:space:]]*//pi
+ }" $FILE \
+ | tail -n 1
+}
+
+FILE=/etc/samba/smb.conf
+
+db_title "Samba Server"
+
+# We ask the question IFF the config contains complex options that could
+# cause us to break the config.
+if [ -f "$FILE" ] && grep -v dhcp.conf $FILE \
+ | grep -qEi '\\$|^[[:space:]]*include[[:space:]]*='
+then
+ db_input high samba-common/do_debconf || true
+ db_go
+else
+ db_set samba-common/do_debconf true
+fi
+
+# 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=`smbconf_retr workgroup`
+ if [ "$WORKGROUP" ]; then
+ db_set samba-common/workgroup "$WORKGROUP"
+ fi
+
+ ENCRYPT=`smbconf_retr "encrypt passwords"`
+ 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
+
+ CHARSET=`smbconf_retr "character set"`
+ CODEPAGE=`smbconf_retr "client code page"`
+ UNIXCHARSET=`smbconf_retr "unix charset"`
+ DOSCHARSET=`smbconf_retr "dos charset"`
+
+ # If we're upgrading from an old version and there's no
+ # 'passdb backend' setting, add one.
+ if [ "$1" = "configure" -a -n "$2" ] \
+ && dpkg --compare-versions "$2" lt 2.99.cvs.20020713-2 \
+ && ! grep -q -i '^[[:space:]]*passdb backend[[:space:]]*=' $FILE
+ then
+ TMPFILE=/etc/samba/smb.conf.dpkg-tmp
+ sed -e'
+ s/^\([[:space:]]*\)\[global\]/\1\[global\]/i
+ s/^\([[:space:]]*\)encrypt passwords/\1encrypt passwords/i
+ /^[[:space:]]*\[global\]/,/^[[:space:]]*\[/ {
+ /^[[:space:]]*encrypt passwords[[:space:]]*=/a \
+ passdb backend = smbpasswd guest
+ }' < $FILE > ${TMPFILE}
+ chmod a+r ${TMPFILE}
+ mv -f ${TMPFILE} /etc/samba/smb.conf
+ 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
+
+# Handle migrating character sets
+if [ -n "$CHARSET" -a -z "$UNIXCHARSET" ]
+then
+ UNIXCHARSET=`echo $CHARSET | sed -e's/iso-/ISO/i'`
+ db_set samba-common/character_set "$UNIXCHARSET"
+ # FIXME: should eventually be low.
+ db_input medium samba-common/character_set || true
+ db_go
+fi
+
+if [ -n "$CODEPAGE" -a -z "$DOSCHARSET" ]
+then
+ DOSCHARSET=CP`echo $CODEPAGE | sed -e's/[[:alpha:]]*//g'`
+ db_set samba-common/codepage "$DOSCHARSET"
+ # FIXME: should eventually be low.
+ db_input medium samba-common/codepage || true
+ db_go
+fi
+
+DHCPPRIORITY=medium
+#if [ "$DEBCONF_RECONFIGURE" = 1 ] && [ -f /sbin/dhclient3 ]
+if [ -f /sbin/dhclient3 ]
+then
+ DHCPPRIORITY=high
+# TODO: see if we can detect that dhcp3-client is *going* to be installed,
+# even if it isn't yet.
+#elif dpkg-query -W --showformat='${Status}\n' dhcp3-client | grep ???
+# unknown ok not-installed ?
+# DHCPPRIORITY=high
+fi
+
+if [ ! -f $FILE ] || grep -q -i 'wins server' $FILE
+then
+ # check the values before and after; unset the 'applied' flag
+ # if they don't match.
+ db_get samba-common/dhcp || true
+ OLDDHCP="$RET"
+ db_input $DHCPPRIORITY samba-common/dhcp || true
+ db_go
+ db_get samba-common/dhcp || true
+ if [ "$OLDDHCP" != "$RET" ]; then
+ db_fset samba-common/dhcp applied false
+ fi
+fi