The attached patch will add a new function to si_prepareclient where you can pass it the location of the image you want to search for appropriate kernel and modules-dir and generate UYOK boot binaries from - handy to run on image server where all your images are.
 
Thanks,
 
Bernard
Index: lib/SystemImager/UseYourOwnKernel.pm
===================================================================
--- lib/SystemImager/UseYourOwnKernel.pm        (revision 3700)
+++ lib/SystemImager/UseYourOwnKernel.pm        (working copy)
@@ -29,7 +29,7 @@
 
 #
 # Usage: 
-#       SystemImager::UseYourOwnKernel->create_uyok_initrd($arch, $my_modules, 
$custom_kernel, $custom_mod_dir, $verbose);
+#       SystemImager::UseYourOwnKernel->create_uyok_initrd($arch, $my_modules, 
$custom_kernel, $custom_mod_dir, $image, $verbose);
 #
 sub create_uyok_initrd() {
 
@@ -38,6 +38,7 @@
         my $my_modules     = shift;
         my $custom_kernel  = shift;
         my $custom_mod_dir = shift;
+        my $image          = shift;
         $verbose           = shift;
 
         use File::Copy;
@@ -81,6 +82,13 @@
         }
 
         my $uname_r = get_uname_r();
+
+        if ($image) {
+            $custom_kernel = _choose_kernel_file( $uname_r, $image );
+            my $kernel_release = _get_kernel_release($custom_kernel);
+            $custom_mod_dir = "$image/lib/modules/$kernel_release";
+        }
+
         my $module_dir;
         if ($custom_mod_dir) {
             $module_dir = $custom_mod_dir;
@@ -267,7 +275,10 @@
                 my ($input) = (<INPUT>);
                 #
                 # eliminate vmlinux files on RH
-                if( $input =~ m/ELF 32-bit LSB executable,/ ) { return undef; 
}    
+                if( $input =~ m/ELF 32-bit LSB executable,/ ) { return undef; }
+                #
+                # eliminate compressed data (eg. ramdisk)
+                if( $input =~ m/gzip compressed data,/ ) { return undef; }
         close(INPUT);
 
         #
@@ -277,12 +288,14 @@
 
 #
 # Usage:
-#       my $kernel_file = _choose_kernel_file( $uname_r );
+#       my $kernel_file = _choose_kernel_file( $uname_r, $image_dir );
 #
 sub _choose_kernel_file($) {
 
         my $uname_r = shift;
-        my @dirs = ('/boot', '/');
+        my $image_dir = shift;
+        $image_dir = '' if !($image_dir);
+        my @dirs = ("$image_dir/boot", "$image_dir/");
         my @kernels;
 
         foreach my $dir (@dirs) {
Index: sbin/si_prepareclient
===================================================================
--- sbin/si_prepareclient       (revision 3700)
+++ sbin/si_prepareclient       (working copy)
@@ -183,6 +183,11 @@
     Use this parameter only with --kernel and only if you use UYOK
     feature.
 
+ --image DIR
+    Get kernel and kernel modules automatically from the image location
+    specified in DIR to use with UYOK (if executed on image server).
+    Use this parameter only if you use UYOK feature.
+
 Download, report bugs, and make suggestions at:
 http://systemimager.org/
 
@@ -200,6 +205,7 @@
     "my-modules"           => \my $my_modules,
     "kernel=s"             => \my $custom_kernel,
     "modules-dir=s"        => \my $modules_dir,
+    "image=s"              => \my $image,
     "version"              => \my $version,
     "server=s"             => \my $server,
     "yes"                  => \my $yes
@@ -255,6 +261,18 @@
     exit 1;
 }
 
+if($no_uyok and $image) {
+    print "FATAL:  --no-uyok option conflicts with --image DIR!\n";
+    print qq(Try "$progname --help" for more info.\n);
+    exit 1;
+}
+
+if($custom_kernel and $image) {
+    print "FATAL:  --kernel KERNEL option conflicts with --image DIR!\n";
+    print qq(Try "$progname --help" for more info.\n);
+    exit 1;
+}
+
 # Make sure we have certain tools that we need.
 which('rsync') or croak("'rsync' is required for $progname to function 
properly.  Please see http://systemimager.org for more details.");
 which('systemconfigurator') or croak("'systemconfigurator' is required for 
$progname to function properly.  Please see http://systemimager.org for more 
details.");
@@ -703,7 +721,7 @@
         my $arch = get_arch();
         my $verbose;
         unless($quiet) { $verbose = 1; }
-        SystemImager::UseYourOwnKernel->create_uyok_initrd( $arch, 
$my_modules, $custom_kernel, $modules_dir, $verbose );
+        SystemImager::UseYourOwnKernel->create_uyok_initrd( $arch, 
$my_modules, $custom_kernel, $modules_dir, $image, $verbose );
     }
 
     SystemImager::Common->write_auto_install_script_conf_footer($file);
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Sisuite-devel mailing list
Sisuite-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sisuite-devel

Reply via email to