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