[PC-BSD Commits] r8236 - pcbsd/current/src-sh/pc-thinclient

svn at pcbsd.org svn at pcbsd.org
Fri Dec 17 15:53:13 PST 2010


Author: kris
Date: 2010-12-17 15:53:13 -0800 (Fri, 17 Dec 2010)
New Revision: 8236

Modified:
   pcbsd/current/src-sh/pc-thinclient/pc-thinclient
Log:

Fixed up several other bugs with enabling the thinclient, also start the related nfs/dhcpd/tftp services
so we don't need to reboot :)



Modified: pcbsd/current/src-sh/pc-thinclient/pc-thinclient
===================================================================
--- pcbsd/current/src-sh/pc-thinclient/pc-thinclient	2010-12-17 21:58:37 UTC (rev 8235)
+++ pcbsd/current/src-sh/pc-thinclient/pc-thinclient	2010-12-17 23:53:13 UTC (rev 8236)
@@ -41,8 +41,11 @@
 	echo "Setting up system for PXE booting..."
 
 	# Setup the new pxeboot user with a default password
-	echo "thinclient" | pw useradd -n "pxeboot" -h 0 -s /bin/tcsh -d ${PXEWORLD}/mnt/xorg-config -c "pxeboot"
-	chown -R pxeboot:pxeboot ${PXEWORLD}/mnt/xorg-config
+	cat /etc/passwd | grep pxeboot >/dev/null 2>/dev/null
+	if [ "$?" != "0" ] ; then
+		echo "thinclient" | pw useradd -n "pxeboot" -h 0 -s /bin/tcsh -d ${PXEWORLD}/mnt/xorg-config -c "pxeboot"
+		chown -R pxeboot:pxeboot ${PXEWORLD}/mnt/xorg-config
+	fi
 
 	# Copy over the default dhcpd.conf file
 	cp ${PROGDIR}/resources/dhcpd/dhcpd.conf /usr/local/etc/dhcpd.conf
@@ -72,7 +75,7 @@
 	fi
 
 	# Add some entries for /etc/exports
-	cat /etc/exports | grep "$PXEWORLD" >/dev/null 2>/dev/null
+	cat /etc/exports 2>/dev/null | grep "$PXEWORLD" >/dev/null 2>/dev/null
 	if [ "$?" != "0" ] ; then
 	  	echo "$PXEWORLD -maproot=nobody -ro -network 192.168.2 -mask 255.255.255" >>/etc/exports
 	fi
@@ -84,11 +87,11 @@
 	fi
 
 	# Setup rcpbind entries
-	cat /etc/hosts.allow | grep "192.168.2.0" >/dev/null 2>/dev/null
+	cat /etc/hosts.allow 2>/dev/null | grep "192.168.2.0" >/dev/null 2>/dev/null
 	if [ "$?" != "0" ] ; then
-		cat /etc/hosts.allow | sed  -i '' 's|rpcbind : ALL : deny|rpcbind : 192.168.2.0/255.255.255.0 : allow\
+		sed  -i '' 's|rpcbind : ALL : deny|rpcbind : 192.168.2.0/255.255.255.0 : allow\
 portmap : 192.168.2.0/255.255.255.0 : allow\
-rpcbind : ALL : deny|' /tmp/hosts.allow
+rpcbind : ALL : deny|' /etc/hosts.allow
 	fi
 
 	# Add a bulk of IPs to /etc/hosts this fixes bugs with RPC timeouts
@@ -105,10 +108,21 @@
 		done
 	fi
 
-	# Start dhcpd / tftpd
-	echo "Starting local dhcpd / tftp services..."
-	/usr/local/etc/rc.d/dhcpd start
-	/etc/rc.d/inetd restart
+	# Make sure the NIC is set to the right IP before bringing up dhcpd
+	ifconfig $NIC 192.168.2.2
+
+	# Start the services
+	cmds="/etc/rc.d/nfsd /etc/rc.d/inetd /usr/local/etc/rc.d/isc-dhcpd"
+	for _sC in $cmds
+	do
+		echo -e "Starting ${_sC}...\c"
+		${_sC} restart >/dev/null 2>/dev/null
+		if [ "$?" != "0" ] ; then
+			echo -e "FAILED! Please run try running it manually."
+		else
+			echo -e "OK"
+		fi
+	done
 }
 
 # Check if we need to install custom config



More information about the Commits mailing list