/[smecontribs]/rpms/smeserver-geneweb/contribs9/smeserver-geneweb-2.1-1-init.patch
ViewVC logotype

Contents of /rpms/smeserver-geneweb/contribs9/smeserver-geneweb-2.1-1-init.patch

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


Revision 1.3 - (show annotations) (download)
Sat Oct 5 20:01:46 2019 UTC (5 years, 1 month ago) by michel
Branch: MAIN
CVS Tags: HEAD
Changes since 1.2: +1 -1 lines
FILE REMOVED
* Wed Apr 03 2019 Michel Begue <mab974@gmail.com> 2.1-1.sme
- first import in sme9 for geneweb v6.08
- geneweb service not started [SME: 6371]
- Add "Base directory" input in panel console.
- perms corrected in templates.metadata
- normalize template and .spec

1 diff -urN smeserver-geneweb-2.1.old/createlinks smeserver-geneweb-2.1/createlinks
2 --- smeserver-geneweb-2.1.old/createlinks 2007-04-07 17:40:39.000000000 +0400
3 +++ smeserver-geneweb-2.1/createlinks 2019-04-03 00:11:38.000000000 +0400
4 @@ -7,20 +7,27 @@
5 # Panel Link
6 panel_link('geneweb', 'manager');
7
8 -my $gwd = "/opt/geneweb/gw/gwd";
9 +my $gw = "/opt/geneweb/gw/gw";
10
11 for my $event (qw(
12 geneweb-modify
13 ))
14 {
15 -templates2events("/opt/geneweb/gw/gw/only.txt",
16 +templates2events("$gw/only.txt",
17 qw(geneweb-modify bootstrap-console-save console-save));
18
19 - safe_symlink("sigusr1",
20 - "root/etc/e-smith/events/$event/service2adjust/httpd-e-smith");
21 +templates2events("/etc/rc.d/init.d/gwd",
22 + qw(geneweb-modify bootstrap-console-save console-save));
23 +
24 +}
25
26 +for my $event (qw(geneweb-modify))
27 +{
28 + safe_symlink("sigusr1",
29 + "root/etc/e-smith/events/$event/services2adjust/httpd-e-smith");
30 safe_symlink("restart",
31 - "root/etc/e-smith/events/$event/service2adjust/gwd");
32 + "root/etc/e-smith/events/$event/services2adjust/geneweb");
33 +
34 }
35
36 for my $event (qw(post-upgrade))
37 @@ -28,6 +35,3 @@
38 event_link("geneweb-restart", $event, "05");
39 }
40
41 -service_link_enhanced("gwd", "S96", "7");
42 -service_link_enhanced("gwd", "K47", "6");
43 -service_link_enhanced("gwd", "K47", "0");
44 diff -urN smeserver-geneweb-2.1.old/root/etc/e-smith/db/configuration/defaults/geneweb/DBDir smeserver-geneweb-2.1/root/etc/e-smith/db/configuration/defaults/geneweb/DBDir
45 --- smeserver-geneweb-2.1.old/root/etc/e-smith/db/configuration/defaults/geneweb/DBDir 1970-01-01 04:00:00.000000000 +0400
46 +++ smeserver-geneweb-2.1/root/etc/e-smith/db/configuration/defaults/geneweb/DBDir 2019-04-03 20:43:08.000000000 +0400
47 @@ -0,0 +1 @@
48 +/opt/geneweb/bases
49 diff -urN smeserver-geneweb-2.1.old/root/etc/e-smith/locale/en-us/etc/e-smith/web/functions/geneweb smeserver-geneweb-2.1/root/etc/e-smith/locale/en-us/etc/e-smith/web/functions/geneweb
50 --- smeserver-geneweb-2.1.old/root/etc/e-smith/locale/en-us/etc/e-smith/web/functions/geneweb 2007-08-05 16:48:59.000000000 +0400
51 +++ smeserver-geneweb-2.1/root/etc/e-smith/locale/en-us/etc/e-smith/web/functions/geneweb 2019-04-03 00:16:01.000000000 +0400
52 @@ -9,7 +9,7 @@
53 <base>LABEL_ONLY_STATUS</base>
54 <trans>Current assigned Geneweb 'only' IP:</trans>
55 </entry>
56 -
57 +
58 <entry>
59 <base>DESC_STATE_ADMIN_BUTTON</base>
60 <trans>
61 @@ -72,5 +72,31 @@
62 ]]>
63 </trans>
64 </entry>
65 -
66 +
67 + <entry>
68 + <base>ERR_DIR_NOT_EXIST</base>
69 + <trans>This directory does not exist.</trans>
70 + </entry>
71 +
72 + <entry>
73 + <base>LABEL_DBDIR_STATUS</base>
74 + <trans>Current assigned Geneweb Database(s) directory:</trans>
75 + </entry>
76 + <entry>
77 + <base>ERR_DIR_NOT_EXIST</base>
78 + <trans>Directory not found.</trans>
79 + </entry>
80 + <entry>
81 + <base>DESC_GENEWEB_BASE_DIR_DESCRIPTION</base>
82 + <trans>This directory must exist on server and be writeable for Geneweb. (geneweb:geneweb 770)</trans>
83 + </entry>
84 + <entry>
85 + <base>LABEL_GENEWEB_BASE_DIR</base>
86 + <trans>New directory for Geneweb database(s). :</trans>
87 + </entry>
88 + <entry>
89 + <base>NO_CHANGE</base>
90 + <trans>No change... no update !
91 + </trans>
92 + </entry>
93 </lexicon>
94 diff -urN smeserver-geneweb-2.1.old/root/etc/e-smith/locale/fr/etc/e-smith/web/functions/geneweb smeserver-geneweb-2.1/root/etc/e-smith/locale/fr/etc/e-smith/web/functions/geneweb
95 --- smeserver-geneweb-2.1.old/root/etc/e-smith/locale/fr/etc/e-smith/web/functions/geneweb 2019-04-02 23:11:43.000000000 +0400
96 +++ smeserver-geneweb-2.1/root/etc/e-smith/locale/fr/etc/e-smith/web/functions/geneweb 2019-04-03 00:17:21.000000000 +0400
97 @@ -9,11 +9,11 @@
98 <base>LABEL_ONLY_STATUS</base>
99 <trans>IP 'unique' assignée actuellement à Geneweb:</trans>
100 </entry>
101 -
102 +
103 <entry>
104 <base>DESC_STATE_ADMIN_BUTTON</base>
105 <trans><![CDATA[ <a class="button-like" href="geneweb?page=0&page_stack=&Next=Next&wherenext=GENEWEB_PAGE_ADMINISTER">Change IP and Administer</a> ]]></trans>
106 - </entry>
107 + </entry>
108
109 <entry>
110 <base>ERROR_UPDATING</base>
111 @@ -49,5 +49,27 @@
112 <base>GENEWEB_ADMINACCESS_STATUS_DESCRIPTION</base>
113 <trans><![CDATA[ <ul> <li>Access to port 2316 provides the administrative interface for Geneweb @ <b>http://YourGenewebServer:2316</b></li> <li>Geneweb Administration can <font color="red"><b>only</b></font> be accessed by the IP assigned in /opt/geneweb/gw/gw/only.txt</li> <li>This panel allows you to assign a valid LAN IP from which you wish to administer Geneweb on your LAN.</li></ul> <p><i>Browse to http://YourGenewebServer:2316 <br> -Geneweb will display the IP to set for administrative access from that client.</i></p> <br><br> ]]></trans>
114 </entry>
115 -
116 +
117 + <entry>
118 + <base>LABEL_DBDIR_STATUS</base>
119 + <trans>Répertoire de base de donnée(s) assigné actuellement à Geneweb:</trans>
120 + </entry>
121 + <entry>
122 + <base>ERR_DIR_NOT_EXIST</base>
123 + <trans>Répertoire inexistant sur le serveur.</trans>
124 + </entry>
125 + <entry>
126 + <base>DESC_GENEWEB_BASE_DIR_DESCRIPTION</base>
127 + <trans>Ce répertoire doit exister sur le serveur et être accessible en écriture par Geneweb. (geneweb:geneweb 770)</trans>
128 + </entry>
129 + <entry>
130 + <base>LABEL_GENEWEB_BASE_DIR</base>
131 + <trans>Nouveau répertoire contenant le(s) base(s) de données de Geneweb. :</trans>
132 + </entry>
133 + <entry>
134 + <base>NO_CHANGE</base>
135 + <trans>Aucun changement... pas de mis à jour !
136 + </trans>
137 + </entry>
138 +
139 </lexicon>
140 diff -urN smeserver-geneweb-2.1.old/root/etc/e-smith/templates/etc/rc.d/init.d/gwd/gwd_ALL smeserver-geneweb-2.1/root/etc/e-smith/templates/etc/rc.d/init.d/gwd/gwd_ALL
141 --- smeserver-geneweb-2.1.old/root/etc/e-smith/templates/etc/rc.d/init.d/gwd/gwd_ALL 1970-01-01 04:00:00.000000000 +0400
142 +++ smeserver-geneweb-2.1/root/etc/e-smith/templates/etc/rc.d/init.d/gwd/gwd_ALL 2019-04-03 00:19:07.000000000 +0400
143 @@ -0,0 +1,64 @@
144 +#!/bin/sh
145 +# chkconfig: 345 99 01
146 +#
147 +# gwd: Starts the genealogy Server
148 +#
149 +# Version: @(#) /etc/rc.d/init.d/gwd 1.0
150 +#
151 +# description: Starts and stops the genealogy Server at boot time and shutdown.
152 +#
153 +# processname: gwd
154 +# hide: true
155 +
156 +# Source function library.
157 +if [ -f /etc/rc.d/init.d/functions ]; then
158 + . /etc/rc.d/init.d/functions
159 +fi
160 +
161 +{
162 + my $db_dir = ${'geneweb'}{'DBDir'} || "/opt/geneweb/bases";
163 + $OUT .= <<END_BD;
164 +BD="$db_dir"
165 +END_BD
166 +}
167 +#BD="/opt/geneweb/bases" (default)
168 +HD="/opt/geneweb/gw/gw"
169 +
170 +start() \{
171 + echo "Starting GeneWeb Services:"
172 + $HD/gwd -log /var/log/gwd.log -daemon -hd $HD -bd $BD -setup_link
173 + $HD/gwsetup -daemon -gd $HD 2>> /var/log/gwsetup.log
174 + touch /var/lock/subsys/gwd
175 +\}
176 +
177 +stop() \{
178 + echo -n "Shutting down GeneWeb Services: "
179 + killproc $HD/gwd
180 + killproc $HD/gwsetup
181 + rm -f /var/lock/subsys/gwd
182 + echo
183 +\}
184 +
185 +restart() \{
186 + echo -n "Restarting GeneWeb Services: "
187 + stop
188 + sleep 1
189 + start
190 +\}
191 +
192 +# See how we were called.
193 +cd $BD
194 +
195 +case "$1" in
196 + start|stop|restart)
197 + $1
198 + ;;
199 + status)
200 + status gwd
201 + ;;
202 + *)
203 + echo "*** Usage: gwd \{start|stop|status|restart\}"
204 + exit 1
205 +esac
206 +
207 +exit 0
208 diff -urN smeserver-geneweb-2.1.old/root/etc/e-smith/templates/etc/rc.d/init.d/masq/45AllowGeneWeb smeserver-geneweb-2.1/root/etc/e-smith/templates/etc/rc.d/init.d/masq/45AllowGeneWeb
209 --- smeserver-geneweb-2.1.old/root/etc/e-smith/templates/etc/rc.d/init.d/masq/45AllowGeneWeb 2007-03-05 00:27:09.000000000 +0400
210 +++ smeserver-geneweb-2.1/root/etc/e-smith/templates/etc/rc.d/init.d/masq/45AllowGeneWeb 2019-04-03 00:20:11.000000000 +0400
211 @@ -4,10 +4,7 @@
212 my $status = ${'httpd-e-smith'}{status} || "disabled";
213 my $access = ${'httpd-e-smith'}{access} || "public";
214
215 - #$OUT = allow_tcp_in(2316,
216 - # ($status eq "enabled") && ($access eq "public"));
217 -
218 $OUT = allow_tcp_in(2317,
219 - ($status eq "enabled") && ($access eq "public"));
220 + ($status eq "enabled") && ($access eq "public"));
221 }
222
223 diff -urN smeserver-geneweb-2.1.old/root/etc/e-smith/templates.metadata/etc/rc.d/init.d/gwd smeserver-geneweb-2.1/root/etc/e-smith/templates.metadata/etc/rc.d/init.d/gwd
224 --- smeserver-geneweb-2.1.old/root/etc/e-smith/templates.metadata/etc/rc.d/init.d/gwd 1970-01-01 04:00:00.000000000 +0400
225 +++ smeserver-geneweb-2.1/root/etc/e-smith/templates.metadata/etc/rc.d/init.d/gwd 2019-04-03 19:18:25.000000000 +0400
226 @@ -0,0 +1,3 @@
227 +UID="root"
228 +GID="root"
229 +PERMS=0754
230 diff -urN smeserver-geneweb-2.1.old/root/etc/e-smith/templates.metadata/opt/geneweb/gw/gw/only.txt smeserver-geneweb-2.1/root/etc/e-smith/templates.metadata/opt/geneweb/gw/gw/only.txt
231 --- smeserver-geneweb-2.1.old/root/etc/e-smith/templates.metadata/opt/geneweb/gw/gw/only.txt 1970-01-01 04:00:00.000000000 +0400
232 +++ smeserver-geneweb-2.1/root/etc/e-smith/templates.metadata/opt/geneweb/gw/gw/only.txt 2019-04-03 19:20:08.000000000 +0400
233 @@ -0,0 +1,3 @@
234 +UID="geneweb"
235 +GID="geneweb"
236 +PERMS=0640
237 diff -urN smeserver-geneweb-2.1.old/root/etc/e-smith/web/functions/geneweb smeserver-geneweb-2.1/root/etc/e-smith/web/functions/geneweb
238 --- smeserver-geneweb-2.1.old/root/etc/e-smith/web/functions/geneweb 2007-08-05 19:29:43.000000000 +0400
239 +++ smeserver-geneweb-2.1/root/etc/e-smith/web/functions/geneweb 2019-04-03 00:27:46.000000000 +0400
240 @@ -78,6 +78,13 @@
241 <label>LABEL_ONLY_STATUS</label>
242 </field>
243
244 + <field
245 + type="literal"
246 + id="dbdir"
247 + value="get_dbdir()">
248 + <label>LABEL_DBDIR_STATUS</label>
249 + </field>
250 +
251 <field
252 type="literal"
253 id="button_admin"
254 @@ -106,6 +113,23 @@
255 value="get_only()">
256 <label>LABEL_ONLY_STATUS</label>
257 </field>
258 +
259 + <field
260 + type="text"
261 + id="geneweb_dbdir"
262 + size="64"
263 + validation="must_exist">
264 + <label>LABEL_GENEWEB_BASE_DIR</label>
265 + <description>DESC_GENEWEB_BASE_DIR_DESCRIPTION</description>
266 + </field>
267 +
268 + <field
269 + type="literal"
270 + id="dbdir"
271 + value="get_dbdir()">
272 + <label>LABEL_DBDIR_STATUS</label>
273 + </field>
274 +
275
276 <subroutine src="print_button('SAVE')" />
277
278 diff -urN smeserver-geneweb-2.1.old/root/usr/share/perl5/vendor_perl/esmith/FormMagick/Panel/geneweb.pm smeserver-geneweb-2.1/root/usr/share/perl5/vendor_perl/esmith/FormMagick/Panel/geneweb.pm
279 --- smeserver-geneweb-2.1.old/root/usr/share/perl5/vendor_perl/esmith/FormMagick/Panel/geneweb.pm 2019-04-02 23:11:43.000000000 +0400
280 +++ smeserver-geneweb-2.1/root/usr/share/perl5/vendor_perl/esmith/FormMagick/Panel/geneweb.pm 2019-04-03 19:14:23.000000000 +0400
281 @@ -22,8 +22,10 @@
282 get_prop
283 get_value
284 get_only
285 + get_dbdir
286 change_settings
287 must_be_local
288 + must_exist
289 );
290
291 our $VERSION = sprintf '%d.%03d', q$Revision: 1.2 $ =~ /: (\d+).(\d+)/;
292 @@ -134,6 +136,16 @@
293 {
294 return $db->get_prop("geneweb", "only");
295 }
296 +
297 +=head2 get_dbdir
298 +
299 +method to retrieve the value of /opt/geneweb/bases or other location for the form
300 +=cut
301 +
302 +sub get_dbdir
303 +{
304 + return $db->get_prop("geneweb", "DBDir");
305 +}
306
307 =head2 change_settings
308
309 @@ -144,7 +156,19 @@
310 {
311 my $self = shift;
312 my $q = $self->{'cgi'};
313 - $db->set_prop("geneweb", "only", $q->param("geneweb_only") || '');
314 + my $n_gw_ip = $q->param("geneweb_only") || '';
315 + my $n_gw_dbdir = $q->param("geneweb_dbdir") || '';
316 + if (!($n_gw_ip || $n_gw_dbdir)) {
317 + return $self->success("NO_CHANGE")
318 + }
319 + my $gw_ip = get_only();
320 + my $gw_dbdir = get_dbdir();
321 + if (($n_gw_ip eq $gw_ip) && ($n_gw_dbdir eq $gw_dbdir)) {
322 + return $self->success("NO_CHANGE")
323 + }
324 + if ($n_gw_ip) { $db->set_prop("geneweb", "only", $n_gw_ip) }
325 + if ($n_gw_dbdir) { $db->set_prop("geneweb", "DBDir", $n_gw_dbdir) }
326 +
327 unless ( system ( "/sbin/e-smith/signal-event", "geneweb-modify" ) == 0 )
328 {
329 $self->error("ERROR_UPDATING");
330 @@ -163,24 +187,46 @@
331 {
332 my $self = shift;
333 my $q = $self->{cgi};
334 - my $gw_ip = $q->param("geneweb_only");
335 + my $gw_ip = $q->param("geneweb_only" || '');
336 + if (!($gw_ip)) { return 'OK'}
337 + if (!( $gw_ip =~ /^((([01]?[0-9]{1,2}|[2][0-5]{1,2}).){3}([01]?[0-9]{1,2}|[2][0-5]{1,2}))$/ ))
338 + {
339 + return 'NOT_VALID_IP';
340 + }
341 # Make sure that the IP is indeed local.
342 my $ndb = esmith::NetworksDB->open_ro;
343 my @local_list = $ndb->local_access_spec;
344
345 foreach my $spec (@local_list)
346 {
347 - my $gw_ip = $db->get_prop("geneweb", "only", $q->param("geneweb_only") || '');
348 - if ($gw_ip)
349 - {
350 - if (Net::IPv4Addr::ipv4_in_network($spec, $gw_ip))
351 - {
352 - return 'OK';
353 - }
354 - }
355 + if (Net::IPv4Addr::ipv4_in_network($spec, $gw_ip))
356 + {
357 + return 'OK';
358 + }
359 }
360 # Not OK. The IP is not on any of our local networks.
361 return 'ERR_IP_NOT_LOCAL';
362 }
363
364 +
365 +=head2 valid_base_directory
366 +
367 +subroutine to validate base directory.
368 +=cut
369 +
370 +sub must_exist
371 +{
372 + my $self = shift;
373 + my $q = $self->{cgi};
374 + my $gw_dbdir = $q->param("geneweb_dbdir") || '';
375 + if ($gw_dbdir) {
376 + if (! -d "$gw_dbdir") { return 'ERR_DIR_NOT_EXIST' }
377 + # system("su geneweb -c 'touch $gw_dbdir/toto'") == 0
378 + # or return 'DIR_NOT_WRITEABLE';
379 + # system("su geneweb -c 'rm -f $gw_dbdir/toto'")
380 + # return 'DIR_EXIST_AND_WRITEABLE';
381 + }
382 + return 'OK';
383 +}
384 +
385 1;

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