[Pkg-samba-maint] r4146 - trunk/samba/debian

vorlon at alioth.debian.org vorlon at alioth.debian.org
Wed Jun 27 16:29:51 UTC 2012


Author: vorlon
Date: 2012-06-27 16:29:50 +0000 (Wed, 27 Jun 2012)
New Revision: 4146

Added:
   trunk/samba/debian/samba-common.dhcp
   trunk/samba/debian/samba-common.links
Removed:
   trunk/samba/debian/samba-common.maintscript
Modified:
   trunk/samba/debian/changelog
   trunk/samba/debian/rules
   trunk/samba/debian/samba-common.config
   trunk/samba/debian/samba-common.dirs
   trunk/samba/debian/samba-common.install
   trunk/samba/debian/samba-common.postinst
   trunk/samba/debian/samba-common.templates
Log:
Restore the DHCP hook.

Modified: trunk/samba/debian/changelog
===================================================================
--- trunk/samba/debian/changelog	2012-06-27 05:32:47 UTC (rev 4145)
+++ trunk/samba/debian/changelog	2012-06-27 16:29:50 UTC (rev 4146)
@@ -1,3 +1,9 @@
+samba (2:3.6.6-2) UNRELEASED; urgency=low
+
+  * Restore the DHCP hook.
+
+ -- Steve Langasek <vorlon at debian.org>  Wed, 27 Jun 2012 09:27:13 -0700
+
 samba (2:3.6.6-1) unstable; urgency=low
 
   [ Ivo De Decker ]

Modified: trunk/samba/debian/rules
===================================================================
--- trunk/samba/debian/rules	2012-06-27 05:32:47 UTC (rev 4145)
+++ trunk/samba/debian/rules	2012-06-27 16:29:50 UTC (rev 4146)
@@ -98,6 +98,11 @@
 	mkdir -p $(DESTDIR)/usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig
 	install -m 0644 source3/pkgconfig/wbclient.pc $(DESTDIR)/usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig
 
+	# Install samba-common's conffiles - they'll get moved later to their
+	# correct place by dh_install
+	mkdir -p $(DESTDIR)/etc/dhcp3/dhclient-enter-hooks.d
+	install -m755 debian/samba-common.dhcp $(DESTDIR)/etc/dhcp3/dhclient-enter-hooks.d/samba
+
 override_dh_installpam:
 	dh_installpam --name=samba
 

Modified: trunk/samba/debian/samba-common.config
===================================================================
--- trunk/samba/debian/samba-common.config	2012-06-27 05:32:47 UTC (rev 4145)
+++ trunk/samba/debian/samba-common.config	2012-06-27 16:29:50 UTC (rev 4146)
@@ -77,3 +77,32 @@
 db_input medium samba-common/encrypt_passwords || true
 db_go
 
+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
+
+FOUND=false
+if [ -f $FILE ]; then
+	if grep -q 'include[[:space:]]*=[[:space:]]*/etc/samba/dhcp.conf' $FILE
+	then
+		FOUND=true
+	fi
+	db_set samba-common/dhcp $FOUND
+fi
+
+# we only prompt in one of three cases: the file doesn't exist yet, it
+# has the context we need to add our include line, or the include line
+# is already present.
+if [ ! -f $FILE ] || grep -q -i 'wins server' $FILE || [ "$FOUND" = "true" ];
+then
+	db_input $DHCPPRIORITY samba-common/dhcp || true
+	db_go
+fi

