ldap/admin/src/scripts/DSCreate.pm.in | 28 +++++++++++++++++++---------
1 file changed, 19 insertions(+), 9 deletions(-)
New commits:
commit 255586bdb153aba2e006d5f238662ef33df1841b
Author: Rich Megginson <rmeggins(a)redhat.com>
Date: Wed Dec 14 13:51:00 2011 -0700
Bug 755754 - Unable to start dirsrv service using systemd
https://bugzilla.redhat.com/show_bug.cgi?id=755754
Resolves: bug 755754
Bug Description: Unable to start dirsrv service using systemd
Reviewed by: nhosoi (Thanks!)
Branch: master
Fix Description: Instead of blindly creating symlinks for dirsrv service
instances, check to see if there is already a service with that name.
Platforms tested: Fedora 16
Flag Day: no
Doc impact: no
diff --git a/ldap/admin/src/scripts/DSCreate.pm.in
b/ldap/admin/src/scripts/DSCreate.pm.in
index c2164d1..c60ca89 100644
--- a/ldap/admin/src/scripts/DSCreate.pm.in
+++ b/ldap/admin/src/scripts/DSCreate.pm.in
@@ -1063,7 +1063,8 @@ sub updateTmpfilesDotD {
sub updateSystemD {
my $inf = shift;
my $unitdir = "@systemdsystemunitdir@";
- my $confdir = "@systemdsystemconfdir@/@systemdgroupname@.wants";
+ my $confbasedir = "@systemdsystemconfdir@";
+ my $confdir = "$confbasedir/@systemdgroupname@.wants";
if (!$unitdir or !$confdir or ! -d $unitdir or ! -d $confdir) {
debug(3, "no systemd - skipping\n");
@@ -1082,15 +1083,24 @@ sub updateSystemD {
for my $file (glob("$initconfigdir/$pkgname-*")) {
my $inst = $file;
$inst =~ s/^.*$pkgname-//;
- my $servicelink = "$confdir/$pkgname\(a)$inst.service";
- if (! -l $servicelink) {
- if (!symlink($servicefile, $servicelink)) {
- debug(1, "error updating link $servicelink to $servicefile -
$!\n");
- push @errs, [ 'error_linking_file', $servicefile, $servicelink,
$! ];
- } else {
- debug(2, "updated link $servicelink to $servicefile\n");
+ # see if this is the admin or snmp or some other service
+ if (-f "$unitdir/$pkgname-$inst.service") {
+ debug(1, "$unitdir/$pkgname-$inst.service already exists -
skipping\n");
+ next;
+ } elsif (-f "$confbasedir/$pkgname-$inst.service") {
+ debug(1, "$confbasedir/$pkgname-$inst.service already exists -
skipping\n");
+ next;
+ } else {
+ my $servicelink = "$confdir/$pkgname\(a)$inst.service";
+ if (! -l $servicelink) {
+ if (!symlink($servicefile, $servicelink)) {
+ debug(1, "error updating link $servicelink to $servicefile -
$!\n");
+ push @errs, [ 'error_linking_file', $servicefile,
$servicelink, $! ];
+ } else {
+ debug(2, "updated link $servicelink to $servicefile\n");
+ }
+ $changes++;
}
- $changes++;
}
}
# next, look for instances that have been removed