[ewg] [PATCH] ofed_1_3/ofed_scripts: Add vendor script pre/post hooks for OFED install/uninstall

Moni Shoua monisonlists at gmail.com
Sun Jan 6 06:08:02 PST 2008


This is a modification to the section in the patch for the file install.pl
The pupose of the change is to allow ofed.conf to contain lines of the form
vendor_script* (e.g. vendor_config_fix_something=yes). 
When install.pl parses the configuration file it silently ignores lines that
start with vendor_config.


--- a/install.pl	2007-12-12 13:43:57.000000000 +0200
+++ b/install.pl	2008-01-06 18:03:55.000000000 +0200
@@ -59,6 +59,11 @@
 my $clear_string = `clear`;
 my $upgrade_open_iscsi = 0;
 
+my $vendor_pre_install = "";
+my $vendor_post_install = "";
+my $vendor_pre_uninstall = "";
+my $vendor_post_uninstall = "";
+
 my $distro;
 
 my $build32 = 0;
@@ -2041,6 +2046,54 @@
                     next;
                 }
 
+                if (substr($package,0,length("vendor_config")) eq "vendor_config") {
+			next;
+		}
+
+                if ($package eq "vendor_pre_install") {
+		    if ( -f $selected ) {
+			$vendor_pre_install = dirname($selected) . '/' . basename($selected);
+		    }
+		    else {
+			print RED "\nVendor script $selected is not found", RESET "\n" if (not $quiet);
+			exit 1
+		    }
+                    next;
+                }
+
+                if ($package eq "vendor_post_install") {
+		    if ( -f $selected ) {
+			$vendor_post_install = dirname($selected) . '/' . basename($selected);
+		    }
+		    else {
+			print RED "\nVendor script $selected is not found", RESET "\n" if (not $quiet);
+			exit 1
+		    }
+                    next;
+                }
+
+                if ($package eq "vendor_pre_uninstall") {
+		    if ( -f $selected ) {
+			$vendor_pre_uninstall = dirname($selected) . '/' . basename($selected);
+		    }
+		    else {
+			print RED "\nVendor script $selected is not found", RESET "\n" if (not $quiet);
+			exit 1
+		    }
+                    next;
+                }
+
+                if ($package eq "vendor_post_uninstall") {
+		    if ( -f $selected ) {
+			$vendor_post_uninstall = dirname($selected) . '/' . basename($selected);
+		    }
+		    else {
+			print RED "\nVendor script $selected is not found", RESET "\n" if (not $quiet);
+			exit 1
+		    }
+                    next;
+                }
+
                 if ($package eq "kernel_configure_options" or $package eq "OFA_KERNEL_PARAMS") {
                     $kernel_configure_options = $selected;
                     next;
@@ -3662,7 +3715,33 @@
     
     # Uninstall the previous installations
     uninstall();
+    my $vendor_ret;
+    if (length($vendor_pre_install) > 0) {
+	    print BLUE "\nRunning vendor pre install script: $vendor_pre_install", RESET "\n" if (not $quiet);
+	    $vendor_ret = system ( "$vendor_pre_install", "CONFIG=$config",
+		"RPMS=$RPMS", "SRPMS=$SRPMS", "PREFIX=$prefix", "TOPDIR=$TOPDIR", "QUIET=$quiet" );
+	    if ($vendor_ret != 0) {
+		    print RED "\nExecution of vendor pre install script failed.", RESET "\n" if (not $quiet);
+		    exit 1;
+	    }
+    }
     install();
+    if (length($vendor_pre_uninstall) > 0) {
+	    system "cp $vendor_pre_uninstall $prefix/sbin/vendor_pre_uninstall.sh";
+    }
+    if (length($vendor_post_uninstall) > 0) {
+	    system "cp $vendor_post_uninstall $prefix/sbin/vendor_post_uninstall.sh";
+    }
+    if (length($vendor_post_install) > 0) {
+	    print BLUE "\nRunning vendor post install script: $vendor_post_install", RESET "\n" if (not $quiet);
+	    $vendor_ret = system ( "$vendor_post_install", "CONFIG=$config",
+		"RPMS=$RPMS", "SRPMS=$SRPMS", "PREFIX=$prefix", "TOPDIR=$TOPDIR", "QUIET=$quiet");
+	    if ($vendor_ret != 0) {
+		    print RED "\nExecution of vendor post install script failed.", RESET "\n" if (not $quiet);
+		    exit 1;
+	    }
+    }
+
     if ($kernel_modules_info{'ipoib'}{'selected'}) {
         ipoib_config();
     }




More information about the ewg mailing list