Copied: trunk/samba/debian/samba-common.dhcp (from rev 4130, trunk/samba/debian/samba-common.dhcp)
===================================================================
--- trunk/samba/debian/samba-common.dhcp	                        (rev 0)
+++ trunk/samba/debian/samba-common.dhcp	2012-06-27 16:29:50 UTC (rev 4146)
@@ -0,0 +1,75 @@
+#!/bin/sh
+
+SAMBA_DHCP_CONF=/etc/samba/dhcp.conf
+
+netbios_setup() {
+	# No need to continue if we're called with an unsupported option
+
+	case $reason in
+	BOUND|RENEW|REBIND|REBOOT|EXPIRE|FAIL|RELEASE|STOP)
+		;;
+	*)
+		return
+		;;
+	esac
+
+	umask 022
+
+	local other_servers=""
+	local serverlist=""
+
+	# the destination file won't exist yet on the first run after 
+	# installing samba
+	if [ -e $SAMBA_DHCP_CONF ] && [ -s $SAMBA_DHCP_CONF ]
+	then
+		# don't continue if no settings have changed
+		if [ "$new_netbios_name_servers" = "$old_netbios_name_servers" ] \
+		   && [ "$new_netbios_scope" = "$old_netbios_scope" ] \
+		   && [ -n "$new_netbios_name_servers" ]
+		then
+			return
+		fi
+
+		# reparse our own file
+		other_servers=`sed -n -e"s/[[:space:]]$interface:[^[:space:]]*//g; \
+			s/^[[:space:]]*wins server[[:space:]]*=[[:space:]]*//pi" \
+			$SAMBA_DHCP_CONF`
+
+		serverlist="$other_servers"
+	fi
+
+	for server in $new_netbios_name_servers
+	do
+		serverlist="$serverlist $interface:$server"
+	done
+
+	echo -n > ${SAMBA_DHCP_CONF}.new
+
+	# If we're updating on failure/expire, AND there are no WINS
+	# servers for other interfaces, leave the file empty.
+	if [ -z "$other_servers" ]
+	then
+		if [ "$reason" = FAIL ] || [ "$reason" = EXPIRE ]
+		then
+			mv ${SAMBA_DHCP_CONF}.new $SAMBA_DHCP_CONF
+			return
+		fi
+	fi
+
+	if [ -n "$serverlist" ]
+	then
+		echo "   wins server =$serverlist" >> ${SAMBA_DHCP_CONF}.new
+	fi
+	if [ -n "$new_netbios_scope" ]
+	then
+		echo "   netbios scope = $new_netbios_scope" >> ${SAMBA_DHCP_CONF}.new
+	fi
+	mv ${SAMBA_DHCP_CONF}.new $SAMBA_DHCP_CONF
+
+	# reload the samba server
+	# We don't necessarily have the samba package installed. #414841
+	[ -x /etc/init.d/samba ] && /usr/sbin/invoke-rc.d samba reload
+
+}
+
+netbios_setup

Modified: trunk/samba/debian/samba-common.dirs
===================================================================
--- trunk/samba/debian/samba-common.dirs	2012-06-27 05:32:47 UTC (rev 4145)
+++ trunk/samba/debian/samba-common.dirs	2012-06-27 16:29:50 UTC (rev 4146)
@@ -1,4 +1,5 @@
 etc/samba
+etc/dhcp3/dhclient-enter-hooks.d
 var/cache/samba
 var/lib/samba
 var/log/samba

Modified: trunk/samba/debian/samba-common.install
===================================================================
--- trunk/samba/debian/samba-common.install	2012-06-27 05:32:47 UTC (rev 4145)
+++ trunk/samba/debian/samba-common.install	2012-06-27 16:29:50 UTC (rev 4146)
@@ -1,5 +1,6 @@
 etc/samba/
 debian/gdbcommands etc/samba
+etc/dhcp3/
 usr/share/samba/lowcase.dat
 debian/panic-action usr/share/samba
 debian/smb.conf* usr/share/samba

Copied: trunk/samba/debian/samba-common.links (from rev 4130, trunk/samba/debian/samba-common.links)
===================================================================
--- trunk/samba/debian/samba-common.links	                        (rev 0)
+++ trunk/samba/debian/samba-common.links	2012-06-27 16:29:50 UTC (rev 4146)
@@ -0,0 +1 @@
+etc/dhcp3/dhclient-enter-hooks.d/samba etc/dhcp/dhclient-enter-hooks.d/samba

