andykimpe / rpms / 389-ds-base

Forked from rpms/389-ds-base 5 months ago
Clone
dc8c34
From cfbe748bcf3d2e2a2903737ff3834bad05c96998 Mon Sep 17 00:00:00 2001
dc8c34
From: Nathan Kinder <nkinder@redhat.com>
dc8c34
Date: Wed, 16 Jan 2013 14:20:14 -0800
dc8c34
Subject: [PATCH] Ticket 556 - Don't overwrite certmap.conf during upgrade
dc8c34
dc8c34
The certmap.conf config files were being overwritten with the
dc8c34
default template during upgrade.  We need to skip writing the
dc8c34
certmap.conf files if they already exist so config changes are
dc8c34
not lost.
dc8c34
(cherry picked from commit e63ad6840e4a9a62f3ffae27eaba1091653a1c50)
dc8c34
---
dc8c34
 ldap/admin/src/scripts/DSCreate.pm.in |   16 ++++++++++------
dc8c34
 1 files changed, 10 insertions(+), 6 deletions(-)
dc8c34
dc8c34
diff --git a/ldap/admin/src/scripts/DSCreate.pm.in b/ldap/admin/src/scripts/DSCreate.pm.in
dc8c34
index 1d5e71a..0acd74f 100644
dc8c34
--- a/ldap/admin/src/scripts/DSCreate.pm.in
dc8c34
+++ b/ldap/admin/src/scripts/DSCreate.pm.in
dc8c34
@@ -482,12 +482,16 @@ sub makeOtherConfigFiles {
dc8c34
     my $src = "$inf->{General}->{prefix}@configdir@/certmap.conf";
dc8c34
     my $dest = "$inf->{slapd}->{config_dir}/certmap.conf";
dc8c34
     $! = 0; # clear errno
dc8c34
-    copy($src, $dest);
dc8c34
-    if ($!) {
dc8c34
-        return ('error_copying_file', $src, $dest, $!);
dc8c34
-    }
dc8c34
-    if (@errs = changeOwnerMode($inf, 4, $dest)) {
dc8c34
-        return @errs;
dc8c34
+
dc8c34
+    #in skip mode, skip files that already exist
dc8c34
+    unless ($skip and -f $dest) {
dc8c34
+        copy($src, $dest);
dc8c34
+        if ($!) {
dc8c34
+            return ('error_copying_file', $src, $dest, $!);
dc8c34
+        }
dc8c34
+        if (@errs = changeOwnerMode($inf, 4, $dest)) {
dc8c34
+            return @errs;
dc8c34
+        }
dc8c34
     }
dc8c34
 
dc8c34
     $src = "$inf->{General}->{prefix}@configdir@/slapd-collations.conf";
dc8c34
-- 
dc8c34
1.7.7.6
dc8c34