[Fai-commit] r4402 - in people/lazyboy/rhel-install-fixes_3.1.8: bin debian lib

lazyboy-guest at alioth.debian.org lazyboy-guest at alioth.debian.org
Fri Jul 6 00:50:45 UTC 2007


Author: lazyboy-guest
Date: 2007-07-06 00:50:44 +0000 (Fri, 06 Jul 2007)
New Revision: 4402

Modified:
   people/lazyboy/rhel-install-fixes_3.1.8/bin/install_packages
   people/lazyboy/rhel-install-fixes_3.1.8/debian/changelog
   people/lazyboy/rhel-install-fixes_3.1.8/lib/subroutines
Log:
add fixes to do dirinstall for rpm based distributions - refine libapt checking, and only use it, if we are really installing a debian distribution

Modified: people/lazyboy/rhel-install-fixes_3.1.8/bin/install_packages
===================================================================
--- people/lazyboy/rhel-install-fixes_3.1.8/bin/install_packages	2007-07-06 00:40:44 UTC (rev 4401)
+++ people/lazyboy/rhel-install-fixes_3.1.8/bin/install_packages	2007-07-06 00:50:44 UTC (rev 4402)
@@ -32,10 +32,44 @@
 
 use strict;
 use Getopt::Std;
-use AptPkg::Config '$_config';
-use AptPkg::System '$_system';
-use AptPkg::Cache;
+use vars qw/$aptpkg_avail/;
 
+my @classes;
+ at classes = grep { !/^#|^\s*$/ } split(/[\s\n]+/,$ENV{classes});
+
+#$aptpkg_avail=-1;
+
+#if (eval 	"require AptPkg::Config") {
+#	$aptpkg_avail=1;
+#}
+
+# TODO: even if apt is available, turn it off if target is not a debian
+# system!
+#if ( grep $_ eq 'DIST-DEBIAN', @classes) {
+#    $aptpkg_avail=-1;
+#} elsif ( eval 	"require AptPkg::Config" &&  grep $_ eq 'DIST-DEBIAN', @classes ) {
+if ( eval 	"require AptPkg::Config" &&  grep $_ eq 'DIST-DEBIAN', @classes ) {
+	$aptpkg_avail=1;
+} else {
+    $aptpkg_avail=-1;
+}
+
+
+my $_config;
+my $_system;
+
+if ($aptpkg_avail==1) { 
+    print "this is a debian system\n";
+    eval 	"require AptPkg::System";
+    eval 	"require AptPkg::Cache";
+
+    $_config = $AptPkg::Config::_config;
+    $_system = $AptPkg::System::_system;
+    eval	'import AptPkg::Config $_config';
+    eval 	'import AptPkg::System $_system';
+    eval 	'import AptPkg::Cache';
+}
+
 # global variables
 our ($opt_d,$opt_l,$opt_L,$opt_v,$opt_h,$opt_t,$opt_m,$opt_p);
 my $listonly; # flag, that indicates that only a list of packages will be printed
@@ -45,7 +79,6 @@
 my $test;
 my $verbose;
 my $FAI_ROOT;
-my @classes;
 my $classpath;
 my $rootcmd;
 my @preloadlist;
@@ -110,14 +143,18 @@
 $FAI_ROOT = $ENV{FAI_ROOT};
 $classpath = $opt_p || "$ENV{FAI}/package_config";
 $rootcmd = ($FAI_ROOT eq "/" ) ? '' : "chroot $FAI_ROOT";
- at classes = grep { !/^#|^\s*$/ } split(/[\s\n]+/,$ENV{classes});
+# HENNING: moved up, needed to check if we are installing debian and running
+# on debian
+#@classes = grep { !/^#|^\s*$/ } split(/[\s\n]+/,$ENV{classes});
 foreach (@classes) { $classisdef{$_}=1;}
 
-$_config->init;                 # initialize AptPkg
-$_config->set("Dir",$FAI_ROOT); # simulate "chroot"
-$_config->{quiet}=2;            # don't show cache initialization messages
-$_system = $_config->system;
-$cache = new AptPkg::Cache;
+if ($aptpkg_avail==1) {
+	$_config->init;                 # initialize AptPkg
+	$_config->set("Dir",$FAI_ROOT); # simulate "chroot"
+	$_config->{quiet}=2;            # don't show cache initialization messages
+	$_system = $_config->system;
+	$cache = new AptPkg::Cache;
+}
 
 # read all package config files
 foreach (@classes) {
@@ -211,14 +248,15 @@
   unlink $file || warn "Can't remove $file\n";
 }
 
-
-# in case of unconfigured packages because of apt errors
-# retry configuration
-execute("$rootcmd $command{pending}");
-# check if all went right
-execute("$rootcmd $command{dpkgc}");
-# clean apt cache
-execute("$rootcmd $command{clean}");
+if ($aptpkg_avail==1) {
+	# in case of unconfigured packages because of apt errors
+	# retry configuration
+	execute("$rootcmd $command{pending}");
+	# check if all went right
+	execute("$rootcmd $command{dpkgc}");
+	# clean apt cache
+	execute("$rootcmd $command{clean}");
+}
 # - - - - - - - - - - - - - - - - - - - - - - - - - - -
 sub readconfig {
 
@@ -341,8 +379,10 @@
 
   foreach (reverse @complete) {
     my $pack = $_;
-    if ( /^(.+)[_=+-]$/ and $1 and $cache->exists($1)) {
-      $pack = $1;
+    if ($aptpkg_avail==1) {
+        if ( /^(.+)[_=+-]$/ and $1 and $cache->exists($1)) {
+            $pack = $1;
+        }
     }
     if (! defined ($complete{$pack})) {
       $complete{$pack} = 1;

Modified: people/lazyboy/rhel-install-fixes_3.1.8/debian/changelog
===================================================================
--- people/lazyboy/rhel-install-fixes_3.1.8/debian/changelog	2007-07-06 00:40:44 UTC (rev 4401)
+++ people/lazyboy/rhel-install-fixes_3.1.8/debian/changelog	2007-07-06 00:50:44 UTC (rev 4402)
@@ -1,3 +1,9 @@
+fai (3.1.8rheldemo0.2.1) unstable; urgency=low
+
+  * add rhel demo example config
+
+ -- Henning Sprang <henning at sprang.de>  Thu,  5 Jul 2007 19:26:51 +0200
+
 fai (3.1.8) unstable; urgency=medium
 
   * conf/NFSROOT: remove unknow package name (closes: 407950)

Modified: people/lazyboy/rhel-install-fixes_3.1.8/lib/subroutines
===================================================================
--- people/lazyboy/rhel-install-fixes_3.1.8/lib/subroutines	2007-07-06 00:40:44 UTC (rev 4401)
+++ people/lazyboy/rhel-install-fixes_3.1.8/lib/subroutines	2007-07-06 00:50:44 UTC (rev 4402)
@@ -503,7 +503,9 @@
     fi
     # the following copy operation is required to make $LOGDIR a reliable source
     # for disk_var.sh
-    cp -p /var/lib/fai/disk_var.sh $LOGDIR # use the last disk_var during update
+    [ -f /var/lib/fai/disk_var.sh ] && cp -p /var/lib/fai/disk_var.sh $LOGDIR # use the last disk_var during update
+    # was before:
+    #cp -p /var/lib/fai/disk_var.sh $LOGDIR # use the last disk_var during update
 
     defnop wait_for_jobs
     save_dmesg




More information about the Fai-commit mailing list