>From 331d60e55e68632a7403adfac1f37bd3202f839d Mon Sep 17 00:00:00 2001
From: Rich Megginson <rmegg...@redhat.com>
Date: Mon, 20 Jun 2011 19:24:37 -0600
Subject: [PATCH] skip rebranding current brand

if the current brand is the same as the new brand,
skip rebranding
the branding information is now in the skin .inf file,
so get the brand information using getInfs
---
 admserv/newinst/src/25rebrand.pl.in |   16 +++++++++++++---
 1 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/admserv/newinst/src/25rebrand.pl.in b/admserv/newinst/src/25rebrand.pl.in
index 75f4b23..0619211 100644
--- a/admserv/newinst/src/25rebrand.pl.in
+++ b/admserv/newinst/src/25rebrand.pl.in
@@ -13,15 +13,22 @@ my @old_brands = ({cap => 'Red Hat',
                    norm => 'fedora',
                    vend => 'Fedora Project'});
 
-my $newbrand = {cap => "@capbrand@",
-                norm => "@brand@",
-                vend => "@vendor@"};
+my $admininf = (getInfs("admin"))[0];
+
+my $newbrand = {cap => $admininf->{admin}->{Brand},
+                norm => $admininf->{admin}->{NormBrand},
+                vend => $admininf->{admin}->{Vendor}};
 
 my @attrs = ("*", 'aci');
 my $nsrootdn = "o=NetscapeRoot";
 my $myhost = "";
 my @mapoldnew = ();
 
+sub sameBrand {
+    my ($old, $new) = @_;
+    return $old->{norm} eq $new->{norm};
+}
+
 sub replaceOldNewEntry {
     my ($ent, @ary) = @_;
     my $changes = 0;
@@ -231,6 +238,7 @@ sub rebrandSieAndIsie {
 
         # search for old brands
         for my $oldbrand (@old_brands) {
+            next if (sameBrand($oldbrand, $newbrand));
             my @ents = ($isie, $sie);
             my $sieconf = "cn=configuration," . $siedn;
             for ($ent = $conn->search($sieconf, "sub", "objectclass=*", 0, @attrs);
@@ -293,6 +301,7 @@ sub rebrandConfFiles {
     my $count = 0; # reset
     while (my ($key, $val) = each %{$admConf}) {
         for my $oldbrand (@old_brands) {
+            next if (sameBrand($oldbrand, $newbrand));
             $count += ($val =~ s/cn=$oldbrand->{cap}/cn=$newbrand->{cap}/g); # fix DNs
             $count += ($val =~ s/\@$oldbrand->{norm}-admin/\@$newbrand->{norm}-admin/g); # fix jar names
             $count += ($val =~ s/\@$oldbrand->{norm}-ds/\@$newbrand->{norm}-ds/g); # fix jar names
@@ -313,6 +322,7 @@ sub rebrandConfFiles {
         $count = 0; # reset
         for my $line (@lines) {
             for my $oldbrand (@old_brands) {
+                next if (sameBrand($oldbrand, $newbrand));
                 $count += ($line =~ s/cn=$oldbrand->{cap}/cn=$newbrand->{cap}/g); # fix DNs
                 $count += ($line =~ s/\@$oldbrand->{norm}-admin/\@$newbrand->{norm}-admin/g); # fix jar names
                 $count += ($line =~ s/\@$oldbrand->{norm}-ds/\@$newbrand->{norm}-ds/g); # fix jar names
-- 
1.7.1

--
389-devel mailing list
389-devel@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/389-devel

Reply via email to