FreeBSD Port: openldap-server-2.4.10
Mikhail Goriachev
mikhailg at webanoide.org
Sat Jul 5 02:34:57 UTC 2008
Quoting Peter Pentchev <roam at ringlet.net>:
> On Fri, Jul 04, 2008 at 01:22:15PM -0400, Mikhail Goriachev wrote:
>> Hi,
> [snip]
>> I slapped together a workaround. Here's a "patch", maybe the idea of
>> it will be of some use.
>
> Just a minor comment on the patch:
>
>> +DBDIR=`grep directory /usr/local/etc/openldap/slapd.conf | awk '{
>> print $2 }'`
>
> This is better written as
>
> awk '/directory/ {print $2}' /usr/local/etc/openldap/slapd.conf
Nice one!
>
> or possibly (I'm not quite familiar with the slapd.conf syntax) even:
>
> awk '$1 == "directory" {print $2}' /usr/local/etc/openldap/slapd.conf
They both work but I like the first one more.
> Then there's another thing - it might be better to make this depend on
> the actual prefix where the OpenLDAP server is installed (it is not
> necessarily /usr/local), but that's a whole different can of beer that
> I'm not familiar with, since I don't even have an OpenLDAP server
> installed on my system :)
Thanks for that. Here's a "proper" working patch.
--- slapd.sh.in.original 2008-07-05 01:38:52.000000000 +0000
+++ slapd.sh.in 2008-07-05 01:44:33.000000000 +0000
@@ -39,6 +39,8 @@
# extract user and group, adjust ownership of directories and database
+DBDIR=`awk '/directory/ {print $2}' %%PREFIX%%/etc/openldap/slapd.conf`
+
start_precmd()
{
local slapd_ownername slapd_groupname
@@ -48,8 +50,8 @@
;;
*)
chown "$slapd_owner" "%%LDAP_RUN_DIR%%"
- chown -RL "$slapd_owner" "%%DATABASEDIR%%"
- chmod 700 "%%DATABASEDIR%%"
+ chown -RL "$slapd_owner" "${DBDIR}"
+ chmod 700 "${DBDIR}"
chown "$slapd_owner" "%%PREFIX%%/etc/openldap/slapd.conf"
slapd_ownername="${slapd_owner%:*}"
Regards,
Mikhail.
--
Mikhail Goriachev
Webanoide
More information about the freebsd-ports
mailing list