diff options
-rw-r--r-- | net-nds/389-ds-base/389-ds-base-1.3.4.7.ebuild | 156 | ||||
-rw-r--r-- | net-nds/389-ds-base/Manifest | 1 | ||||
-rw-r--r-- | net-nds/389-ds-base/files/389-ds-base-1.3.4.7-no-instance-script.patch | 396 | ||||
-rw-r--r-- | net-nds/389-ds-base/files/389-ds-base-1.3.4.7-shell-corrections.patch | 242 | ||||
-rw-r--r-- | net-nds/389-ds-base/files/389-ds.initd-r1 | 88 |
5 files changed, 883 insertions, 0 deletions
diff --git a/net-nds/389-ds-base/389-ds-base-1.3.4.7.ebuild b/net-nds/389-ds-base/389-ds-base-1.3.4.7.ebuild new file mode 100644 index 000000000000..e29a0c917109 --- /dev/null +++ b/net-nds/389-ds-base/389-ds-base-1.3.4.7.ebuild @@ -0,0 +1,156 @@ +# Copyright 1999-2016 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +EAPI=5 + +WANT_AUTOMAKE="1.9" +MY_P=${P/_alpha/.a} +MY_P=${MY_P/_rc/.rc} + +inherit user eutils multilib flag-o-matic autotools + +DESCRIPTION="389 Directory Server (core librares and daemons )" +HOMEPAGE="http://port389.org/" +SRC_URI="http://directory.fedoraproject.org/sources/${MY_P}.tar.bz2" + +LICENSE="GPL-3" +SLOT="0" +KEYWORDS="~amd64 ~x86" +IUSE="autobind auto-dn-suffix debug doc +pam-passthru +dna +ldapi +bitwise +presence kerberos selinux" + +ALL_DEPEND=" + =sys-libs/db-5*:* + >=dev-libs/cyrus-sasl-2.1.19 + >=net-analyzer/net-snmp-5.1.2 + >=dev-libs/icu-3.4:= + dev-libs/nss[utils] + dev-libs/nspr + dev-libs/svrcore + dev-libs/openssl:0= + dev-libs/libpcre:3 + >=dev-perl/perl-mozldap-1.5.3 + dev-perl/NetAddr-IP + net-nds/openldap + sys-libs/pam + sys-libs/zlib + kerberos? ( >=app-crypt/mit-krb5-1.7-r100[openldap] )" + +DEPEND="${ALL_DEPEND} + virtual/pkgconfig + sys-devel/libtool + doc? ( app-doc/doxygen ) + sys-apps/sed" +RDEPEND="${ALL_DEPEND} + selinux? ( sec-policy/selinux-dirsrv ) + virtual/perl-Time-Local + virtual/perl-MIME-Base64" + +S="${WORKDIR}/${MY_P}" + +pkg_setup() { + enewgroup dirsrv + enewuser dirsrv -1 -1 -1 dirsrv +} + +src_prepare() { + #0001-Ticket-47840-add-configure-option-to-disable-instanc.patch + epatch "${FILESDIR}/${P}-no-instance-script.patch" + + #0001-Ticket-48448-dirsrv-start-stop-fail-in-certain-shell.patch + epatch "${FILESDIR}/${P}-shell-corrections.patch" + + # as per 389 documentation, when 64bit, export USE_64 + use amd64 && export USE_64=1 + + # This will be changed in 1.3.5.X + sed -i -e 's/nobody/dirsrv/g' configure.ac || die "sed failed on configure.ac" + eautoreconf + + append-lfs-flags +} + +src_configure() { + local myconf="" + + use auto-dn-suffix && myconf="${myconf} --enable-auto-dn-suffix" + + # for 1.3.5.X, will add --enable-gcc-security + econf \ + $(use_enable debug) \ + $(use_enable pam-passthru) \ + $(use_enable ldapi) \ + $(use_enable autobind) \ + $(use_enable dna) \ + $(use_enable bitwise) \ + $(use_enable presence) \ + $(use_with kerberos) \ + $(use_enable debug) \ + --enable-maintainer-mode \ + --enable-autobind \ + --with-fhs \ + --with-openldap \ + --with-db-inc=/usr/include/${CHOST}/db5.3/ \ + --sbindir=/usr/sbin \ + --bindir=/usr/bin \ + $myconf + + # This relies on bug https://fedorahosted.org/389/ticket/48447 + #--without-initddir \ +} + +src_compile() { + default + if use doc; then + doxygen slapi.doxy || die "cannot run doxygen" + fi +} + +src_install () { + emake DESTDIR="${D}" install + + # for build free-ipa require winsync-plugin + # Freeipa no longer uses winsync. Please see AD trust. + doins ldap/servers/plugins/replication/winsync-plugin.h + doins ldap/servers/plugins/replication/repl-session-plugin.h + + # remove redhat style init script + rm -rf "${D}"/etc/rc.d || die + # Needs a config option to remove this. + rm -rf "${D}"/etc/default || die + + # and install gentoo style init script + # Get these merged upstream + newinitd "${FILESDIR}"/389-ds.initd-r1 389-ds + newinitd "${FILESDIR}"/389-ds-snmp.initd 389-ds-snmp + + # cope with libraries being in /usr/lib/dirsrv + dodir /etc/env.d + echo "LDPATH=/usr/$(get_libdir)/dirsrv" > "${D}"/etc/env.d/08dirsrv + + if use doc; then + cd "${S}" || die + docinto html/ + dodoc -r docs/html/. + fi +} + +pkg_postinst() { + echo + elog "If you are planning to use 389-ds-snmp (ldap-agent)," + elog "make sure to properly configure: /etc/dirsrv/config/ldap-agent.conf" + elog "adding proper 'server' entries, and adding the lines below to" + elog " => /etc/snmp/snmpd.conf" + elog + elog "master agentx" + elog "agentXSocket /var/agentx/master" + elog + elog "To start 389 Directory Server (LDAP service) at boot:" + elog + elog " rc-update add 389-ds default" + elog + elog "If you are upgrading from previous 1.2.6 release candidates" + elog "please see:" + elog "http://directory.fedoraproject.org/wiki/Subtree_Rename#warning:_upgrade_from_389_v1.2.6_.28a.3F.2C_rc1_.7E_rc6.29_to_v1.2.6_rc6_or_newer" + echo +} diff --git a/net-nds/389-ds-base/Manifest b/net-nds/389-ds-base/Manifest index 13c1e88c2e2b..084872503129 100644 --- a/net-nds/389-ds-base/Manifest +++ b/net-nds/389-ds-base/Manifest @@ -1 +1,2 @@ DIST 389-ds-base-1.3.0.2.tar.bz2 3008002 SHA256 0482f8cddbb32dc44051d59efe085eb744295a32eac65fbcd0b1bfd807319755 SHA512 99d41e2df832eaf8d83ec32fd9e7ef1819d75640fae2c69e62f5d11998c29d780726cb5d97cec7a6ae410c440d5124ca8b9d0cb7091a437a57f2625b16fca29f WHIRLPOOL 8ad72341e15d05e6af0999808a1930f11c7589c211424f7dfa68c1d8d5cd18657086dbf9aa6c856dc84a3926b47ed46484b30e6f72819a22e26277a3c504c1e0 +DIST 389-ds-base-1.3.4.7.tar.bz2 3397520 SHA256 08dae55ed0732e8d316bb65910c74ee913fc215c3436299239e362a3670e76e6 SHA512 02159ce8e9d1e5797d6d6952202b430429bf750179279348430333f7a4b557e305a2041a1e4e7ffe652d34825c9678d3fbf8a3eaea401f257bd922034dbce875 WHIRLPOOL 97af90f6b3f01a2a11e236f1141d1851016711f69b618f2e3122715e8575541040aa09c03f66f7a20cca9e2136bb2d3612c8fcec16b616f981dba39c4f449453 diff --git a/net-nds/389-ds-base/files/389-ds-base-1.3.4.7-no-instance-script.patch b/net-nds/389-ds-base/files/389-ds-base-1.3.4.7-no-instance-script.patch new file mode 100644 index 000000000000..8af7ad2be452 --- /dev/null +++ b/net-nds/389-ds-base/files/389-ds-base-1.3.4.7-no-instance-script.patch @@ -0,0 +1,396 @@ +From 7b75e7a4c60637a86acf6c757f207550294279ef Mon Sep 17 00:00:00 2001 +From: William Brown <wibrown@redhat.com> +Date: Wed, 28 Oct 2015 14:25:26 +1000 +Subject: [PATCH] Ticket 47840 - add configure option to disable instance + specific scripts https://fedorahosted.org/389/ticket/47840 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Bug Description: Now that ​https://fedorahosted.org/389/ticket/528 is +fixed, the next step is to allow building the server with the instance specific +scripts disabled. + +Fix Description: Instead of defining a configure option, we provide a new +option in setup-ds.pl, slapd.InstScriptsEnabled, which defaults to false. All +new installs of 389 will NOT install with a inst_dir nor the scripts that are in +that directory. + +Additionally, this change fixes setup-ds.pl to correctly use the sbindir scripts +to start/stop the server instance during installation. + +Finally, we add support for setup-ds.pl so that in --update if the inst_dir +exists, scripts will be updated, but if it does not exist, no action is taken. + +In time, we will alter --update to *remove* the scripts within inst_dir during +the update (We have no way of knowing if a customer has put custom scripts in +inst_dir) + +Example: +/opt/dirsrv/sbin/setup-ds.pl slapd.InstScriptsEnabled=false + +Author: wibrown + +Review by: nhosoi (Thanks!) +--- + ldap/admin/src/scripts/DSCreate.pm.in | 204 +++++++++++++++++++-------------- + ldap/admin/src/scripts/DSUpdate.pm.in | 12 +- + ldap/admin/src/scripts/setup-ds.res.in | 1 + + 3 files changed, 124 insertions(+), 93 deletions(-) + +diff --git a/ldap/admin/src/scripts/DSCreate.pm.in b/ldap/admin/src/scripts/DSCreate.pm.in +index 3ce5a73..6425be4 100644 +--- a/ldap/admin/src/scripts/DSCreate.pm.in ++++ b/ldap/admin/src/scripts/DSCreate.pm.in +@@ -130,6 +130,15 @@ sub sanityCheckParams { + return @errs; + } + ++ # We need to make sure this value is lowercase ++ $inf->{slapd}->{InstScriptsEnabled} = lc $inf->{slapd}->{InstScriptsEnabled}; ++ ++ if ("true" ne $inf->{slapd}->{InstScriptsEnabled} && "false" ne $inf->{slapd}->{InstScriptsEnabled}) { ++ debug(1, "InstScriptsEnabled is not a valid boolean"); ++ return ('error_invalid_boolean', $inf->{slapd}->{InstScriptsEnabled}); ++ } ++ ++ + return (); + } + +@@ -204,13 +213,17 @@ sub makeDSDirs { + my $mode = getMode($inf, 7); + my @errs; + ++ my @dsdirs = qw(config_dir schema_dir log_dir lock_dir run_dir tmp_dir cert_dir db_dir ldif_dir bak_dir); ++ if ($inf->{slapd}->{InstScriptsEnabled} eq "true") { ++ @dsdirs = qw(inst_dir config_dir schema_dir log_dir lock_dir run_dir tmp_dir cert_dir db_dir ldif_dir bak_dir); ++ } ++ + # These paths are owned by the SuiteSpotGroup + # This allows the admin server to run as a different, + # more privileged user than the directory server, but + # still allows the admin server to manage directory + # server files/dirs without being root +- for my $kw (qw(inst_dir config_dir schema_dir log_dir lock_dir run_dir tmp_dir +- cert_dir db_dir ldif_dir bak_dir)) { ++ for my $kw (@dsdirs) { + my $dir = $inf->{slapd}->{$kw}; + @errs = makePaths($dir, $mode, $inf->{General}->{SuiteSpotUserID}, + $inf->{General}->{SuiteSpotGroup}); +@@ -262,56 +275,66 @@ sub createInstanceScripts { + my $myperl = "!$perlexec"; + my $mydevnull = (-f "/dev/null" ? " /dev/null " : " NUL "); + +- # determine initconfig_dir +- my $initconfig_dir = $inf->{slapd}->{initconfig_dir} || get_initconfigdir($inf->{General}->{prefix}); +- +- my %maptable = ( +- "DS-ROOT" => $inf->{General}->{prefix}, +- "SEP" => "/", # works on all platforms +- "SERVER-NAME" => $inf->{General}->{FullMachineName}, +- "SERVER-PORT" => $inf->{slapd}->{ServerPort}, +- "PERL-EXEC" => $myperl, +- "DEV-NULL" => $mydevnull, +- "ROOT-DN" => $inf->{slapd}->{RootDN}, +- "LDIF-DIR" => $inf->{slapd}->{ldif_dir}, +- "SERV-ID" => $inf->{slapd}->{ServerIdentifier}, +- "BAK-DIR" => $inf->{slapd}->{bak_dir}, +- "SERVER-DIR" => $inf->{General}->{ServerRoot}, +- "CONFIG-DIR" => $inf->{slapd}->{config_dir}, +- "INITCONFIG-DIR" => $initconfig_dir, +- "INST-DIR" => $inf->{slapd}->{inst_dir}, +- "RUN-DIR" => $inf->{slapd}->{run_dir}, +- "PRODUCT-NAME" => "slapd", +- "SERVERBIN-DIR" => $inf->{slapd}->{sbindir}, +- "DB-DIR" => $inf->{slapd}->{db_dir} +- ); +- +- my $dir = "$inf->{General}->{prefix}@taskdir@"; +- for my $file (glob("$dir/template-*")) { +- my $basename = $file; +- $basename =~ s/^.*template-//; +- my $destfile = "$inf->{slapd}->{inst_dir}/$basename"; +- +- next if ($skip and -f $destfile); # in skip mode, skip files that already exist +- +- if (!open(SRC, "< $file")) { +- return ("error_opening_scripttmpl", $file, $!); +- } +- if (!open(DEST, "> $destfile")) { +- return ("error_opening_scripttmpl", $destfile, $!); +- } +- my $contents; # slurp entire file into memory +- read SRC, $contents, int(-s $file); +- close(SRC); +- while (my ($key, $val) = each %maptable) { +- $contents =~ s/\{\{$key\}\}/$val/g; +- } +- print DEST $contents; +- close(DEST); +- my @errs = changeOwnerMode($inf, 5, $destfile); +- if (@errs) { +- return @errs; ++ # If we have InstScriptsEnabled, we likely have setup.inf or the argument. ++ # However, during an upgrade, we need to know if we should upgrade the template files or not. ++ # For now, the easiest way is to check to if the directory exists, and if is does, we assume we want to upgrade / create the updated scripts. ++ if ($inf->{slapd}->{InstScriptsEnabled} eq "true" || -d $inf->{slapd}->{inst_dir} ) { ++ debug(1, "Creating or updating instance directory scripts\n"); ++ # determine initconfig_dir ++ my $initconfig_dir = $inf->{slapd}->{initconfig_dir} || get_initconfigdir($inf->{General}->{prefix}); ++ ++ my %maptable = ( ++ "DS-ROOT" => $inf->{General}->{prefix}, ++ "SEP" => "/", # works on all platforms ++ "SERVER-NAME" => $inf->{General}->{FullMachineName}, ++ "SERVER-PORT" => $inf->{slapd}->{ServerPort}, ++ "PERL-EXEC" => $myperl, ++ "DEV-NULL" => $mydevnull, ++ "ROOT-DN" => $inf->{slapd}->{RootDN}, ++ "LDIF-DIR" => $inf->{slapd}->{ldif_dir}, ++ "SERV-ID" => $inf->{slapd}->{ServerIdentifier}, ++ "BAK-DIR" => $inf->{slapd}->{bak_dir}, ++ "SERVER-DIR" => $inf->{General}->{ServerRoot}, ++ "CONFIG-DIR" => $inf->{slapd}->{config_dir}, ++ "INITCONFIG-DIR" => $initconfig_dir, ++ "INST-DIR" => $inf->{slapd}->{inst_dir}, ++ "RUN-DIR" => $inf->{slapd}->{run_dir}, ++ "PRODUCT-NAME" => "slapd", ++ "SERVERBIN-DIR" => $inf->{slapd}->{sbindir}, ++ "DB-DIR" => $inf->{slapd}->{db_dir} ++ ); ++ ++ ++ my $dir = "$inf->{General}->{prefix}@taskdir@"; ++ for my $file (glob("$dir/template-*")) { ++ my $basename = $file; ++ $basename =~ s/^.*template-//; ++ my $destfile = "$inf->{slapd}->{inst_dir}/$basename"; ++ debug(1, "$destfile\n"); ++ ++ next if ($skip and -f $destfile); # in skip mode, skip files that already exist ++ ++ if (!open(SRC, "< $file")) { ++ return ("error_opening_scripttmpl", $file, $!); ++ } ++ if (!open(DEST, "> $destfile")) { ++ return ("error_opening_scripttmpl", $destfile, $!); ++ } ++ my $contents; # slurp entire file into memory ++ read SRC, $contents, int(-s $file); ++ close(SRC); ++ while (my ($key, $val) = each %maptable) { ++ $contents =~ s/\{\{$key\}\}/$val/g; ++ } ++ print DEST $contents; ++ close(DEST); ++ my @errs = changeOwnerMode($inf, 5, $destfile); ++ if (@errs) { ++ return @errs; ++ } + } ++ } else { ++ debug(1, "No instance directory scripts will be updated or created\n"); + } + + return (); +@@ -639,7 +662,7 @@ sub initDatabase { + return (); + } + +- my $cmd = "$inf->{slapd}->{inst_dir}/ldif2db -n $inf->{slapd}->{ds_bename} -i \'$ldiffile\'"; ++ my $cmd = "$inf->{slapd}->{sbindir}/ldif2db -Z $inf->{slapd}->{ServerIdentifier} -n $inf->{slapd}->{ds_bename} -i \'$ldiffile\'"; + $? = 0; # clear error condition + my $output = `$cmd 2>&1`; + my $result = $?; +@@ -662,7 +685,7 @@ sub startServer { + my @errs; + # get error log + my $errLog = "$inf->{slapd}->{log_dir}/errors"; +- my $startcmd = "$inf->{slapd}->{inst_dir}/start-slapd"; ++ my $startcmd = "$inf->{slapd}->{sbindir}/start-dirsrv $inf->{slapd}->{ServerIdentifier}"; + if ("@systemdsystemunitdir@" and (getLogin() eq 'root')) { + $startcmd = "/bin/systemctl start @package_name@\@$inf->{slapd}->{ServerIdentifier}.service"; + } +@@ -875,6 +898,10 @@ sub setDefaults { + "@datadir@", + $inf->{General}->{prefix}); + ++ if (!defined($inf->{slapd}->{InstScriptsEnabled})) { ++ $inf->{slapd}->{InstScriptsEnabled} = "false"; ++ } ++ + if (!defined($inf->{slapd}->{inst_dir})) { + $inf->{slapd}->{inst_dir} = "$inf->{General}->{ServerRoot}/slapd-$servid"; + } +@@ -975,9 +1002,12 @@ sub updateSelinuxPolicy { + system("restorecon -R $localstatedir/lib/@PACKAGE_NAME@"); + } + ++ my @inst_dirs = qw(config_dir schema_dir log_dir lock_dir run_dir tmp_dir cert_dir db_dir ldif_dir bak_dir); ++ if ($inf->{slapd}->{InstScriptsEnabled} eq "true") { ++ @inst_dirs = qw(inst_dir config_dir schema_dir log_dir lock_dir run_dir tmp_dir cert_dir db_dir ldif_dir bak_dir); ++ } + # run restorecon on all instance directories we created +- for my $kw (qw(inst_dir config_dir schema_dir log_dir lock_dir run_dir tmp_dir +- cert_dir db_dir ldif_dir bak_dir)) { ++ for my $kw (@inst_dirs) { + my $dir = $inf->{slapd}->{$kw}; + system("restorecon -R $dir"); + } +@@ -1231,14 +1261,14 @@ sub createDSInstance { + } + + sub stopServer { +- my $instancedir = shift; +- my $prog = $instancedir . "/stop-slapd"; ++ my $instance = shift; ++ my $prog = "@sbindir@/stop-dirsrv"; + if (-x $prog) { + $? = 0; + # run the stop command +- my $output = `$prog 2>&1`; ++ my $output = `$prog $instance 2>&1`; + my $status = $?; +- debug(3, "stopping server $instancedir returns status $status: output $output\n"); ++ debug(3, "stopping server $instance returns status $status: output $output\n"); + if ($status) { + debug(1,"Warning: Could not stop directory server: status $status: output $output\n"); + # if the server is not running, that's ok +@@ -1254,7 +1284,7 @@ sub stopServer { + return; + } + +- debug(1, "Successfully stopped server $instancedir\n"); ++ debug(1, "Successfully stopped server $instance\n"); + return 1; + } + +@@ -1331,23 +1361,16 @@ sub removeDSInstance { + $conn->close(); + + # stop the server +- my $instdir = ""; +- if ($entry) { +- foreach my $path ( @{$entry->{"nsslapd-instancedir"}} ) +- { +- if (!stopServer($path)) { +- if ($force) { +- debug(1, "Warning: Could not stop directory server - Error: $! - forcing continue\n"); +- } elsif ($! == ENOENT) { # stop script not found or server not running +- debug(1, "Warning: Could not stop directory server: already removed or not running\n"); +- push @errs, [ 'error_stopping_server', $path, $! ]; +- } else { # real error +- debug(1, "Error: Could not stop directory server - aborting - use -f flag to force removal\n"); +- push @errs, [ 'error_stopping_server', $path, $! ]; +- return @errs; +- } +- } +- $instdir = $path; ++ if (!stopServer($inst)) { ++ if ($force) { ++ debug(1, "Warning: Could not stop directory server - Error: $! - forcing continue\n"); ++ } elsif ($! == ENOENT) { # stop script not found or server not running ++ debug(1, "Warning: Could not stop directory server: already removed or not running\n"); ++ push @errs, [ 'error_stopping_server', $inst, $! ]; ++ } else { # real error ++ debug(1, "Error: Could not stop directory server - aborting - use -f flag to force removal\n"); ++ push @errs, [ 'error_stopping_server', $inst, $! ]; ++ return @errs; + } + } + +@@ -1363,18 +1386,25 @@ sub removeDSInstance { + push @errs, remove_tree($entry, "nsslapd-errorlog", $instname, 1); + } + +- # instance dir +- if ( -d $instdir && $instdir =~ /$instname/ ) +- { +- # clean up pid files (if any) +- remove_pidfile("STARTPIDFILE", $inst, $instdir, $instname, $rundir, $product_name); +- remove_pidfile("PIDFILE", $inst, $instdir, $instname, $rundir, $product_name); + +- my $rc = rmtree($instdir); +- if ( 0 == $rc ) ++ # instance dir ++ my $instdir = ""; ++ if ($entry) { ++ foreach my $instdir ( @{$entry->{"nsslapd-instancedir"}} ) + { +- push @errs, [ 'error_removing_path', $instdir, $! ]; +- debug(1, "Warning: $instdir was not removed. Error: $!\n"); ++ if ( -d $instdir && $instdir =~ /$instname/ ) ++ { ++ # clean up pid files (if any) ++ remove_pidfile("STARTPIDFILE", $inst, $instdir, $instname, $rundir, $product_name); ++ remove_pidfile("PIDFILE", $inst, $instdir, $instname, $rundir, $product_name); ++ ++ my $rc = rmtree($instdir); ++ if ( 0 == $rc ) ++ { ++ push @errs, [ 'error_removing_path', $instdir, $! ]; ++ debug(1, "Warning: $instdir was not removed. Error: $!\n"); ++ } ++ } + } + } + # Finally, config dir +diff --git a/ldap/admin/src/scripts/DSUpdate.pm.in b/ldap/admin/src/scripts/DSUpdate.pm.in +index be1e67c..e84a9a9 100644 +--- a/ldap/admin/src/scripts/DSUpdate.pm.in ++++ b/ldap/admin/src/scripts/DSUpdate.pm.in +@@ -226,10 +226,10 @@ sub updateDS { + for my $upd (@updates) { + my @localerrs; + if ($upd->{$PRE_STAGE}) { +- debug(1, "Running stage $PRE_STAGE update ", $upd->{path}, "\n"); ++ debug(1, "Running updateDS stage $PRE_STAGE update ", $upd->{path}, "\n"); + @localerrs = &{$upd->{$PRE_STAGE}}($inf, $setup->{configdir}); + } elsif ($upd->{file}) { +- debug(1, "Running stage $PRE_STAGE update ", $upd->{path}, "\n"); ++ debug(1, "Running updateDS stage $PRE_STAGE update ", $upd->{path}, "\n"); + @localerrs = processUpdate($upd, $inf, $setup->{configdir}, $PRE_STAGE); + } + if (@localerrs) { +@@ -276,10 +276,10 @@ sub updateDS { + for my $upd (@updates) { + my @localerrs; + if ($upd->{$POST_STAGE}) { +- debug(1, "Running stage $POST_STAGE update ", $upd->{path}, "\n"); ++ debug(1, "Running updateDS stage $POST_STAGE update ", $upd->{path}, "\n"); + @localerrs = &{$upd->{$POST_STAGE}}($inf, $setup->{configdir}); + } elsif ($upd->{file}) { +- debug(1, "Running stage $POST_STAGE update ", $upd->{path}, "\n"); ++ debug(1, "Running updateDS stage $POST_STAGE update ", $upd->{path}, "\n"); + @localerrs = processUpdate($upd, $inf, $setup->{configdir}, $POST_STAGE); + } + if (@localerrs) { +@@ -385,10 +385,10 @@ sub updateDSInstance { + for my $upd (@{$updates}) { + my @localerrs; + if ($upd->{$stage}) { +- debug(1, "Running stage $stage update ", $upd->{path}, "\n"); ++ debug(1, "Running updateDSInstance stage $stage update ", $upd->{path}, "\n"); + @localerrs = &{$upd->{$stage}}($inf, $inst, $dseldif, $conn); + } elsif ($upd->{file}) { +- debug(1, "Running stage $stage update ", $upd->{path}, "\n"); ++ debug(1, "Running updateDSInstance stage $stage update ", $upd->{path}, "\n"); + @localerrs = processUpdate($upd, $inf, $configdir, $stage, + $inst, $dseldif, $conn); + } +diff --git a/ldap/admin/src/scripts/setup-ds.res.in b/ldap/admin/src/scripts/setup-ds.res.in +index 7134e25..fa37567 100644 +--- a/ldap/admin/src/scripts/setup-ds.res.in ++++ b/ldap/admin/src/scripts/setup-ds.res.in +@@ -116,6 +116,7 @@ error_creating_file = Could not create file '%s'. Error: %s\n + error_copying_file = Could not copy file '%s' to '%s'. Error: %s\n + error_enabling_feature = Could not enable the directory server feature '%s'. Error: %s\n + error_importing_ldif = Could not import LDIF file '%s'. Error: %s. Output: %s\n ++error_invalid_boolean = Could not convert value '%s' to boolean. Valid values are true or false.\n + error_starting_server = Could not start the directory server using command '%s'. The last line from the error log was '%s'. Error: %s\n + error_stopping_server = Could not stop the directory server '%s'. Error: %s\n + error_missing_userid = The SuiteSpotUserID is missing. This must be set to valid user\n +-- +2.4.3 + diff --git a/net-nds/389-ds-base/files/389-ds-base-1.3.4.7-shell-corrections.patch b/net-nds/389-ds-base/files/389-ds-base-1.3.4.7-shell-corrections.patch new file mode 100644 index 000000000000..0842382dad58 --- /dev/null +++ b/net-nds/389-ds-base/files/389-ds-base-1.3.4.7-shell-corrections.patch @@ -0,0 +1,242 @@ +From 340cdd3c9648c4b35ef95cc0498413b763e71859 Mon Sep 17 00:00:00 2001 +From: William Brown <firstyear@redhat.com> +Date: Sun, 31 Jan 2016 14:27:13 +1000 +Subject: [PATCH] Ticket 48448 - dirsrv start-stop fail in certain shell + environments. + +Bug Description: Dirsrv fails to start and stop with certain shell environments +. This is due to the usage of the pattern + + cd $SERVERBIN_DIR + ./ns-slapd ... + +Fix Description: Change all invocations of commands to use explicit paths: + + $SERVERBIN_DIR/ns-slapd + +https://fedorahosted.org/389/ticket/48448 + +Author: wibrown + +Review by: ??? +--- + ldap/admin/src/scripts/start-dirsrv.in | 2 +- + ldap/admin/src/scripts/template-bak2db.in | 3 +-- + ldap/admin/src/scripts/template-db2bak.in | 5 ++--- + ldap/admin/src/scripts/template-db2index.in | 5 ++--- + ldap/admin/src/scripts/template-db2ldif.in | 3 +-- + ldap/admin/src/scripts/template-dbverify.in | 5 ++--- + ldap/admin/src/scripts/template-dn2rdn.in | 5 ++--- + ldap/admin/src/scripts/template-ldif2db.in | 3 +-- + ldap/admin/src/scripts/template-ldif2ldap.in | 5 ++--- + ldap/admin/src/scripts/template-monitor.in | 5 ++--- + ldap/admin/src/scripts/template-restoreconfig.in | 5 ++--- + ldap/admin/src/scripts/template-saveconfig.in | 5 ++--- + ldap/admin/src/scripts/template-suffix2instance.in | 5 ++--- + ldap/admin/src/scripts/template-upgradedb.in | 3 +-- + ldap/admin/src/scripts/template-upgradednformat.in | 5 ++--- + ldap/admin/src/scripts/template-vlvindex.in | 3 +-- + 16 files changed, 26 insertions(+), 41 deletions(-) + +diff --git a/ldap/admin/src/scripts/start-dirsrv.in b/ldap/admin/src/scripts/start-dirsrv.in +index 458f0e8..513addb 100755 +--- a/ldap/admin/src/scripts/start-dirsrv.in ++++ b/ldap/admin/src/scripts/start-dirsrv.in +@@ -70,7 +70,7 @@ start_instance() { + return 1 + fi + else +- cd $SERVERBIN_DIR; ./ns-slapd -D $CONFIG_DIR -i $PIDFILE -w $STARTPIDFILE "$@" ++ $SERVERBIN_DIR/ns-slapd -D $CONFIG_DIR -i $PIDFILE -w $STARTPIDFILE "$@" + if [ $? -ne 0 ]; then + return 1 + fi +diff --git a/ldap/admin/src/scripts/template-bak2db.in b/ldap/admin/src/scripts/template-bak2db.in +index 1725aba..01a12fa 100755 +--- a/ldap/admin/src/scripts/template-bak2db.in ++++ b/ldap/admin/src/scripts/template-bak2db.in +@@ -1,5 +1,4 @@ + #!/bin/sh + +-cd {{SERVERBIN-DIR}} +-./bak2db "$@" -Z {{SERV-ID}} ++{{SERVERBIN-DIR}}/bak2db "$@" -Z {{SERV-ID}} + exit $? +diff --git a/ldap/admin/src/scripts/template-db2bak.in b/ldap/admin/src/scripts/template-db2bak.in +index 50fd5ed..70a4a2b 100755 +--- a/ldap/admin/src/scripts/template-db2bak.in ++++ b/ldap/admin/src/scripts/template-db2bak.in +@@ -1,5 +1,4 @@ + #!/bin/sh + +-cd {{SERVERBIN-DIR}} +-./db2bak "$@" -Z {{SERV-ID}} +-exit $? +\ No newline at end of file ++{{SERVERBIN-DIR}}/db2bak "$@" -Z {{SERV-ID}} ++exit $? +diff --git a/ldap/admin/src/scripts/template-db2index.in b/ldap/admin/src/scripts/template-db2index.in +index a7a633d..9c7c5ec 100755 +--- a/ldap/admin/src/scripts/template-db2index.in ++++ b/ldap/admin/src/scripts/template-db2index.in +@@ -1,5 +1,4 @@ + #!/bin/sh + +-cd {{SERVERBIN-DIR}} +-./db2index "$@" -Z {{SERV-ID}} +-exit $? +\ No newline at end of file ++{{SERVERBIN-DIR}}/db2index "$@" -Z {{SERV-ID}} ++exit $? +diff --git a/ldap/admin/src/scripts/template-db2ldif.in b/ldap/admin/src/scripts/template-db2ldif.in +index b85ffdc..3881911 100755 +--- a/ldap/admin/src/scripts/template-db2ldif.in ++++ b/ldap/admin/src/scripts/template-db2ldif.in +@@ -1,6 +1,5 @@ + #!/bin/sh + + cwd=`pwd` +-cd {{SERVERBIN-DIR}} +-./db2ldif "$@" -Z {{SERV-ID}} -c $cwd ++{{SERVERBIN-DIR}}/db2ldif "$@" -Z {{SERV-ID}} -c $cwd + exit $? +diff --git a/ldap/admin/src/scripts/template-dbverify.in b/ldap/admin/src/scripts/template-dbverify.in +index 71e3e4e..abcc58e 100755 +--- a/ldap/admin/src/scripts/template-dbverify.in ++++ b/ldap/admin/src/scripts/template-dbverify.in +@@ -1,5 +1,4 @@ + #!/bin/sh + +-cd {{SERVERBIN-DIR}} +-./dbverify "$@" -Z {{SERV-ID}} +-exit $? +\ No newline at end of file ++{{SERVERBIN-DIR}}/dbverify "$@" -Z {{SERV-ID}} ++exit $? +diff --git a/ldap/admin/src/scripts/template-dn2rdn.in b/ldap/admin/src/scripts/template-dn2rdn.in +index b3d8e82..9ecae08 100755 +--- a/ldap/admin/src/scripts/template-dn2rdn.in ++++ b/ldap/admin/src/scripts/template-dn2rdn.in +@@ -1,5 +1,4 @@ + #!/bin/sh + +-cd {{SERVERBIN-DIR}} +-./dn2rdn "$@" -Z {{SERV-ID}} +-exit $? +\ No newline at end of file ++{{SERVERBIN-DIR}}/dn2rdn "$@" -Z {{SERV-ID}} ++exit $? +diff --git a/ldap/admin/src/scripts/template-ldif2db.in b/ldap/admin/src/scripts/template-ldif2db.in +index f3fa58e..f38fce3 100755 +--- a/ldap/admin/src/scripts/template-ldif2db.in ++++ b/ldap/admin/src/scripts/template-ldif2db.in +@@ -1,5 +1,4 @@ + #!/bin/sh + +-cd {{SERVERBIN-DIR}} +-./ldif2db "$@" -Z {{SERV-ID}} ++{{SERVERBIN-DIR}}/ldif2db "$@" -Z {{SERV-ID}} + exit $? +diff --git a/ldap/admin/src/scripts/template-ldif2ldap.in b/ldap/admin/src/scripts/template-ldif2ldap.in +index 806ddcc..c785742 100755 +--- a/ldap/admin/src/scripts/template-ldif2ldap.in ++++ b/ldap/admin/src/scripts/template-ldif2ldap.in +@@ -1,5 +1,4 @@ + #!/bin/sh + +-cd {{SERVERBIN-DIR}} +-./ldif2ldap "$@" -Z {{SERV-ID}} +-exit $? +\ No newline at end of file ++{{SERVERBIN-DIR}}/ldif2ldap "$@" -Z {{SERV-ID}} ++exit $? +diff --git a/ldap/admin/src/scripts/template-monitor.in b/ldap/admin/src/scripts/template-monitor.in +index 2f93337..c89bb8a 100755 +--- a/ldap/admin/src/scripts/template-monitor.in ++++ b/ldap/admin/src/scripts/template-monitor.in +@@ -1,5 +1,4 @@ + #!/bin/sh + +-cd {{SERVERBIN-DIR}} +-./monitor "$@" -Z {{SERV-ID}} +-exit $? +\ No newline at end of file ++{{SERVERBIN-DIR}}/monitor "$@" -Z {{SERV-ID}} ++exit $? +diff --git a/ldap/admin/src/scripts/template-restoreconfig.in b/ldap/admin/src/scripts/template-restoreconfig.in +index f4b2d06..5109561 100755 +--- a/ldap/admin/src/scripts/template-restoreconfig.in ++++ b/ldap/admin/src/scripts/template-restoreconfig.in +@@ -1,5 +1,4 @@ + #!/bin/sh + +-cd {{SERVERBIN-DIR}} +-./restoreconfig "$@" -Z {{SERV-ID}} +-exit $? +\ No newline at end of file ++{{SERVERBIN-DIR}}/restoreconfig "$@" -Z {{SERV-ID}} ++exit $? +diff --git a/ldap/admin/src/scripts/template-saveconfig.in b/ldap/admin/src/scripts/template-saveconfig.in +index c77cce1..7784e83 100755 +--- a/ldap/admin/src/scripts/template-saveconfig.in ++++ b/ldap/admin/src/scripts/template-saveconfig.in +@@ -1,5 +1,4 @@ + #!/bin/sh + +-cd {{SERVERBIN-DIR}} +-./saveconfig "$@" -Z {{SERV-ID}} +-exit $? +\ No newline at end of file ++{{SERVERBIN-DIR}}/saveconfig "$@" -Z {{SERV-ID}} ++exit $? +diff --git a/ldap/admin/src/scripts/template-suffix2instance.in b/ldap/admin/src/scripts/template-suffix2instance.in +index 03bcba8..e29408d 100755 +--- a/ldap/admin/src/scripts/template-suffix2instance.in ++++ b/ldap/admin/src/scripts/template-suffix2instance.in +@@ -1,5 +1,4 @@ + #!/bin/sh + +-cd {{SERVERBIN-DIR}} +-./suffix2instance "$@" -Z {{SERV-ID}} +-exit $? +\ No newline at end of file ++{{SERVERBIN-DIR}}/suffix2instance "$@" -Z {{SERV-ID}} ++exit $? +diff --git a/ldap/admin/src/scripts/template-upgradedb.in b/ldap/admin/src/scripts/template-upgradedb.in +index ce879bb..ae28ac2 100755 +--- a/ldap/admin/src/scripts/template-upgradedb.in ++++ b/ldap/admin/src/scripts/template-upgradedb.in +@@ -1,5 +1,4 @@ + #!/bin/sh + +-cd {{SERVERBIN-DIR}} +-./upgradedb "$@" -Z {{SERV-ID}} ++{{SERVERBIN-DIR}}/upgradedb "$@" -Z {{SERV-ID}} + exit $? +diff --git a/ldap/admin/src/scripts/template-upgradednformat.in b/ldap/admin/src/scripts/template-upgradednformat.in +index 5fd8ef9..74c18e8 100755 +--- a/ldap/admin/src/scripts/template-upgradednformat.in ++++ b/ldap/admin/src/scripts/template-upgradednformat.in +@@ -1,5 +1,4 @@ + #!/bin/sh + +-cd {{SERVERBIN-DIR}} +-./upgradednformat "$@" -Z {{SERV-ID}} +-exit $? +\ No newline at end of file ++{{SERVERBIN-DIR}}/upgradednformat "$@" -Z {{SERV-ID}} ++exit $? +diff --git a/ldap/admin/src/scripts/template-vlvindex.in b/ldap/admin/src/scripts/template-vlvindex.in +index 0249696..a7ffb40 100755 +--- a/ldap/admin/src/scripts/template-vlvindex.in ++++ b/ldap/admin/src/scripts/template-vlvindex.in +@@ -1,5 +1,4 @@ + #!/bin/sh + +-cd {{SERVERBIN-DIR}} +-./vlvindex "$@" -Z {{SERV-ID}} ++{{SERVERBIN-DIR}}/vlvindex "$@" -Z {{SERV-ID}} + exit $? +-- +2.5.0 + diff --git a/net-nds/389-ds-base/files/389-ds.initd-r1 b/net-nds/389-ds-base/files/389-ds.initd-r1 new file mode 100644 index 000000000000..a0b83d8567f2 --- /dev/null +++ b/net-nds/389-ds-base/files/389-ds.initd-r1 @@ -0,0 +1,88 @@ +#!/sbin/runscript +# Copyright 1999-2010 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +DIRSRV_EXEC="/usr/sbin/ns-slapd" +PID_DIRECTORY="/var/run/dirsrv" +DIRSRV_CONF_DIR="/etc/dirsrv" +DS_INSTANCES=${DIRSRV_CONF_DIR}/slapd-* +F389DS_INSTANCES="" + +depend() { + need net logger + use dns + provide dirsvr ldap +} + +checkconfig() { + if [ -z "${DS_INSTANCES}" ]; then + eerror "389 Directory Server has not been configured." + eend 1 + return 1 + fi +} + +start() { + checkconfig || return 1 + + for instance in ${DS_INSTANCES}; do + instance=$(basename ${instance}) + # skip .removed instances, bug #338133 + if [ "${instance%%.removed}" != "${instance}" ]; then + continue + fi + # Create the required directories in case they got nuked + mkdir -p /var/lock/dirsrv/${instance} + # This will probably break one day, we should be pulling out the suitespotuser from dse.ldif + chown dirsrv: /var/lock/dirsrv/${instance} + ebegin "Starting 389 Directory Server: instance ${instance}" + start-stop-daemon --start --quiet -m \ + --pidfile ${PID_DIRECTORY}/${instance}.startpid \ + --exec ${DIRSRV_EXEC} -- -D ${DIRSRV_CONF_DIR}/${instance} \ + -i ${PID_DIRECTORY}/${instance}.pid \ + -w ${PID_DIRECTORY}/${instance}.startpid + sts=${?} + eend ${sts} + if [ "${sts}" != "0" ]; then + return 1 + fi + done +} + + + +stop() { + checkconfig || return 1 + + for instance in ${DS_INSTANCES}; do + instance=$(basename ${instance}) + if [ "${instance%%.removed}" != "${instance}" ]; then + continue + fi + ebegin "Stopping 389 Directory Server: instance ${instance}" + start-stop-daemon --stop --quiet \ + --pidfile ${PID_DIRECTORY}/${instance}.pid \ + --exec ${DIRSRV_EXEC} + eend ${?} + done +} + +status() { + for instance in ${DS_INSTANCES}; do + instance=$(basename ${instance}) + if [ "${instance%%.removed}" != "${instance}" ]; then + continue + fi + if [ -e ${PID_DIRECTORY}/${instance}.pid ]; then + pid=$(cat ${PID_DIRECTORY}/${instance}.pid) + if [ $(echo "$pid" | grep -c $pid) -ge 1 ]; then + einfo "389 Directory Server: instance ${instance} (pid $pid) running." + else + ewarn "389 Directory Server: instance ${instance} (pid $pid) NOT running." + fi + else + eerror "389 Directory Server: instance ${instance} is NOT running." + fi + done +} |