Fri, 03 Aug 2012 15:56:30 +0200
Use upstream man pages to avoid local help2man failures, likely due to
shell capability assumptions or cross platform environment variance.
The upstream man pages are probably better formatted anyway.
michael@174 | 1 | #!@l_prefix@/bin/openpkg rc |
michael@174 | 2 | ## |
michael@174 | 3 | ## rc.openldap -- Run-Commands |
michael@174 | 4 | ## |
michael@174 | 5 | |
michael@174 | 6 | %config |
michael@174 | 7 | openldap_enable="$openpkg_rc_def" |
michael@174 | 8 | openldap_flags="" |
michael@174 | 9 | openldap_url="ldap://127.0.0.1:389/" |
michael@174 | 10 | openldap_log_prolog="true" |
michael@174 | 11 | openldap_log_epilog="true" |
michael@174 | 12 | openldap_log_numfiles="10" |
michael@174 | 13 | openldap_log_minsize="1M" |
michael@174 | 14 | openldap_log_complevel="9" |
michael@174 | 15 | |
michael@174 | 16 | %common |
michael@174 | 17 | openldap_slapd_cfgfile="@l_prefix@/etc/openldap/slapd.conf" |
michael@174 | 18 | openldap_slapd_pidfile="@l_prefix@/var/openldap/run/slapd.pid" |
michael@174 | 19 | openldap_slapd_signal () { |
michael@174 | 20 | [ -f $openldap_slapd_pidfile ] && kill -$1 `cat $openldap_slapd_pidfile` |
michael@174 | 21 | } |
michael@174 | 22 | |
michael@174 | 23 | %status -u @l_susr@ -o |
michael@174 | 24 | openldap_usable="unknown" |
michael@174 | 25 | openldap_active="no" |
michael@174 | 26 | rcService openldap enable yes && \ |
michael@174 | 27 | openldap_slapd_signal 0 && openldap_active="yes" |
michael@174 | 28 | echo "openldap_enable=\"$openldap_enable\"" |
michael@174 | 29 | echo "openldap_usable=\"$openldap_usable\"" |
michael@174 | 30 | echo "openldap_active=\"$openldap_active\"" |
michael@174 | 31 | |
michael@174 | 32 | %start -p 300 -u @l_susr@ |
michael@174 | 33 | rcService openldap enable yes || exit 0 |
michael@174 | 34 | openldap_slapd_signal 0 |
michael@174 | 35 | if [ $? -ne 0 ]; then |
michael@174 | 36 | flags="$openldap_flags" |
michael@174 | 37 | echo $flags | grep -- -h >/dev/null |
michael@174 | 38 | if [ $? -ne 0 -a ".$openldap_url" != . ]; then |
michael@174 | 39 | flags="$flags -h \"$openldap_url\"" |
michael@174 | 40 | fi |
michael@174 | 41 | eval @l_prefix@/libexec/openldap/slapd $flags || exit $? |
michael@174 | 42 | fi |
michael@174 | 43 | |
michael@174 | 44 | %stop -p 700 -u @l_susr@ |
michael@174 | 45 | rcService openldap enable yes || exit 0 |
michael@174 | 46 | rcService openldap active no && exit 0 |
michael@174 | 47 | openldap_slapd_signal INT |
michael@174 | 48 | sleep 2 |
michael@174 | 49 | |
michael@174 | 50 | %restart -u @l_susr@ |
michael@174 | 51 | rcService openldap enable yes || exit 0 |
michael@174 | 52 | rcService openldap active no && exit 0 |
michael@174 | 53 | rc openldap stop start |
michael@174 | 54 | |
michael@174 | 55 | %daily -u @l_susr@ |
michael@174 | 56 | rcService openldap enable yes || exit 0 |
michael@174 | 57 | shtool rotate -f \ |
michael@174 | 58 | -n ${openldap_log_numfiles} -s ${openldap_log_minsize} -d \ |
michael@174 | 59 | -z ${openldap_log_complevel} -m 644 -o @l_susr@ -g @l_mgrp@ \ |
michael@174 | 60 | -P "${openldap_log_prolog}" \ |
michael@174 | 61 | -E "${openldap_log_epilog}; rc openldap restart" \ |
michael@174 | 62 | @l_prefix@/var/openldap/openldap.log |
michael@174 | 63 |