Revision
540
Author
wsiegrist@apple.com
Date
2009-07-31 23:50:08 -0700 (Fri, 31 Jul 2009)

Log Message

Add support for initializing environments from plists served via http and ssh

Modified Paths

Diff

Modified: trunk/darwinbuild/darwinbuild.in (539 => 540)


--- trunk/darwinbuild/darwinbuild.in	2009-07-19 01:25:06 UTC (rev 539)
+++ trunk/darwinbuild/darwinbuild.in	2009-08-01 06:50:08 UTC (rev 540)
@@ -137,6 +137,10 @@
 	if [ "$2" == "" ]; then
 		echo "usage: $(basename $0) -init <build> [-nodmg | -nfs]" 1>&2
 		echo "" 1>&2
+		echo "\t<build>\t can be a standard build number or a path to a plist." 1>&2
+		echo "\t\t supported paths: /dir/file.plist, " 1>&2
+		echo "\t\t\t\t  http://host/dir/file.plist, " 1>&2
+		echo "\t\t\t\t  user@host:/dir/file.plist" 1>&2
 		echo "\t-nodmg \t do not use a sparse image for build root (use a regular directory)" 1>&2
 		echo "\t-nfs   \t use NFS over loopback to mount the build root (implies -nodmg)" 1>&2
 		exit 1
@@ -150,16 +154,26 @@
 	[ -d Logs ] || mkdir Logs
 	[ -d .build ] || mkdir .build
 
-	# check if there's a plist locally by this name
 	if [ -f "$build" ]; then
+	    # user gave a local path to a plist
 	    filepath="$build"
 	    filename=$(basename "$filepath")
 	    build=$(echo "$filename" | sed 's/.plist$//')
 	    # since we don't want to download this, copy it
 	    cp "$filepath" ".build/$build.plist"
+	elif [ $(echo $build | grep 'http://') ]; then
+	    # user gave a URL to a webserver
+	    host=$(dirname $build)
+	    filename=$(basename $build)
+	    Download .build $filename $host
+	elif [ $(echo $build | grep '\w@\w') ]; then
+	    # user provided user@host:/path/file.plist
+	    filename=$(basename $build)
+	    scp $build .build/
+	    build=$(echo "$filename" | sed 's/.plist$//')
 	fi
 
-	echo "$build" > .build/build
+	echo "$build" > .build/build 
 
         ###
         ### Create the build root