From 21cb6eb9312f30d2fd6ef8b413245a79a81a27e7 Mon Sep 17 00:00:00 2001
From: mxi1 <mxi1@8638fb3e-16cb-4fca-ae20-7b5d299a9bcd>
Date: Wed, 8 Apr 2009 07:37:35 +0000
Subject: [PATCH] -update diskless SLES11 environment, move ppc64 away and make
 the .pkglist, and .postinstall files adaptive for all <arch>s

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@3123 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
---
 ...glist => compute.sles11.otherpkgs.pkglist} |  0
 ...1.ppc64.pkglist => compute.sles11.pkglist} |  2 +-
 ...postinstall => compute.sles11.postinstall} |  0
 xCAT-server/share/xcat/netboot/sles/genimage  | 24 +++++++++++++------
 .../share/xcat/netboot/sles/service.repolist  |  4 ----
 ...1.ppc64.pkglist => service.sles11.pkglist} |  0
 ...postinstall => service.sles11.postinstall} |  2 --
 .../sles/service.sles11.ppc64.repolist        | 13 ++++++++++
 8 files changed, 31 insertions(+), 14 deletions(-)
 rename xCAT-server/share/xcat/netboot/sles/{compute.sles11.ppc64.otherpkgs.pkglist => compute.sles11.otherpkgs.pkglist} (100%)
 rename xCAT-server/share/xcat/netboot/sles/{compute.sles11.ppc64.pkglist => compute.sles11.pkglist} (89%)
 rename xCAT-server/share/xcat/netboot/sles/{compute.sles11.ppc64.postinstall => compute.sles11.postinstall} (100%)
 rename xCAT-server/share/xcat/netboot/sles/{service.sles11.ppc64.pkglist => service.sles11.pkglist} (100%)
 rename xCAT-server/share/xcat/netboot/sles/{service.sles11.ppc64.postinstall => service.sles11.postinstall} (98%)
 create mode 100644 xCAT-server/share/xcat/netboot/sles/service.sles11.ppc64.repolist

diff --git a/xCAT-server/share/xcat/netboot/sles/compute.sles11.ppc64.otherpkgs.pkglist b/xCAT-server/share/xcat/netboot/sles/compute.sles11.otherpkgs.pkglist
similarity index 100%
rename from xCAT-server/share/xcat/netboot/sles/compute.sles11.ppc64.otherpkgs.pkglist
rename to xCAT-server/share/xcat/netboot/sles/compute.sles11.otherpkgs.pkglist
diff --git a/xCAT-server/share/xcat/netboot/sles/compute.sles11.ppc64.pkglist b/xCAT-server/share/xcat/netboot/sles/compute.sles11.pkglist
similarity index 89%
rename from xCAT-server/share/xcat/netboot/sles/compute.sles11.ppc64.pkglist
rename to xCAT-server/share/xcat/netboot/sles/compute.sles11.pkglist
index 47a532e60..f1d55c54b 100644
--- a/xCAT-server/share/xcat/netboot/sles/compute.sles11.ppc64.pkglist
+++ b/xCAT-server/share/xcat/netboot/sles/compute.sles11.pkglist
@@ -3,7 +3,7 @@ bash
 nfs-utils
 #stunnel
 dhcpcd 
-kernel-ppc64
+kernel
 openssh
 #procps
 psmisc
diff --git a/xCAT-server/share/xcat/netboot/sles/compute.sles11.ppc64.postinstall b/xCAT-server/share/xcat/netboot/sles/compute.sles11.postinstall
similarity index 100%
rename from xCAT-server/share/xcat/netboot/sles/compute.sles11.ppc64.postinstall
rename to xCAT-server/share/xcat/netboot/sles/compute.sles11.postinstall
diff --git a/xCAT-server/share/xcat/netboot/sles/genimage b/xCAT-server/share/xcat/netboot/sles/genimage
index cb2360569..d9d1231d9 100755
--- a/xCAT-server/share/xcat/netboot/sles/genimage
+++ b/xCAT-server/share/xcat/netboot/sles/genimage
@@ -153,19 +153,22 @@ unless ($onlyinitrd) {
    }
 
    #-- add custom repositories to the image
