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

svn at pcbsd.org svn at pcbsd.org
Fri Dec 17 13:58:37 PST 2010


Author: kris
Date: 2010-12-17 13:58:37 -0800 (Fri, 17 Dec 2010)
New Revision: 8235

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

Bugfix building thinclient ports, and add bits for the rest of system configuration.

Still needs some testing on in a PXE environment again, but should be identical to old ThinClient
PBI now



Modified: pcbsd/current/src-sh/pc-thinclient/pc-thinclient
===================================================================
--- pcbsd/current/src-sh/pc-thinclient/pc-thinclient	2010-12-17 21:57:18 UTC (rev 8234)
+++ pcbsd/current/src-sh/pc-thinclient/pc-thinclient	2010-12-17 21:58:37 UTC (rev 8235)
@@ -37,14 +37,78 @@
 
 # Start configuring the base system
 check_configsystem() {
+	if [ -e "/usr/local/etc/dhcpd.conf" ] ; then return ; fi
+	echo "Setting up system for PXE booting..."
 
 	# Setup the new pxeboot user with a default password
-	echo "Adding pxeboot user..."
 	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
 
 	# Copy over the default dhcpd.conf file
 	cp ${PROGDIR}/resources/dhcpd/dhcpd.conf /usr/local/etc/dhcpd.conf
+
+	# Ask for the NIC we want to run on
+	echo "What NIC do you wish DHCPD to listen on? (I.E. re0)"
+	echo -e "nic) \c"
+	read NIC 
+
+	# Save the rc.conf glue
+	cat /etc/rc.conf | grep "# pc-thinclient" >/dev/null 2>/dev/null
+	if [ "$?" != "0" ] ; then
+		echo "# pc-thinclient configuration
+dhcpd_enable=\"YES\"
+dhcpd_ifaces=\"${NIC}\"
+portmap_enable=\"YES\"
+nfs_server_enable=\"YES\"
+inetd_enable=\"YES\"
+ifconfig_${NIC}=\"192.168.2.2\"" >> /etc/rc.conf
+	fi
+
+	# Add firewall exception
+	cat /etc/pf.conf | grep "pass in on ${NIC} all" >/dev/null 2>/dev/null
+	if [ "$?" != "0" ] ; then
+  		# Setup the firewall exclusion for this NIC
+  		echo "pass in on ${NIC} all" >> /etc/pf.conf
+	fi
+
+	# Add some entries for /etc/exports
+	cat /etc/exports | 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
+
+	# Setup tftp
+	cat /etc/inetd.conf | grep "$PXEWORLD" >/dev/null 2>/dev/null
+	if [ "$?" != "0" ] ; then
+		echo "tftp   dgram   udp     wait    root    /usr/libexec/tftpd      tftpd -l -s ${PXEWORLD}" >> /etc/inetd.conf
+	fi
+
+	# Setup rcpbind entries
+	cat /etc/hosts.allow | 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\
+portmap : 192.168.2.0/255.255.255.0 : allow\
+rpcbind : ALL : deny|' /tmp/hosts.allow
+	fi
+
+	# Add a bulk of IPs to /etc/hosts this fixes bugs with RPC timeouts
+	# when mounting NFS
+	cat /etc/hosts | grep "192.168.2." >/dev/null 2>/dev/null
+	if [ "$?" != "0" ] ; then
+		i="100"
+		while
+		z="1"
+		do
+			if [ "${i}" = "200" ]; then break; fi
+			echo "192.168.2.${i}  thinclient${i}" >>/etc/hosts
+			i="`expr ${i} + 1`"
+		done
+	fi
+
+	# Start dhcpd / tftpd
+	echo "Starting local dhcpd / tftp services..."
+	/usr/local/etc/rc.d/dhcpd start
+	/etc/rc.d/inetd restart
 }
 
 # Check if we need to install custom config
@@ -81,7 +145,7 @@
 
 # Check if we need to build the world environment
 check_worldports() {
-	if [ -d "${PXEWORLD}/usr/local/lib/X11" ] ; then return ; fi
+	if [ -e "${PXEWORLD}/usr/local/bin/xv" ] ; then return ; fi
 	
 	if [ ! -d "${PXEWORLD}/usr/ports/x11/xorg" -a ! -d "/usr/ports/x11/xorg" ] ; then
 		exit_err "Missing /usr/ports/x11/xorg, please checkout ports tree to continue"
@@ -93,8 +157,17 @@
 	fi
 
 	# Building ports inside world
+	mount -t devfs devfs ${PXEWORLD}/dev
+	cp /etc/resolv.conf ${PXEWORLD}/etc/resolv.conf
+	echo "BATCH=yes" >> ${PXEWORLD}/etc/make.conf
 	echo '#!/bin/sh
 
+/etc/rc.d/ldconfig start
+chmod 777 /tmp
+MACHINE=i386 ; export MACHINE
+UNAME_p=i386 ; export UNAME_p
+UNAME_m=i386 ; export UNAME_m
+
 for p in $WORLDPORTS
 do
 	cd /usr/ports/$p
@@ -111,6 +184,7 @@
 		exit_err "Failed building thinclient world ports!"
 	fi
 	rm ${PXEWORLD}/.mkports.sh
+	umount ${PXEWORLD}/dev
 
 }
 
@@ -180,3 +254,6 @@
 
 # Tweak the base system to enable the thinclient
 check_configsystem
+
+echo "Your system is now setup to do PXE booting!"
+exit 0



More information about the Commits mailing list