17 die "Only root may run this" if $> != 0;
18 die "Script must be executed from its own folder"
19 unless -e getcwd
.'/install.php';
21 my (@apache_dir, @application);
23 find
(\
&find_apache
, '/etc', '/usr/local/etc');
27 return unless $File::Find
::name
=~ /\.*etc\/([apache2
|httpd
]+\
/conf.d)\.*/;
28 my $path = "$File::Find::dir";
29 push @apache_dir, $path;
33 push @application, $File::Find
::name
;
39 print "Directory exists. Continue [y/n]? ";
40 my $continue = <STDIN
>;
42 exit unless $continue eq 'y';
46 mkpath
($path) or die $!;
48 find
(\
&find_appl
, '..');
49 foreach (@application) {
57 my ($file, $dir) = fileparse
($1);
58 $dir = '' if $dir =~ /^.\//;
59 print STDERR
"Copying: $from -> $path/$dir\n";
60 copy
($from, "$path/$dir") or die "Copy failed: $!";
64 my $config = <<__CONF
;
65 Alias __ALIAS__
"__TOP__"
67 Options Multiviews SymLinksIfOwnerMatch
68 php_value include_path
'.:__TOP__:__TOP__navigate:__TOP__utils:__TOP__include:__TOP__caldav:__TOP__caldav/awl:__TOP__templates:__TOP__events'
73 Davical Web Calender
(C
) 2009, Michael Rasmussen
.
74 Released under GNU General Public License version
3+.
75 This license applies to all files except where a different license
78 This script will create the basic installation of Davical web calendar
.
79 You only need to run this script
if you want to install the application
80 outside the Apache
's web scope.
82 You will be asked a number of questions which must all be answered.
83 The script will try to figure out must of the answers for you and
84 present the found information inside []. Should the script not find
85 the answers for you (you will see []) or you disaggree to the suggested
86 setting you must provide the required setting yourself. If you aggree
87 to the found setting you simply press enter.
91 print "Apache2 configuration folder [";
92 print $apache_dir[0] if scalar @apache_dir > 0;
96 $folder = $apache_dir[0] unless $folder;
97 die "Missing Apache configuration folder\n" unless $folder;
100 print "Application URL [$url]? ";
103 $url1 = $url unless $url1;
104 die "Missing application web root\n" unless $url1;
107 my ($file, $dir) = fileparse($cwd);
108 $cwd = ($dir =~ /(.*)\/$/) ? $1 : $dir;
109 print "Application web root [$cwd]? ";
113 my $home = $ENV{'HOME
'};
117 $root = $cwd unless $root;
118 die "Missing application web root\n" unless $root;
120 $config =~ s/__TOP__/$root\//g;
121 $config =~ s/__ALIAS__/\/$url1/;
125 This setup will be used:
126 Apache configuration folder:\t$folder
127 Application URL:\t\t/$url1
128 Application top folder:\t\t$root
130 Installing this configuration in Apache:
134 print "Continue [Y/n]? ";
135 my $continue = <STDIN>;
136 chomp $continue unless $continue =~ m/^\n$/;
137 exit unless $continue =~ m/^[Yy\n]$/;
139 copy_files($root) unless $root eq $cwd;
141 my $config_file = "$folder/conf.d/webcal.conf";
143 print "$config_file: File exists, overwrite [y/n]? ";
144 my $continue = <STDIN>;
145 chomp $continue unless $continue =~ m/^\n$/;
146 exit unless $continue =~ m/^[Yy\n]$/;
147 } if -e $config_file;
149 open CONF, "> $config_file" or die $!;
155 Setup has completed. You need to restart Apache before
156 you continue with the installation of WebCal.
158 After Apache has been restarted point your web browser
159 to this address: http://localhost/$url1
160 Then simply follow the wizard.
162 For securety reasons I strongly advice you to only allow
163 access to the application via secure HTTP.