-   if (-r "$pathtofiles/$profile.repolist") {
-     $repolist = "$pathtofiles/$profile.repolist";
+   if ( -r "$pathtofiles/$profile.$osver.$arch.repolist") {
+       $repolist = "$pathtofiles/$profile.$osver.$arch.repolist";
+   }elsif ( -r "$pathtofiles/$profile.$osver.repolist") {
+       $repolist = "$pathtofiles/$profile.$osver.repolist";
+   }elsif ( -r "$pathtofiles/$profile.repolist") {
+       $repolist = "$pathtofiles/$profile.repolist";
+   }
+
+   if ( -r "$repolist") {
      print "Reading custom repositories\n";
      open($repoconfig,"<","$repolist");
      while (<$repoconfig>) {
        chomp;
        next if /^\s*#/;
        ($repotype,$repourl,$repoalias) = split m/\|/;
-       if ($osver =~ /sles11/ && $osver_host == 11) {
-           system("zypper -R $installroot/netboot/$osver/$arch/$profile/rootimg/ ar $repourl $repoalias");
-       }else {
-           system("zypper -R $installroot/netboot/$osver/$arch/$profile/rootimg/ sa -t $repotype $repourl $repoalias");
-       }
+       system("zypper -R $installroot/netboot/$osver/$arch/$profile/rootimg/ ar $repourl $repoalias");
      }
    }
 
@@ -221,6 +224,13 @@ if (-x "$pathtofiles/$profile.$osver.$arch.postinstall") {
         exit 1;
     }
 }
+elsif (-x "$pathtofiles/$profile.$osver.postinstall") {
+    my $rc = system("$pathtofiles/$profile.$osver.postinstall","$installroot/netboot/$osver/$arch/$profile/rootimg",$osver,$arch,$profile);
+    if ($rc) {
+        print "posinstall script failed\n";
+        exit 1;
+    }
+}
 elsif (-x "$pathtofiles/$profile.postinstall") {
    my $rc = system("$pathtofiles/$profile.postinstall","$installroot/netboot/$osver/$arch/$profile/rootimg",$osver,$arch,$profile);
    if ($rc) {
diff --git a/xCAT-server/share/xcat/netboot/sles/service.repolist b/xCAT-server/share/xcat/netboot/sles/service.repolist
index 875d869d5..e0426aecd 100644
--- a/xCAT-server/share/xcat/netboot/sles/service.repolist
+++ b/xCAT-server/share/xcat/netboot/sles/service.repolist
@@ -8,7 +8,3 @@
 #Type|URL|name
 #-- example:
 #Plaindir|file:/install/sles10sp2/x86_64/custom|custom
-
-rpm-md|http://xcat.sourceforge.net/yum/xcat-dep/sles11/ppc64|xcat-dep
-rpm-md|http://xcat.sourceforge.net/yum/devel/core-snap|core-snap
-plaindir|file:///install/post/otherpkgs/sles11/ppc64|otherpkgs
diff --git a/xCAT-server/share/xcat/netboot/sles/service.sles11.ppc64.pkglist b/xCAT-server/share/xcat/netboot/sles/service.sles11.pkglist
similarity index 100%
rename from xCAT-server/share/xcat/netboot/sles/service.sles11.ppc64.pkglist
rename to xCAT-server/share/xcat/netboot/sles/service.sles11.pkglist
diff --git a/xCAT-server/share/xcat/netboot/sles/service.sles11.ppc64.postinstall b/xCAT-server/share/xcat/netboot/sles/service.sles11.postinstall
similarity index 98%
rename from xCAT-server/share/xcat/netboot/sles/service.sles11.ppc64.postinstall
rename to xCAT-server/share/xcat/netboot/sles/service.sles11.postinstall
index 25c3d2fb0..69b45e027 100755
--- a/xCAT-server/share/xcat/netboot/sles/service.sles11.ppc64.postinstall
+++ b/xCAT-server/share/xcat/netboot/sles/service.sles11.postinstall
@@ -33,8 +33,6 @@ END
 
 
 cat <<END >>$installroot/etc/hosts
-9.114.47.247	xcat_n02
-9.114.47.248	xcat_n03
 END
 
 
diff --git a/xCAT-server/share/xcat/netboot/sles/service.sles11.ppc64.repolist b/xCAT-server/share/xcat/netboot/sles/service.sles11.ppc64.repolist
new file mode 100644
index 000000000..771b1f94b
--- /dev/null
+++ b/xCAT-server/share/xcat/netboot/sles/service.sles11.ppc64.repolist
@@ -0,0 +1,13 @@
+#-- 
+#-- This file contains list of custom repositories (directory with rpms).
+#-- Repositories will be added to the image before package installation.
+#-- This makes possible to automatically install (by defining in {profile}.pkglist)
+#-- packages that are not contained in standard distribution repository
+#-- 
+#-- File format:
+#Type|URL|name
+#-- example:
+#Plaindir|file:/install/sles10sp2/x86_64/custom|custom
+rpm-md|http://xcat.sourceforge.net/yum/xcat-dep/sles11/ppc64|xcat-dep
+rpm-md|http://xcat.sourceforge.net/yum/devel/core-snap|core-snap
+plaindir|file:///install/post/otherpkgs/sles11/ppc64|otherpkgs