Deleted: trunk/samba/debian/samba-common.maintscript
===================================================================
--- trunk/samba/debian/samba-common.maintscript	2012-06-27 05:32:47 UTC (rev 4145)
+++ trunk/samba/debian/samba-common.maintscript	2012-06-27 16:29:50 UTC (rev 4146)
@@ -1,2 +0,0 @@
-rm_conffile /etc/dhcp3/dhclient-enter-hooks.d/samba 2:3.6.5-8~ samba-common
-rm_conffile /etc/samba/dhcp.conf 2:3.6.5-8~ samba-common

Modified: trunk/samba/debian/samba-common.postinst
===================================================================
--- trunk/samba/debian/samba-common.postinst	2012-06-27 05:32:47 UTC (rev 4145)
+++ trunk/samba/debian/samba-common.postinst	2012-06-27 16:29:50 UTC (rev 4146)
@@ -50,6 +50,27 @@
 		        s/^\([[:space:]]*\)encrypt passwords[[:space:]]*=.*/\1encrypt passwords = ${ENCRYPT_PASSWORDS}/i" \
 		"$CONFIG"
 
+	# Install DHCP support
+	db_get samba-common/dhcp
+	if [ "$RET" = true ] && \
+	   ! grep -q dhcp.conf "$CONFIG"
+	then
+		sed -i -e "s/^\([[:space:]]*\)\[global\]/\1\[global\]/i
+			/^[[:space:]]*\[global\]/,/^[[:space:]]*\[/ {
+				/wins server[[:space:]]*=/a \\
+\\
+# If we receive WINS server info from DHCP, override the options above. \\
+   include = /etc/samba/dhcp.conf
+}" "$CONFIG"
+	elif [ "$RET" != true ]; then
+		sed -i -e '
+		/^#[[:space:]]*If we receive WINS server info from DHCP, override the options above/d
+		/^#*[[:space:]]*include[[:space:]]*=[[:space:]]*\/etc\/samba\/dhcp.conf/,/[^[:space:]]/ {
+			/^#*[[:space:]]*include[[:space:]]*=[[:space:]]*\/etc\/samba\/dhcp.conf/d
+			/^[[:space:]]*$/d
+		}' "$CONFIG"
+	fi
+
 }
 
 
@@ -84,13 +105,3 @@
 db_stop
 
 #DEBHELPER#
-
-if [ "$1" = "configure" ] && [ -n "$2" ] &&
-	dpkg --compare-versions "$2" lt '2:3.6.5-8~'
-then
-	# workaround for #584185
-	# rmdir will fail if dir not empty
-	rmdir /etc/dhcp3/dhclient-enter-hooks.d || true
-	rmdir /etc/dhcp3 || true
-fi
-

Modified: trunk/samba/debian/samba-common.templates
===================================================================
--- trunk/samba/debian/samba-common.templates	2012-06-27 05:32:47 UTC (rev 4145)
+++ trunk/samba/debian/samba-common.templates	2012-06-27 16:29:50 UTC (rev 4146)
@@ -2,6 +2,19 @@
 Type: title
 _Description: Samba server and utilities
 
+Template: samba-common/dhcp
+Type: boolean
+Default: false
+_Description: Modify smb.conf to use WINS settings from DHCP?
+ If your computer gets IP address information from a DHCP server on the
+ network, the DHCP server may also provide information about WINS servers
+ ("NetBIOS name servers") present on the network.  This requires a
+ change to your smb.conf file so that DHCP-provided WINS settings will
+ automatically be read from /etc/samba/dhcp.conf.
+ .
+ The dhcp3-client package must be installed to take advantage of this
+ feature.
+
 Template: samba-common/do_debconf
 Type: boolean
 Default: true





More information about the Pkg-samba-maint mailing list