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

Steve Langasek vorlon at alioth.debian.org
Sat Mar 10 12:29:49 CET 2007


Author: vorlon
Date: 2007-03-10 11:29:48 +0000 (Sat, 10 Mar 2007)
New Revision: 1259

Modified:
   trunk/samba/debian/changelog
   trunk/samba/debian/samba-common.dhcp
Log:
support creating /etc/samba/dhcp.conf the first time the script is
called if the dhcp client was already running at the time of install,
and manually reload samba to get the updated config files read.  Thanks
to Bas Zoetekouw for the patch.   Closes: #407408.

While we're at it, use atomic replace for /etc/samba/dhcp.conf just in
case someone else reloads samba while the script is running.  
Low-impact, low-risk change.



Modified: trunk/samba/debian/changelog
===================================================================
--- trunk/samba/debian/changelog	2007-03-05 08:35:12 UTC (rev 1258)
+++ trunk/samba/debian/changelog	2007-03-10 11:29:48 UTC (rev 1259)
@@ -1,5 +1,6 @@
-samba (3.0.24-3) UNRELEASED_experimental; urgency=low
+samba (3.0.24-3) UNRELEASED; urgency=low
 
+  [ Christian Perrier ]
   * Merge some Ubuntu changes:
     - do not expose the Samba version anymore
     - default workgroup set to WORKGROUP (default workgroup of
@@ -10,8 +11,18 @@
     This will point users to these important settings which changed
     their default behaviour between sarge and etch. Closes: #368251
 
- -- Christian Perrier <bubulle at debian.org>  Mon, 12 Feb 2007 22:03:47 +0100
+  [ Steve Langasek ]
+  * samba-common.dhcp: support creating /etc/samba/dhcp.conf the first
+    time the script is called if the dhcp client was already running at
+    the time of install, and manually reload samba to get the updated
+    config files read.  Thanks to Bas Zoetekouw for the patch.
+    Closes: #407408.
+  * While we're at it, use atomic replace for /etc/samba/dhcp.conf just 
+    in case someone else reloads samba while the script is running.  Low
+    impact, low-risk change.
 
+ -- Steve Langasek <vorlon at debian.org>  Sat, 10 Mar 2007 03:22:13 -0800
+
 samba (3.0.24-2) unstable; urgency=low
 
   * Re-upload with a proper .orig.tar.gz.

Modified: trunk/samba/debian/samba-common.dhcp
===================================================================
--- trunk/samba/debian/samba-common.dhcp	2007-03-05 08:35:12 UTC (rev 1258)
+++ trunk/samba/debian/samba-common.dhcp	2007-03-10 11:29:48 UTC (rev 1259)
@@ -12,27 +12,36 @@
 		return
 	fi
 
-	# Nor should we continue if no settings have changed
-	if [ "$new_netbios_name_servers" = "$old_netbios_name_servers" ] \
-	   && [ "$new_netbios_scope" = "$old_netbios_scope" ]
+	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 ]
 	then
-		return
-	fi
+		# don't continue if no settings have changed
+		if [ "$new_netbios_name_servers" = "$old_netbios_name_servers" ] \
+		   && [ "$new_netbios_scope" = "$old_netbios_scope" ]
+		then
+			return
+		fi
 
-	# reparse our own file
-	local other_servers=`sed -n -e"s/[[:space:]]$interface:[^[:space:]]*//g; \
-		s/^[[:space:]]*wins server[[:space:]]*=[[:space:]]*//pi" \
-		$SAMBA_DHCP_CONF`
+		# reparse our own file
+		other_servers=`sed -n -e"s/[[:space:]]$interface:[^[:space:]]*//g; \
+			s/^[[:space:]]*wins server[[:space:]]*=[[:space:]]*//pi" \
+			$SAMBA_DHCP_CONF`
 
-	umask 022
+		serverlist="$other_servers"
+	fi
 
-	local serverlist="$other_servers"
 	for server in $new_netbios_name_servers
 	do
 		serverlist="$serverlist $interface:$server"
 	done
 
-	echo -n > $SAMBA_DHCP_CONF
+	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.
@@ -40,18 +49,24 @@
 	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
+		echo "   wins server =$serverlist" >> ${SAMBA_DHCP_CONF}.new
 	fi
 	if [ -n "$new_netbios_scope" ]
 	then
-		echo "   netbios scope = $new_netbios_scope" >> $SAMBA_DHCP_CONF
+		echo "   netbios scope = $new_netbios_scope" >> ${SAMBA_DHCP_CONF}.new
 	fi
+	mv ${SAMBA_DHCP_CONF}.new $SAMBA_DHCP_CONF
+
+	# reload the samba server
+	/usr/sbin/invoke-rc.d samba reload
+
 }
 
 netbios_setup




More information about the Pkg-samba-maint mailing list