Revision
525
Author
wsiegrist@apple.com
Date
2009-06-19 11:16:41 -0700 (Fri, 19 Jun 2009)

Log Message

Apply patch from #86 to fix duplicate export warning when reusing same path for an NFS-based buildroot. Thanks to aladin from puredarwin

Modified Paths

Diff

Modified: trunk/darwinbuild/darwinbuild.in (524 => 525)


--- trunk/darwinbuild/darwinbuild.in	2009-06-16 22:50:35 UTC (rev 524)
+++ trunk/darwinbuild/darwinbuild.in	2009-06-19 18:16:41 UTC (rev 525)
@@ -166,11 +166,15 @@
         ###
 	stamp=$(date +'%Y%m%d%H%M%S')
 	if [ "$3" == "-nfs" ]; then
-	    echo "Adding build root to NFS exports file ..."
 	    mkdir -p $NFSDIR
 	    mkdir -p BuildRoot
-	    echo "# Added by darwinbuild on ${stamp}" >> /etc/exports
-	    echo "${PWDP}/${NFSDIR} -maproot=0:10" >> /etc/exports
+	    exportline="${PWDP}/${NFSDIR} -maproot=0:10"
+	    grep "$exportline" /etc/exports >> /dev/null 2>&1
+	    if [ ! $? -eq 0 ]; then
+		echo "Adding build root to NFS exports file ..."
+		echo "# Added by darwinbuild on ${stamp}" >> /etc/exports
+		echo $exportline >> /etc/exports
+	    fi
 	    nfsd update	    
 	    echo "Checking exports file ..."
 	    nfsd checkexports