summaryrefslogtreecommitdiff
path: root/misc/linux-opengroupware/scripts/patch_apache_version.pl
blob: 99aa8da6d355e1236b8ea9f17cef0dbf329e52b2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/usr/bin/perl -w
# 
# by Frank Reppin <frank.reppin@boerde.de>
# 

use strict;

my $current_apache_version = `/usr/local/sbin/httpd -v|head -1`;
my @version = split / /, $current_apache_version;
my $version;
my $runs_with;

$version = $version[2];
$version =~ s/^Apache\///g;
chomp $version;

if ( ! -e '/compat/linux/opt/opengroupware.org/OpenGroupware.org.apacheinclude' ) {
	print "OpenGroupware.org.apacheinclude is not present! I'll deal with this issue!\n";
	open (AI, "> /compat/linux/opt/opengroupware.org/OpenGroupware.org.apacheinclude") || die "Arrr! This won't work, because: $!\n";
		print AI "# This loads the mod_ngobjweb module which is the binding part between\n";
		print AI "# the Apache web server and the OGo application.\n";
		print AI "#\n";
	print AI "LoadModule ngobjweb_module\t/compat/linux/opt/opengroupware.org/ngobjweb_$version.so\n";
	print AI "\n";
		print AI "<LocationMatch \"^/OpenGroupware*\">\n";
	print AI "\tSetHandler ngobjweb-adaptor\n";
		print AI "\tSetAppPort 19999\n";
		print AI "</LocationMatch>\n";
		print AI "\n";
		print AI "<LocationMatch \"^/evolution*\">\n";
		print AI "\tSetHandler ngobjweb-adaptor\n";
		print AI "\tSetAppPort 20001\n";
		print AI "</LocationMatch>\n";
		print AI "\n";
		print AI "<LocationMatch \"^/zidestore/*\">\n";
		print AI "\tSetHandler ngobjweb-adaptor\n";
		print AI "\tSetAppPort 20001\n";
	print AI "</LocationMatch>\n";
	print AI "\n";
	print AI "Alias /OpenGroupware.woa/WebServerResources/ \"/compat/linux/opt/opengroupware.org/WebServerResources/\"\n";
	print AI "<Directory \"/compat/linux/opt/opengroupware.org/WebServerResources/\">\n";
	print AI "\tOptions Indexes Multiviews\n";
	print AI "\tAllowOverride None\n";
	print AI "\tOrder allow,deny\n";
	print AI "\tAllow from all\n";
	print AI "</Directory>\n";
		print AI "Alias /ArticleImages \"/compat/linux/opt/opengroupware.org/news\"\n";
	close(AI);
} else {
		print "\n";
	print "OpenGroupware.org.apacheinclude is already present and will not be changed!\n";
		open(OI, "/compat/linux/opt/opengroupware.org/OpenGroupware.org.apacheinclude");
			while(<OI>) {
				if (/ngobjweb_\d+.*\.so$/) {
					$runs_with = $&;
					$runs_with =~ s/^ngobjweb_//g;
					$runs_with =~ s/\.so$//g;
				}
			}
		close(OI);
		if ( $runs_with eq $version ) {
			print "The OpenGroupware.org.apacheinclude seems to be fine.\n";
			print "It's configured for Apache $runs_with and we have Apache $version\n";
		} else {
			print "\n";
			print "But! Chances are, that your OpenGroupware.org.apacheinclude is broken.\n";
			print "This isn't necessarily an error - as it might be a result of a special\n";
			print "configuration you're using.\n";
			print "It's also very likely that you've updated your Apache from ports in between.\n";
			print "\n";
			print "Here are the results:\n";
			print "-------------------------\n";
			print "OpenGroupware.org.apacheinclude is configured to use Apache $runs_with\n";
			print "The version string of your Apache binary indicates that you run $version\n";
			print "Please verify this setting manually and - if needed - update your\n";
			print "OpenGroupware.org.apacheinclude to reflect the recent changes made to your system.\n";
		}
}