/[smeserver]/rpms/e-smith-ldap/sme8/e-smith-ldap-5.2.0-ldap-init-script.patch
ViewVC logotype

Annotation of /rpms/e-smith-ldap/sme8/e-smith-ldap-5.2.0-ldap-init-script.patch

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (hide annotations) (download)
Sat Oct 30 00:34:57 2010 UTC (14 years, 1 month ago) by slords
Branch: MAIN
CVS Tags: e-smith-ldap-5_2_0-55_el5_sme
* Fri Oct 29 2010 Shad L. Lords <slords@mail.com> 5.2.0-55.sme
- Add ldap.init script to allow update on reconfig/reboot [SME: 6231]

1 slords 1.1 diff -up e-smith-ldap-5.2.0/createlinks.ldap-init-script e-smith-ldap-5.2.0/createlinks
2     --- e-smith-ldap-5.2.0/createlinks.ldap-init-script 2010-10-29 18:09:21.000000000 -0600
3     +++ e-smith-ldap-5.2.0/createlinks 2010-10-29 18:09:35.000000000 -0600
4     @@ -29,6 +29,8 @@ event_link("ldap-update", "ibay-create",
5     event_link("ldap-update", "ibay-modify", "25");
6     event_link("ldap-delete", "ibay-delete", "25");
7    
8     +event_link("ldap-update", "bootstrap-ldap-save", "25");
9     +
10     event_link("ldap-update", "machine-account-create", "25");
11    
12     event_link("ldap-dump", "pre-backup", "30");
13     @@ -42,4 +44,9 @@ safe_symlink("sigusr1", "root/etc/e-smit
14    
15     event_link("ldap-delete-dumps", "pre-restore", "25");
16    
17     +event_link("set-ldap-bootstrap", "bootstrap-console-save", "95");
18     +event_link("reset-ldap-bootstrap", "bootstrap-ldap-save", "95");
19     +
20     +service_link_enhanced("ldap.init", "S78", "7");
21     +
22     exit 0;
23     diff -up e-smith-ldap-5.2.0/root/etc/e-smith/events/actions/ldap-update.ldap-init-script e-smith-ldap-5.2.0/root/etc/e-smith/events/actions/ldap-update
24     --- e-smith-ldap-5.2.0/root/etc/e-smith/events/actions/ldap-update.ldap-init-script 2010-10-29 18:12:32.000000000 -0600
25     +++ e-smith-ldap-5.2.0/root/etc/e-smith/events/actions/ldap-update 2010-10-29 18:12:35.000000000 -0600
26     @@ -64,7 +64,7 @@ my $map = { 'FirstName' => 'givenName',
27     my @accounts;
28     my $account;
29     my $event = shift || die "Event name must be specified";
30     -if ($event eq 'ldap-update')
31     +if ($event eq 'ldap-update' or $event eq 'bootstrap-ldap-save')
32     {
33     @accounts = ($a->users, $a->groups, $a->ibays, $a->get_all_by_prop(type => 'machine'));
34     push(@accounts, $a->get('admin'));
35     diff -up e-smith-ldap-5.2.0/root/etc/e-smith/events/actions/reset-ldap-bootstrap.ldap-init-script e-smith-ldap-5.2.0/root/etc/e-smith/events/actions/reset-ldap-bootstrap
36     --- e-smith-ldap-5.2.0/root/etc/e-smith/events/actions/reset-ldap-bootstrap.ldap-init-script 2010-10-29 18:14:45.000000000 -0600
37     +++ e-smith-ldap-5.2.0/root/etc/e-smith/events/actions/reset-ldap-bootstrap 2010-10-29 18:15:16.000000000 -0600
38     @@ -0,0 +1,24 @@
39     +#!/bin/sh
40     +#----------------------------------------------------------------------
41     +# copyright (C) 2010 Firewall-Services
42     +# daniel@firewall-services.com
43     +#
44     +# This program is free software; you can redistribute it and/or modify
45     +# it under the terms of the GNU General Public License as published by
46     +# the Free Software Foundation; either version 2 of the License, or
47     +# (at your option) any later version.
48     +#
49     +# This program is distributed in the hope that it will be useful,
50     +# but WITHOUT ANY WARRANTY; without even the implied warranty of
51     +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
52     +# GNU General Public License for more details.
53     +#
54     +# You should have received a copy of the GNU General Public License
55     +# along with this program; if not, write to the Free Software
56     +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
57     +#
58     +# Technical support for this program is available from Mitel Networks
59     +# Please visit our web site www.mitel.com/sme/ for details.
60     +#----------------------------------------------------------------------
61     +
62     +/sbin/e-smith/conig delprop ldap Bootstrap
63     diff -up e-smith-ldap-5.2.0/root/etc/e-smith/events/actions/set-ldap-bootstrap.ldap-init-script e-smith-ldap-5.2.0/root/etc/e-smith/events/actions/set-ldap-bootstrap
64     --- e-smith-ldap-5.2.0/root/etc/e-smith/events/actions/set-ldap-bootstrap.ldap-init-script 2010-10-29 18:13:51.000000000 -0600
65     +++ e-smith-ldap-5.2.0/root/etc/e-smith/events/actions/set-ldap-bootstrap 2010-10-29 18:15:38.000000000 -0600
66     @@ -0,0 +1,24 @@
67     +#!/bin/sh
68     +#----------------------------------------------------------------------
69     +# copyright (C) 2010 Firewall-Services
70     +# daniel@firewall-services.com
71     +#
72     +# This program is free software; you can redistribute it and/or modify
73     +# it under the terms of the GNU General Public License as published by
74     +# the Free Software Foundation; either version 2 of the License, or
75     +# (at your option) any later version.
76     +#
77     +# This program is distributed in the hope that it will be useful,
78     +# but WITHOUT ANY WARRANTY; without even the implied warranty of
79     +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
80     +# GNU General Public License for more details.
81     +#
82     +# You should have received a copy of the GNU General Public License
83     +# along with this program; if not, write to the Free Software
84     +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
85     +#
86     +# Technical support for this program is available from Mitel Networks
87     +# Please visit our web site www.mitel.com/sme/ for details.
88     +#----------------------------------------------------------------------
89     +
90     +/sbin/e-smith/config setprop ldap Bootstrap run
91     diff -up e-smith-ldap-5.2.0/root/etc/rc.d/init.d/ldap.init.ldap-init-script e-smith-ldap-5.2.0/root/etc/rc.d/init.d/ldap.init
92     --- e-smith-ldap-5.2.0/root/etc/rc.d/init.d/ldap.init.ldap-init-script 2010-10-29 18:13:13.000000000 -0600
93     +++ e-smith-ldap-5.2.0/root/etc/rc.d/init.d/ldap.init 2010-10-29 18:04:47.000000000 -0600
94     @@ -0,0 +1,85 @@
95     +#----------------------------------------------------------------------
96     +# copyright (C) 2010 Firewall-Services
97     +# daniel@firewall-services.com
98     +#
99     +# This program is free software; you can redistribute it and/or modify
100     +# it under the terms of the GNU General Public License as published by
101     +# the Free Software Foundation; either version 2 of the License, or
102     +# (at your option) any later version.
103     +#
104     +# This program is distributed in the hope that it will be useful,
105     +# but WITHOUT ANY WARRANTY; without even the implied warranty of
106     +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
107     +# GNU General Public License for more details.
108     +#
109     +# You should have received a copy of the GNU General Public License
110     +# along with this program; if not, write to the Free Software
111     +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
112     +#
113     +# Technical support for this program is available from Mitel Networks
114     +# Please visit our web site www.mitel.com/sme/ for details.
115     +#----------------------------------------------------------------------
116     +
117     +# Source function library.
118     +. /etc/rc.d/init.d/functions
119     +
120     +if [ $# -lt 1 ]; then
121     + echo "Usage: $0 <start|restart>" 1>&2
122     + exit 1
123     +fi
124     +# We should only do something if $1 is 'start'.
125     +if [ $1 != "start" ] && [ $1 != "restart" ]; then
126     + exit 0
127     +fi
128     +
129     +for i in $(seq 1 10)
130     +do
131     + if [ $(/usr/bin/pgrep -f slapd | wc -l) -ge 1 ]
132     + then
133     + exit_value=0
134     + for link in $((echo /etc/e-smith/ldap/init/50bootstrap; find /etc/e-smith/ldap/init -type f -o -type l) | sort)
135     + do
136     + F=$(basename $link | sed 's/S\?[0-9][0-9]_\?//')
137     + case $F in
138     + bootstrap)
139     + BOOTSTRAP=$(/sbin/e-smith/db configuration getprop ldap Bootstrap)
140     + if [ "$BOOTSTRAP" == "run" ]; then
141     + action "Running bootstrap-ldap-save" /sbin/e-smith/signal-event bootstrap-ldap-save
142     + fi
143     + ;;
144     + *.ldif)
145     + action "Loading $F into ldap" perl -e '
146     + use esmith::util;
147     + use esmith::ConfigDB;
148     +
149     + my $c = esmith::ConfigDB->open_ro;
150     + my $domain = $c->get("DomainName")
151     + || die("Could not determine domain name");
152     + my $base = esmith::util::ldapBase ($domain->value);
153     + my $pw = esmith::util::LdapPassword();
154     +
155     + open (STDERR, "|/usr/bin/logger -p local1.info -t ldap.init");
156     + open (STDOUT, ">&STDERR");
157     + exec "/usr/bin/ldapadd", "-c", "-x", "-H", "ldap://localhost/",
158     + "-D", "cn=root,$base", "-w", "$pw";' < $link && /bin/rm $link
159     + ;;
160     + *)
161     + action "Loading $F into ldap" perl -e '
162     + open (STDERR, "|/usr/bin/logger -p local1.info -t ldap.init");
163     + open (STDOUT, ">&STDERR");
164     + exec shift; ' $link && /bin/rm $link
165     + ;;
166     + esac
167     + # Record any failure for the final return value.
168     + if [ $? -ne 0 ]; then
169     + exit_value=1
170     + fi
171     + done
172     +
173     + exit $exit_value
174     + fi
175     + echo "Waiting for slapd to startup" >&2
176     + sleep 2
177     +done
178     +
179     +exit 1

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed