[PC-BSD Commits] r17792 - pcbsd-projects/AD_4_PCBSD/scripts

svn at pcbsd.org svn at pcbsd.org
Mon Jul 16 21:58:17 PDT 2012


Author: johnh
Date: 2012-07-17 04:58:17 +0000 (Tue, 17 Jul 2012)
New Revision: 17792

Modified:
   pcbsd-projects/AD_4_PCBSD/scripts/pc-adctl
   pcbsd-projects/AD_4_PCBSD/scripts/pc-kinit
   pcbsd-projects/AD_4_PCBSD/scripts/pc-nsswitch
   pcbsd-projects/AD_4_PCBSD/scripts/pc-samba
Log:
Modified scripts to make AD work. 



Modified: pcbsd-projects/AD_4_PCBSD/scripts/pc-adctl
===================================================================
--- pcbsd-projects/AD_4_PCBSD/scripts/pc-adctl	2012-07-17 04:47:49 UTC (rev 17791)
+++ pcbsd-projects/AD_4_PCBSD/scripts/pc-adctl	2012-07-17 04:58:17 UTC (rev 17792)
@@ -7,7 +7,7 @@
 
 . /usr/local/etc/rc.AD
 
-ad_assert()
+adctl_assert()
 {
 	local args="$*"
 
@@ -19,36 +19,67 @@
 	fi
 }
 
-ad_start()
+adctl_start()
 {
 	if checkyesno activedirectory_enable 2>/dev/null
 	then
-		ad_assert service pc-kerberos start
-		ad_assert service pc-nsswitch start
-		ad_assert service pc-pam start
-		#service pc-samba start
-		#service pc-kinit start
-		#service pc-kinit status
-		#service pc-activedirectory start
-		#service pc-activedirectory status
+		adctl_assert service pc-kerberos start
+		adctl_assert service pc-nsswitch start
+		adctl_assert service pc-pam start
+
+		service samba status
+		if [ "$?" = "0" ]
+		then
+			adctl_assert service samba stop
+			adctl_assert service pc-samba start
+			adctl_assert service samba start
+		else
+			adctl_assert service pc-samba start
+			adctl_assert service samba start
+		fi
+
+		adctl_assert service pc-kinit start
+		adctl_assert service pc-kinit status
+		adctl_assert service pc-activedirectory start
+		adctl_assert service pc-activedirectory status
 	fi
 	
 	return 0
 }
 
-ad_status()
+adctl_status()
 {
+	service pc-activedirectory status
+	return $?
 }
 
-ad_stop()
+adctl_stop()
 {
+	if checkyesno activedirectory_enable 2>/dev/null
+	then
+		service pc-kerberos stop
+		service pc-nsswitch stop
+		service pc-pam stop
+		service pc-samba stop
+		service pc-kinit stop
+		service pc-activedirectory stop
+
+		service samba status
+		if [ "$?" = "0" ]
+		then
+			adctl_assert service samba stop
+			adctl_assert service samba start
+		else
+			adctl_assert service samba start
+		fi
+	fi
 }
 
 
 name="pc-adctl"
-start_cmd='ad_start'
-status_cmd='ad_status'
-stop_cmd='ad_stop'
+start_cmd='adctl_start'
+status_cmd='adctl_status'
+stop_cmd='adctl_stop'
             
 load_rc_config $name
 run_rc_command "$1"

Modified: pcbsd-projects/AD_4_PCBSD/scripts/pc-kinit
===================================================================
--- pcbsd-projects/AD_4_PCBSD/scripts/pc-kinit	2012-07-17 04:47:49 UTC (rev 17791)
+++ pcbsd-projects/AD_4_PCBSD/scripts/pc-kinit	2012-07-17 04:58:17 UTC (rev 17792)
@@ -16,7 +16,6 @@
 	local ec pwfile
 
 	ec=1
-
 	if checkyesno activedirectory_enable 2>/dev/null
 	then
 		AD_init
@@ -38,15 +37,14 @@
 			sleep 10
 		fi
 	fi
-	return $ec
+
+	return ${ec}
 }
 
 kerberos_status()
 {
-	local ec
+	local ec=1
 
-	ec=1
-
 	if checkyesno activedirectory_enable 2>/dev/null
 	then
 		AD_init
@@ -62,7 +60,8 @@
 			ec=$?
 		fi
 	fi
-	return $ec
+
+	return ${ec}
 }
 
 kerberos_stop()

Modified: pcbsd-projects/AD_4_PCBSD/scripts/pc-nsswitch
===================================================================
--- pcbsd-projects/AD_4_PCBSD/scripts/pc-nsswitch	2012-07-17 04:47:49 UTC (rev 17791)
+++ pcbsd-projects/AD_4_PCBSD/scripts/pc-nsswitch	2012-07-17 04:58:17 UTC (rev 17792)
@@ -26,7 +26,7 @@
 		if [ "$?" = "0" -a -s "${tmp}" ]
 		then
 			mv "${tmp}" "${PATH_NS_CONF}"
-			return 0
+			return $?
 		fi
 
 		return 1
@@ -49,7 +49,7 @@
 		if [ "$?" = "0" -a -s "${tmp}" ]
 		then
 			mv "${tmp}" "${PATH_NS_CONF}"
-			return 0
+			return $?
 		fi
 
 		return 1

Modified: pcbsd-projects/AD_4_PCBSD/scripts/pc-samba
===================================================================
--- pcbsd-projects/AD_4_PCBSD/scripts/pc-samba	2012-07-17 04:47:49 UTC (rev 17791)
+++ pcbsd-projects/AD_4_PCBSD/scripts/pc-samba	2012-07-17 04:58:17 UTC (rev 17792)
@@ -14,12 +14,14 @@
 : ${SAMBACONF:="/usr/local/bin/sambaconf"}
 
 
-generate_smbconf()
+ad_smbconf_start()
 {
 	if checkyesno activedirectory_enable 2>/dev/null
 	then
+		local tmp=$(mktemp /tmp/samba.XXXXXX)
+
 		AD_init
-
+		cp "${SMB_CONF}" "${SMB_CONF}.orig"
 		${SAMBACONF} -f ${SMB_CONF} \
 			-w -m "+global:security=ADS" \
 			-w -m "+global:realm=$(AD_get domainname | tr a-z A-Z)" \
@@ -49,13 +51,35 @@
 			-w -m "+global:winbind refresh tickets=yes" \
 			-w -m "+global:allow trusted domains=yes" \
 			-w -m "+global:template shell=/bin/sh" \
-			-w -m "+global: template homedir=/home/%U"
+			-w -m "+global: template homedir=/home/%U" \
+			-o "${tmp}"
+
+			if [ "$?" = "0" -a -s "${tmp}" ]
+			then
+				mv "${tmp}" "${SMB_CONF}"
+				return $?
+			fi
+
+			return 1
 	fi
+
+	return 0
 }
 
+ad_smbconf_stop()
+{
+	if checkyesno activedirectory_enable 2>/dev/null
+	then
+		cp "${SMB_CONF}.orig" "${SMB_CONF}"
+		return $?
+	fi
+
+	return 0
+}
+
 name="pc-samba"
-start_cmd='generate_smbconf'
-stop_cmd=':'
+start_cmd='ad_smbconf_start'
+stop_cmd='ad_smbconf_stop'
 
 load_rc_config $name
 run_rc_command "$1"



More information about the Commits mailing list