[Fai-commit] r3589 - in people/eartoast/features/clean-rcs: conf debian lib

fai-commit at lists.alioth.debian.org fai-commit at lists.alioth.debian.org
Fri Jul 21 23:53:30 UTC 2006


Author: glaweh-guest
Date: 2006-07-21 23:53:25 +0000 (Fri, 21 Jul 2006)
New Revision: 3589

Added:
   people/eartoast/features/clean-rcs/lib/get-fai-cvs
   people/eartoast/features/clean-rcs/lib/get-fai-nfs
Modified:
   people/eartoast/features/clean-rcs/conf/fai.conf
   people/eartoast/features/clean-rcs/debian/fai-client.install
   people/eartoast/features/clean-rcs/lib/subroutines
Log:
* modularize the fai-config stuff
  - add variable $FAI_CONFIG_METHOD to specify the way to access the config space
  - remove implicit decision based on the presence of $FAI_LOCATION
  - modularize the get-fai-cvs and get-fai-nfs methods
  - source the get-fai-$blah script, as it might define environment variables.


Modified: people/eartoast/features/clean-rcs/conf/fai.conf
===================================================================
--- people/eartoast/features/clean-rcs/conf/fai.conf	2006-07-21 23:52:22 UTC (rev 3588)
+++ people/eartoast/features/clean-rcs/conf/fai.conf	2006-07-21 23:53:25 UTC (rev 3589)
@@ -42,6 +42,9 @@
 # password for login to log server, when using FTP protocol
 LOGPASSWD=
 
+
+# the method used to access the fai config
+FAI_CONFIG_METHOD=nfs
 # the configuration space on the install server
 FAI_CONFIGDIR=/srv/fai/config
 # the location of the config space, as seen by the install client

Modified: people/eartoast/features/clean-rcs/debian/fai-client.install
===================================================================
--- people/eartoast/features/clean-rcs/debian/fai-client.install	2006-07-21 23:52:22 UTC (rev 3588)
+++ people/eartoast/features/clean-rcs/debian/fai-client.install	2006-07-21 23:53:25 UTC (rev 3589)
@@ -3,6 +3,8 @@
 usr/lib/fai/fai-savelog
 usr/lib/fai/fai-savelog-ftp
 usr/lib/fai/get-boot-info
+usr/lib/fai/get-fai-cvs
+usr/lib/fai/get-fai-nfs
 usr/lib/fai/disk-info
 usr/lib/fai/list_disks
 usr/lib/fai/subroutines

Added: people/eartoast/features/clean-rcs/lib/get-fai-cvs
===================================================================
--- people/eartoast/features/clean-rcs/lib/get-fai-cvs	2006-07-21 23:52:22 UTC (rev 3588)
+++ people/eartoast/features/clean-rcs/lib/get-fai-cvs	2006-07-21 23:53:25 UTC (rev 3589)
@@ -0,0 +1,27 @@
+#! /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)
+    
+[ "$debug" ] && echo "\$FAI now points to $FAI"
+    
+if [ -d "$FAI_CONFIG_AREA/CVS" -a -z "$FORCE" ] ; 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
+else 
+   echo "Checking out CVS"
+   cd /tmp
+   cvs -q -d"$FAI_CVSROOT" co -P -d $(basename "$FAI") \
+     $TAG $FAI_CVSMODULE > $LOGDIR/cvs.log
+fi
+popd &>/dev/null

Added: people/eartoast/features/clean-rcs/lib/get-fai-nfs
===================================================================
--- people/eartoast/features/clean-rcs/lib/get-fai-nfs	2006-07-21 23:52:22 UTC (rev 3588)
+++ people/eartoast/features/clean-rcs/lib/get-fai-nfs	2006-07-21 23:53:25 UTC (rev 3589)
@@ -0,0 +1,4 @@
+#!/bin/bash
+
+mount $romountopt $FAI_LOCATION $FAI &&
+echo "Configuration space $FAI mounted from $FAI_LOCATION"

Modified: people/eartoast/features/clean-rcs/lib/subroutines
===================================================================
--- people/eartoast/features/clean-rcs/lib/subroutines	2006-07-21 23:52:22 UTC (rev 3588)
+++ people/eartoast/features/clean-rcs/lib/subroutines	2006-07-21 23:53:25 UTC (rev 3589)
@@ -157,7 +157,7 @@
 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 get_fai_dir() {
 
-    # get /fai directory; mount it or get it from a cvs repository
+    # get /fai directory, using the method specified in $FAI_CONFIG_METHOD
 
     [ -f /boot/RUNNING_FROM_FAICD ] && mkrw -s 100m $FAI
     # now you have enough time to make changes to the config space
@@ -167,50 +167,20 @@
 	sleep 50000
     fi
 
-    if [ -z "$FAI_LOCATION" ]; then
-       get_fai_cvs
-    else
-        mount $romountopt $FAI_LOCATION $FAI &&
-	    echo "Configuration space $FAI mounted from $FAI_LOCATION"
-    fi
+	if [ -z "$FAI_CONFIG_METHOD" ]; then
+		sndmon "TASKERROR get_fai_dir 21"
+		die "Error: Provide the method to obtain the fai config storage in \$FAI_CONFIG_METHOD"
+	fi
+
+	# HG: source the get-fai-$blah script, as env variables might be defined by it.
+	source get-fai-$FAI_CONFIG_METHOD
+	
     ln -s $FAI $rundir/current_config
     if [ ! -d $FAI/class ]; then
 	echo "WARNING: directory $FAI/class not found."
     fi
 }
 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-get_fai_cvs() {
-
-    # subroutine which gets $FAI (/fai) configuration directory from
-    # a cvs repository. You can redefine this subroutine if you need
-    # access via ftp, http, or from a database
-
-    if [ "$FAI_CVSROOT" ] ; then
-        local TAG=""
-	[ -n "$FAI_CVSTAG" ] && TAG="-r $FAI_CVSTAG"
-        export FAI_CONFIG_AREA=$FAI_ROOT$FAI
-        export FAI=$(mktemp -t -d fai-config.XXXXXX)
-        
-	[ "$debug" ] && echo "\$FAI now points to $FAI"
-        
-	if [ -d "$FAI_CONFIG_AREA/CVS" -a -z "$FORCE" ] ; 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
-	else 
-	   echo "Checking out CVS"
-	   cd /tmp
-	   cvs -q -d"$FAI_CVSROOT" co -P -d $(basename "$FAI") \
-	     $TAG $FAI_CVSMODULE > $LOGDIR/cvs.log
-	fi
-    else
-	echo "Warning $0: Neither \$FAI_LOCATION nor \$FAI_CVSROOT are defined."
-    fi
-    cd /
-}
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 define_fai_flags() {
 
     local flag




More information about the Fai-commit mailing list