[Fai-commit] r5932 - in trunk: debian lib

Thomas Lange lange at alioth.debian.org
Sun Aug 1 21:55:29 UTC 2010


Author: lange
Date: 2010-08-01 21:55:28 +0000 (Sun, 01 Aug 2010)
New Revision: 5932

Modified:
   trunk/debian/changelog
   trunk/lib/subroutines
Log:
subroutines: new code for prepareapt(). First, try to copy important
files (hosts, resolv.conf, sources.list, preferences) from the config
space, if not found use version from the nfsroot. Also try whole
directorie tree /etc/apt from config space

Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog	2010-08-01 19:46:32 UTC (rev 5931)
+++ trunk/debian/changelog	2010-08-01 21:55:28 UTC (rev 5932)
@@ -1,4 +1,4 @@
-fai (3.4~beta18) unstable; urgency=low
+fai (3.4~beta20) unstable; urgency=low
 
   [ Thomas Lange ]
   * get-config-dir-http: new script to get a tarball of the config space
@@ -103,6 +103,10 @@
   * ftar: die() subroutine now takes exit code, code cleanup
   * fai-mirror: code cleanup
   * updatebase, subroutines: move code for loading apt keys to updatebase
+  * subroutines: new code for prepareapt(). First, try to copy important
+    files (hosts, resolv.conf, sources.list, preferences) from the config
+    space, if not found use version from the nfsroot. Also try whole
+    directorie tree /etc/apt from config space
   
   [ Michael Tautschnig ]
   * setup-storage: Bumped version number to 1.3
@@ -180,7 +184,7 @@
     if the shortname has no match in device.map. Needed now that grub2 in
     unstable has switched to using stable names in device.map.
   
- -- Thomas Lange <lange at debian.org>  Thu, 29 Jul 2010 23:23:36 -0400
+ -- Thomas Lange <lange at debian.org>  Sun, 01 Aug 2010 16:37:14 -0400
 
 fai (3.3.5) unstable; urgency=high
 

Modified: trunk/lib/subroutines
===================================================================
--- trunk/lib/subroutines	2010-08-01 19:46:32 UTC (rev 5931)
+++ trunk/lib/subroutines	2010-08-01 21:55:28 UTC (rev 5932)
@@ -843,29 +843,24 @@
 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 ### BEGIN SUBROUTINE INFO
 # Provides-Var:    none
-# Requires-Var:    $FAI_ROOT $FAI_ETC_DIR
-# Suggests-Var:    $IPADDR $DOMAIN
+# Requires-Var:    $FAI_ROOT $FAI_ETC_DIR $FAI_ALLOW_UNSIGNED
+# Suggests-Var:
 # Short-Description: <task desc.>
 ### END SUBROUTINE INFO
 
 task_prepareapt () {
 
-    # ftp and http needs resolv.conf in chroot environment, /etc/hosts is useful
-    # think about using fcopy for these two files
-    [ -f /etc/resolv.conf ] && cp /etc/resolv.conf $FAI_ROOT/etc
-    [ -f /etc/hosts ] && cp /etc/hosts $FAI_ROOT/etc
-    # set hostname in $FAI_ROOT
-    if [ -f /var/run/fai/FAI_INSTALLATION_IN_PROGRESS ]; then
-      echo $HOSTNAME >$FAI_ROOT/etc/hostname
-    fi
-
-
-    # during normal installation, we need sources.list from /etc/apt
-    # currently /target/etc/apt gets overwritten by the contents of /etc/apt from inside the nfsroot
     [ $do_init_tasks -eq 1 ] && FAI_ETC_DIR=/etc
-    [ -d $FAI_ETC_DIR/apt ] && cp -r $FAI_ETC_DIR/apt/* $FAI_ROOT/etc/apt/
 
-    rm -f $FAI_ROOT/etc/apt/apt.conf.d/10fai # disable AllowUnauthenticated, which was used in the nfsroot
+    # resolv.conf is needed, /etc/hosts is useful in /target
+    # use a file from the config space or from /etc inside the nfsroot
+    fcopy -Bv /etc/apt/sources.list || cp -v $FAI_ETC_DIR/apt/sources.list $FAI_ROOT/etc/apt
+    fcopy -Bv /etc/apt/preferences || [ -f $FAI_ETC_DIR/apt/preferences ] && \ 
+          cp -v $FAI_ETC_DIR/apt/preferences $FAI_ROOT/etc/apt
+    fcopy -Bv /etc/resolv.conf || cp -v /etc/resolv.conf $FAI_ROOT/etc
+    fcopy -Bv /etc/hosts || cp -v /etc/hosts $FAI_ROOT/etc
+    fcopy -ir /etc/apt # copy all other apt config files from the config space
+
     if [ X$FAI_ALLOW_UNSIGNED = X1 ]; then
 	cat <<EOF > $FAI_ROOT/etc/apt/apt.conf.d/10fai
 APT::Get::AllowUnauthenticated "true";




More information about the Fai-commit mailing list