/[smecontribs]/rpms/smeserver-user-webspace/contribs8/smeserver-user-webspace-0.1-actions.patch
ViewVC logotype

Contents of /rpms/smeserver-user-webspace/contribs8/smeserver-user-webspace-0.1-actions.patch

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


Revision 1.2 - (show annotations) (download)
Sat Nov 23 23:20:29 2013 UTC (11 years ago) by unnilennium
Branch: MAIN
Changes since 1.1: +5 -5 lines
* Sat Nov 23 2013 Jean-Philippe Pialasse <tests@pialasse.com> 0.1-7.sme
- moved spec dirty work on action to real actions
- added skel folders
- added two events and link to actions in the proper events
- precleaning spec

* Sun Oct 27 2013 Jean-Philippe Pialasse <tests@pialasse.com> 0.1-6.sme
- initial import for sme8

1 diff -Nur smeserver-user-webspace-0.1-old/createlinks smeserver-user-webspace-0.1/createlinks
2 --- smeserver-user-webspace-0.1-old/createlinks 2000-08-02 17:05:42.000000000 -0400
3 +++ smeserver-user-webspace-0.1/createlinks 2013-11-23 17:45:11.000000000 -0500
4 @@ -1,51 +1,53 @@
5 #!/usr/bin/perl -w
6 -# This script creates the symlinks needed by this RPM
7 -# Specific support exists to create symlinks within e-smith web "panels"
8 -# and for links from named "events" directories into the "actions" directory
9
10 -sub panel_link
11 +use esmith::Build::CreateLinks qw(:all);
12 +
13 +####################
14 +# links to add
15 +
16 +# templates to expand
17 +
18 +
19 +# services to launch on event
20 +
21 +
22 +#actions
23 +for my $event (qw(user-create ))
24 {
25 - my ($function, $panel) = @_;
26 + event_link("user-create-unix-webspace", $event, "15");
27 +}
28 +
29
30 - unlink "root/etc/e-smith/web/panels/$panel/cgi-bin/$function";
31 - symlink("../../../functions/$function",
32 - "root/etc/e-smith/web/panels/$panel/cgi-bin/$function")
33 - or die "Can't symlink to root/etc/e-smith/web/panels/$panel".
34 - "/cgi-bin/$function: $!";
35 +for my $event (qw(user-create post-upgrade ))
36 +{
37 + event_link("user-create-profiledir-webspace", $event, "25");
38 }
39
40 -sub event_link
41 +# event to revert changes before uninstall
42 +for my $event (qw(user-webspace-revert ))
43 {
44 - my ($action, $event, $level) = @_;
45 + event_link("user-force-revert-rights", $event, "25");
46 + templates2events("/etc/httpd/conf/httpd.conf", $event);
47 + safe_symlink("sigusr1", "root/etc/e-smith/events/$event/services2adjust/httpd-e-smith");
48 +}
49
50 - unlink "root/etc/e-smith/events/${event}/S${level}${action}";
51 - symlink("../actions/${action}",
52 - "root/etc/e-smith/events/${event}/S${level}${action}")
53 - or die "Can't symlink to " .
54 - "root/etc/e-smith/events/${event}/S${level}${action}: $!";
55 +#event to force existing users
56 +for my $event (qw(user-webspace-force-existings ))
57 +{
58 + event_link("user-force-create-every-webspace", $event, "25");
59 + templates2events("/etc/httpd/conf/httpd.conf", $event);
60 + safe_symlink("sigusr1", "root/etc/e-smith/events/$event/services2adjust/httpd-e-smith");
61 }
62
63 -#--------------------------------------------------
64 -# functions for manager panel
65 -#--------------------------------------------------
66 -my $panel = "manager";
67 -
68 -#panel_link("function1", $panel);
69 -#panel_link("function2", $panel);
70 -
71 -#--------------------------------------------------
72 -# actions for console-save event:
73 -#--------------------------------------------------
74 -$event = "console-save";
75 -
76 -#event_link("action1", $event, "55");
77 -#event_link("action2", $event, "60");
78 -
79 -#--------------------------------------------------
80 -# actions for domain-create event:
81 -#--------------------------------------------------
82 -$event = "domain-create";
83 +# do we want to force webspaces to be created to all at reconfiguration ?
84 +for my $event (qw( post-upgrade ))
85 +{
86 + event_link("user-force-create-every-webspace", $event, "25");
87 +
88 +}
89
90 -#event_link("action1", $event, "55");
91 -#event_link("action2", $event, "90");
92 +#create default directories in skel
93 + #my $root=$ARGV[0];
94
95 + system( "mkdir -p root/etc/e-smith/skel/user/tmp");
96 + system( "mkdir -p root/etc/e-smith/skel/user/home/public_html");
97 diff -Nur smeserver-user-webspace-0.1-old/root/etc/e-smith/events/actions/user-create-profiledir-webspace smeserver-user-webspace-0.1/root/etc/e-smith/events/actions/user-create-profiledir-webspace
98 --- smeserver-user-webspace-0.1-old/root/etc/e-smith/events/actions/user-create-profiledir-webspace 1969-12-31 19:00:00.000000000 -0500
99 +++ smeserver-user-webspace-0.1/root/etc/e-smith/events/actions/user-create-profiledir-webspace 2013-11-23 17:15:03.000000000 -0500
100 @@ -0,0 +1,63 @@
101 +#!/usr/bin/perl -w
102 +#----------------------------------------------------------------------
103 +# copyright (C) 2001-2005 Mitel Networks Corporation
104 +#
105 +# This program is free software; you can redistribute it and/or modify
106 +# it under the terms of the GNU General Public License as published by
107 +# the Free Software Foundation; either version 2 of the License, or
108 +# (at your option) any later version.
109 +#
110 +# This program is distributed in the hope that it will be useful,
111 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
112 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
113 +# GNU General Public License for more details.
114 +#
115 +# You should have received a copy of the GNU General Public License
116 +# along with this program; if not, write to the Free Software
117 +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
118 +#
119 +#----------------------------------------------------------------------
120 +package esmith;
121 +
122 +use strict;
123 +use Errno;
124 +use esmith::util;
125 +
126 +use esmith::AccountsDB;
127 +my $adb = esmith::AccountsDB->open_ro();
128 +
129 +my $event = $ARGV [0];
130 +
131 +my @users = ('admin', map { $_->key } $adb->users);
132 +
133 +my @newusers = ($event eq "post-upgrade") ? @users : $ARGV[1] ;
134 +
135 +foreach my $user ( @newusers )
136 +{
137 + die "$user is not a user account\n"
138 + unless ( grep /^$user$/, @users );
139 +
140 + my @dirs = ("/home/e-smith/files/samba/profiles/$user");
141 +
142 + foreach my $dir (@dirs)
143 + {
144 + my $pre_existing = ( -d $dir );
145 +
146 + $pre_existing || mkdir $dir, 710 || die "Couldn't create directory $dir\n";
147 +
148 + chmod 0710, $dir; # Remove setgid bit
149 +
150 + next if $pre_existing;
151 + chmod 0710, "/home/e-smith/files/users/$user";
152 + chmod 2770, "/home/e-smith/files/users/$user/home/public_html";
153 + chmod 2770, "/home/e-smith/files/users/$user/tmp";
154 + system("/bin/chown", "$user:www", "-R" , "/home/e-smith/files/users/$user/home/public_html");
155 + system("/bin/chown", "$user:www", "/home/e-smith/files/users/$user");
156 + system("/bin/chown", "$user:www", "-R" , "/home/e-smith/files/users/$user/tmp");
157 +
158 + esmith::util::chownFile($user, $user, $dir) ||
159 + die "Couldn't change ownership of $dir\n";
160 + }
161 +}
162 +
163 +exit (0);
164 diff -Nur smeserver-user-webspace-0.1-old/root/etc/e-smith/events/actions/user-create-unix-webspace smeserver-user-webspace-0.1/root/etc/e-smith/events/actions/user-create-unix-webspace
165 --- smeserver-user-webspace-0.1-old/root/etc/e-smith/events/actions/user-create-unix-webspace 1969-12-31 19:00:00.000000000 -0500
166 +++ smeserver-user-webspace-0.1/root/etc/e-smith/events/actions/user-create-unix-webspace 2013-11-23 17:16:03.000000000 -0500
167 @@ -0,0 +1,58 @@
168 +#!/usr/bin/perl -w
169 +
170 +#----------------------------------------------------------------------
171 +# copyright (C) 1999-2005 Mitel Networks Corporation
172 +#
173 +# This program is free software; you can redistribute it and/or modify
174 +# it under the terms of the GNU General Public License as published by
175 +# the Free Software Foundation; either version 2 of the License, or
176 +# (at your option) any later version.
177 +#
178 +# This program is distributed in the hope that it will be useful,
179 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
180 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
181 +# GNU General Public License for more details.
182 +#
183 +# You should have received a copy of the GNU General Public License
184 +# along with this program; if not, write to the Free Software
185 +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
186 +#
187 +# Technical support for this program is available from Mitel Networks
188 +# Please visit our web site www.mitel.com/sme/ for details.
189 +#----------------------------------------------------------------------
190 +
191 +package esmith;
192 +
193 +use strict;
194 +use Errno;
195 +use esmith::ConfigDB;
196 +use esmith::AccountsDB;
197 +use File::Temp;
198 +
199 +my $conf = esmith::ConfigDB->open_ro;
200 +my $accounts = esmith::AccountsDB->open;
201 +
202 +my $ldapauth = $conf->get('ldap')->prop('Authentication') || 'disabled';
203 +my $x = 0; # exit value
204 +
205 +my $domain = $conf->get('DomainName')
206 + || die("Couldn't determine domain name");
207 +$domain = $domain->value;
208 +
209 +my $event = $ARGV [0];
210 +my $userName = $ARGV [1];
211 +
212 +#------------------------------------------------------------
213 +# Create the Unix account
214 +#------------------------------------------------------------
215 +
216 +die "username argument missing" unless defined ($userName);
217 +
218 +
219 +chmod 0710, "/home/e-smith/files/users/$userName";
220 +chmod 2770, "/home/e-smith/files/users/$userName/home/public_html";
221 +chmod 2770, "/home/e-smith/files/users/$userName/tmp";
222 +system("/bin/chown", "$userName:www", "-R", "/home/e-smith/files/users/$userName/home/public_html");
223 +system("/bin/chown", "$userName:www", "/home/e-smith/files/users/$userName");
224 +system("/bin/chown", "$userName:www", "-R", "/home/e-smith/files/users/$userName/tmp");
225 +
226 diff -Nur smeserver-user-webspace-0.1-old/root/etc/e-smith/events/actions/user-force-create-every-webspace smeserver-user-webspace-0.1/root/etc/e-smith/events/actions/user-force-create-every-webspace
227 --- smeserver-user-webspace-0.1-old/root/etc/e-smith/events/actions/user-force-create-every-webspace 1969-12-31 19:00:00.000000000 -0500
228 +++ smeserver-user-webspace-0.1/root/etc/e-smith/events/actions/user-force-create-every-webspace 2013-11-23 17:42:19.000000000 -0500
229 @@ -0,0 +1,66 @@
230 +#!/usr/bin/perl -w
231 +#----------------------------------------------------------------------
232 +# copyright (C) 2001-2005 Mitel Networks Corporation
233 +#
234 +# This program is free software; you can redistribute it and/or modify
235 +# it under the terms of the GNU General Public License as published by
236 +# the Free Software Foundation; either version 2 of the License, or
237 +# (at your option) any later version.
238 +#
239 +# This program is distributed in the hope that it will be useful,
240 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
241 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
242 +# GNU General Public License for more details.
243 +#
244 +# You should have received a copy of the GNU General Public License
245 +# along with this program; if not, write to the Free Software
246 +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
247 +#
248 +#----------------------------------------------------------------------
249 +package esmith;
250 +
251 +use strict;
252 +use Errno;
253 +use esmith::util;
254 +
255 +use esmith::AccountsDB;
256 +my $adb = esmith::AccountsDB->open_ro();
257 +
258 +#my $event = $ARGV [0];
259 +
260 +my @users = ('admin', map { $_->key } $adb->users);
261 +
262 +my @newusers = @user;
263 +#($event eq "post-upgrade") ? @users : $ARGV[1] ;
264 +
265 +foreach my $user ( @newusers )
266 +{
267 + die "$user is not a user account\n"
268 + unless ( grep /^$user$/, @users );
269 +
270 + my @dirs = ("/home/e-smith/files/samba/profiles/$user");
271 +
272 + foreach my $dir (@dirs)
273 + {
274 + my $pre_existing = ( -d $dir );
275 +
276 + $pre_existing || mkdir $dir, 710 || die "Couldn't create directory $dir\n";
277 +
278 + chmod 0710, $dir; # Remove setgid bit
279 +
280 + #next if $pre_existing;
281 + system("mkdir -p /home/e-smith/files/users/$user/home/public_html");
282 + system("mkdir -p /home/e-smith/files/users/$user/tmp");
283 + chmod 0710, "/home/e-smith/files/users/$user";
284 + chmod 2770, "/home/e-smith/files/users/$user/home/public_html";
285 + chmod 2770, "/home/e-smith/files/users/$user/tmp";
286 + system("/bin/chown", "$user:www", "-R", "/home/e-smith/files/users/$user/home/public_html");
287 + system("/bin/chown", "$user:www", "/home/e-smith/files/users/$user");
288 + system("/bin/chown", "$user:www", "-R", "/home/e-smith/files/users/$user/tmp");
289 +
290 + esmith::util::chownFile($user, $user, $dir) ||
291 + die "Couldn't change ownership of $dir\n";
292 + }
293 +}
294 +
295 +exit (0);
296 diff -Nur smeserver-user-webspace-0.1-old/root/etc/e-smith/events/actions/user-force-revert-rights smeserver-user-webspace-0.1/root/etc/e-smith/events/actions/user-force-revert-rights
297 --- smeserver-user-webspace-0.1-old/root/etc/e-smith/events/actions/user-force-revert-rights 1969-12-31 19:00:00.000000000 -0500
298 +++ smeserver-user-webspace-0.1/root/etc/e-smith/events/actions/user-force-revert-rights 2013-11-23 17:39:33.000000000 -0500
299 @@ -0,0 +1,59 @@
300 +#!/usr/bin/perl -w
301 +#----------------------------------------------------------------------
302 +# copyright (C) 2001-2005 Mitel Networks Corporation
303 +#
304 +# This program is free software; you can redistribute it and/or modify
305 +# it under the terms of the GNU General Public License as published by
306 +# the Free Software Foundation; either version 2 of the License, or
307 +# (at your option) any later version.
308 +#
309 +# This program is distributed in the hope that it will be useful,
310 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
311 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
312 +# GNU General Public License for more details.
313 +#
314 +# You should have received a copy of the GNU General Public License
315 +# along with this program; if not, write to the Free Software
316 +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
317 +#
318 +#----------------------------------------------------------------------
319 +package esmith;
320 +
321 +use strict;
322 +use Errno;
323 +use esmith::util;
324 +
325 +use esmith::AccountsDB;
326 +my $adb = esmith::AccountsDB->open_ro();
327 +
328 +#my $event = $ARGV [0];
329 +
330 +my @users = ('admin', map { $_->key } $adb->users);
331 +
332 +my @newusers = @user;
333 +#($event eq "post-upgrade") ? @users : $ARGV[1] ;
334 +
335 +foreach my $user ( @newusers )
336 +{
337 + die "$user is not a user account\n"
338 + unless ( grep /^$user$/, @users );
339 +
340 + my @dirs = ("/home/e-smith/files/samba/profiles/$user");
341 +
342 + foreach my $dir (@dirs)
343 + {
344 + my $pre_existing = ( -d $dir );
345 +
346 + $pre_existing || mkdir $dir, 700 || die "Couldn't create directory $dir\n";
347 +
348 + chmod 0700, $dir; # Remove setgid bit
349 +
350 + #next if $pre_existing;
351 + system("/bin/chown", "$user:$user", "-R", "/home/e-smith/files/users/$user");
352 +
353 + esmith::util::chownFile($user, $user, $dir) ||
354 + die "Couldn't change ownership of $dir\n";
355 + }
356 +}
357 +
358 +exit (0);

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