[Pkg-samba-maint] r913 - branches/samba4

Steinar H. Gunderson sesse at costa.debian.org
Fri Jan 6 03:09:33 UTC 2006


Author: sesse
Date: 2006-01-06 03:09:33 +0000 (Fri, 06 Jan 2006)
New Revision: 913

Modified:
   branches/samba4/samba.postinst
Log:
Replace insane sed hacks by slightly more sane testparm usage,
after Andrew Bartlett most kindly fixed testparm.


Modified: branches/samba4/samba.postinst
===================================================================
--- branches/samba4/samba.postinst	2006-01-06 02:54:13 UTC (rev 912)
+++ branches/samba4/samba.postinst	2006-01-06 03:09:33 UTC (rev 913)
@@ -4,28 +4,6 @@
 
 . /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
-}
-
 if [ "$1" = "configure" ]; then
 	# See if we're upgrading from Samba 3
 	if [ ! -z "$2" ]; then
@@ -47,10 +25,10 @@
 				mv /etc/samba/smb.conf.new /etc/samba/smb.conf
 			fi
 
-			REALM=$( smbconf_retr realm )
-			DOMAIN=$( smbconf_retr workgroup )
+			if [ -f /etc/samba/smb.conf ]; then
+				REALM=$( testparm --parameter-name=realm )
+				DOMAIN=$( testparm --parameter-name=workgroup )
 
-			if [ -n "$REALM" -a -n "$DOMAIN" ]; then
 				/usr/lib/samba/setup/provision --realm="$REALM" --domain="$DOMAIN"
 			fi
 		fi




More information about the Pkg-samba-maint mailing list