[Fai-commit] r3642 - people/eartoast/features/clean-rcs/lib

fai-commit at lists.alioth.debian.org fai-commit at lists.alioth.debian.org
Sun Jul 23 01:13:41 UTC 2006


Author: glaweh-guest
Date: 2006-07-23 01:13:41 +0000 (Sun, 23 Jul 2006)
New Revision: 3642

Modified:
   people/eartoast/features/clean-rcs/lib/get-config-dir
   people/eartoast/features/clean-rcs/lib/get-config-dir-cvs
   people/eartoast/features/clean-rcs/lib/get-config-dir-nfs
Log:
new config url support now working:
tested with cvs-pserver and nfs mounted config space initial install


Modified: people/eartoast/features/clean-rcs/lib/get-config-dir
===================================================================
--- people/eartoast/features/clean-rcs/lib/get-config-dir	2006-07-23 00:34:03 UTC (rev 3641)
+++ people/eartoast/features/clean-rcs/lib/get-config-dir	2006-07-23 01:13:41 UTC (rev 3642)
@@ -1,4 +1,5 @@
 #!/bin/bash
+# (c) 2006 Henning Glawe
 
 # get /fai directory, using the method specified in $FAI_CONFIG_METHOD
 
@@ -10,11 +11,14 @@
 	sleep 50000
 fi
 
-if [ -z "$FAI_CONFIG_METHOD" ]; then
+if [ -z "$FAI_CONFIG_SRC" ]; then
 	sndmon "TASKERROR get_fai_dir 21"
-	die "Error: Provide the method to obtain the fai config storage in \$FAI_CONFIG_METHOD"
+	die "Error: Provide the URL to obtain the fai config storage in \$FAI_CONFIG_SRC"
 fi
 
+# HG: extract major method to get the config dir
+FAI_CONFIG_METHOD=$(expr match "$FAI_CONFIG_SRC" '\([^+]*\).*://.*')
+
 # HG: run get-fai-$blah script if it exists
 if which get-config-dir-$FAI_CONFIG_METHOD &>/dev/null ; then
 	get-config-dir-$FAI_CONFIG_METHOD

Modified: people/eartoast/features/clean-rcs/lib/get-config-dir-cvs
===================================================================
--- people/eartoast/features/clean-rcs/lib/get-config-dir-cvs	2006-07-23 00:34:03 UTC (rev 3641)
+++ people/eartoast/features/clean-rcs/lib/get-config-dir-cvs	2006-07-23 01:13:41 UTC (rev 3642)
@@ -1,27 +1,44 @@
-#! /bin/bash
+#!/bin/bash
 
 # get-fai-cvs -- get fai configuration directory $FAI from a cvs repository.
 # (c) 2002-2006 Henning Glawe
 
 pushd &>/dev/null
 
-local TAG=""
-[ -n "$FAI_CVSTAG" ] && TAG="-r $FAI_CVSTAG"
-export FAI_CONFIG_AREA=$FAI_ROOT$FAI
-export FAI=$(mktemp -t -d fai-config.XXXXXX)
+# matched string: "cvs+ssh://user@blah/blubb/lalala module=tag"
+PROTOCOL=$(expr match "$FAI_CONFIG_SRC" '\(.*\)://.*')
+CVS_PATH=$(expr match "$FAI_CONFIG_SRC" '.*://\(\S\+\)\s\+.*')
+CVS_MODULE=$(expr match "$FAI_CONFIG_SRC" '.*://.*\s\+\([^=]*\).*')
+CVS_TAG=$(expr match "$FAI_CONFIG_SRC" '.*=\(.*\)')
+
+case $PROTOCOL in
+	cvs+ssh)
+		export CVS_RSH=ssh
+		export CVSROOT=":ext:$CVS_PATH"
+		;;
+	cvs)
+		export CVSROOT=":pserver:$CVS_PATH"
+		;;
+	*)
+		echo "get-config-dir-cvs: protocol $PROTOCOL not implemented"
+		exit 1
+		;;
+esac
+		
+[ -n "$CVS_TAG" ] && TAG="-r $CVS_TAG"
+
+FAI_CONFIG_AREA=$FAI_ROOT/var/lib/fai/config
     
-[ "$debug" ] && echo "\$FAI now points to $FAI"
-    
-if [ -d "$FAI_CONFIG_AREA/CVS" -a -z "$FORCE" ] ; then
+if [ -d "$FAI_CONFIG_AREA/CVS" ] ; then
    echo "Config found at $FAI_CONFIG_AREA: Copying"
    cp -a $FAI_CONFIG_AREA/. $FAI
    echo "Updating CVS"
    cd $FAI
-       cvs -q -d"$FAI_CVSROOT" up -P $TAG -d -C > $LOGDIR/cvs.log
+   cvs -q up -P $CVS_TAG -d -C > $LOGDIR/getconf.log
 else 
    echo "Checking out CVS"
    cd /tmp
-   cvs -q -d"$FAI_CVSROOT" co -P -d $(basename "$FAI") \
-     $TAG $FAI_CVSMODULE > $LOGDIR/cvs.log
+   cvs -q co -P -d $(basename "$FAI") \
+     $CVS_TAG $CVS_MODULE > $LOGDIR/getconf.log
 fi
 popd &>/dev/null

Modified: people/eartoast/features/clean-rcs/lib/get-config-dir-nfs
===================================================================
--- people/eartoast/features/clean-rcs/lib/get-config-dir-nfs	2006-07-23 00:34:03 UTC (rev 3641)
+++ people/eartoast/features/clean-rcs/lib/get-config-dir-nfs	2006-07-23 01:13:41 UTC (rev 3642)
@@ -1,4 +1,8 @@
 #!/bin/bash
+# (c) 2006 Henning Glawe
 
-mount $romountopt $FAI_LOCATION $FAI &&
+SERVER=$(expr match "$FAI_CONFIG_SRC" '.*://\([^/]*\)/.*')
+NFSPATH=$(expr match "$FAI_CONFIG_SRC" '.*://[^/]*\(/.*\)')
+
+mount $romountopt $SERVER:$NFSPATH $FAI &&
 echo "Configuration space $FAI mounted from $FAI_LOCATION"




More information about the Fai-commit mailing list