... | ... |
@@ -1,2 +1,3 @@ |
1 |
-order deny,allow |
|
2 |
-deny from all |
|
1 |
+<Files ~ gitprep.cgi> |
|
2 |
+ Deny from all |
|
3 |
+</Files> |
... | ... |
@@ -143,10 +143,7 @@ It is useful to write configuration in ***gitprep.my.conf***, not gitprep.conf. |
143 | 143 |
# Installation into Shared Server |
144 | 144 |
|
145 | 145 |
Shared Server must support **Linux/Unix**, **Apache**, **SuExec**, |
146 |
-**CGI**, and **PHP5(CGI mode)**. |
|
147 |
- |
|
148 |
-(*PHP* is not strictly necessary. If PHP exists, the install process is easy |
|
149 |
-because you do not need to think about permissions.) |
|
146 |
+**CGI**. |
|
150 | 147 |
|
151 | 148 |
**Note that CGI script only work on shared server which support CGI + SuExec. |
152 | 149 |
At first, you should check the shared server support CGI + SuExec.** |
... | ... |
@@ -0,0 +1,7 @@ |
1 |
+#!/usr/bin/env perl |
|
2 |
+use FindBin; |
|
3 |
+use lib "$FindBin::Bin/mojo/lib"; |
|
4 |
+use lib "$FindBin::Bin/extlib/lib/perl5"; |
|
5 |
+ |
|
6 |
+$ENV{MOJO_MODE} = 'production'; |
|
7 |
+require "$FindBin::Bin/script/gitprep"; |
... | ... |
@@ -1,33 +0,0 @@ |
1 |
-#!/usr/bin/env perl |
|
2 |
- |
|
3 |
-use strict; |
|
4 |
-use warnings; |
|
5 |
- |
|
6 |
-use File::Basename qw/basename dirname/; |
|
7 |
-use File::Spec::Functions qw/catdir splitdir/; |
|
8 |
- |
|
9 |
-BEGIN { |
|
10 |
- # Source directory has precedence |
|
11 |
- my $script_name = basename __FILE__; |
|
12 |
- my $base_dir_name = $script_name; |
|
13 |
- $base_dir_name =~ s/\.cgi$//; |
|
14 |
- my @base_dir = (splitdir(dirname __FILE__), $base_dir_name); |
|
15 |
- my $mojo_lib = join('/', @base_dir, 'mojo', 'lib'); |
|
16 |
- my $lib = join('/', @base_dir, 'lib'); |
|
17 |
- my $extlib = join('/', @base_dir, 'extlib', 'lib', 'perl5'); |
|
18 |
- eval 'use lib $mojo_lib, $extlib, $lib'; |
|
19 |
- croak $@ if $@; |
|
20 |
-} |
|
21 |
- |
|
22 |
-use Mojolicious::Commands; |
|
23 |
- |
|
24 |
-# Check if Mojolicious is installed; |
|
25 |
-die <<EOF unless eval 'use Mojolicious::Commands; 1'; |
|
26 |
-It looks like you don't have the Mojolicious framework installed. |
|
27 |
-Please visit http://mojolicio.us for detailed installation instructions. |
|
28 |
- |
|
29 |
-EOF |
|
30 |
- |
|
31 |
-# Start commands |
|
32 |
-$ENV{MOJO_MODE} = 'production'; |
|
33 |
-Mojolicious::Commands->start_app('Gitprep'); |
... | ... |
@@ -1,2 +0,0 @@ |
1 |
-order allow,deny |
|
2 |
-allow from all |
... | ... |
@@ -1,12 +0,0 @@ |
1 |
-#!/usr/bin/env perl |
|
2 |
- |
|
3 |
-use FindBin; |
|
4 |
-use lib "$FindBin::Bin/../mojo/lib"; |
|
5 |
-BEGIN { $ENV{MOJO_MODE} = 'production' } |
|
6 |
-use Mojolicious::Lite; |
|
7 |
-use Carp 'croak'; |
|
8 |
- |
|
9 |
-any '/' => 'index'; |
|
10 |
- |
|
11 |
-app->start; |
|
12 |
- |
... | ... |
@@ -1,41 +0,0 @@ |
1 |
-<?php |
|
2 |
- ini_set( 'display_errors', 1 ); |
|
3 |
- |
|
4 |
- # Setup directory |
|
5 |
- if ($setup_dir = getcwd()) { |
|
6 |
- # Setup CGI script |
|
7 |
- $setup_cgi_script = "$setup_dir/setup.cgi"; |
|
8 |
- |
|
9 |
- # Chmod Setup CGI script |
|
10 |
- if (chmod($setup_cgi_script, 0755)) { |
|
11 |
- $setup_cgi_url = $_SERVER['PHP_SELF']; |
|
12 |
- $setup_cgi_url = preg_replace('/\.php$/', '.cgi', $setup_cgi_url); |
|
13 |
- header("Location: $setup_cgi_url"); |
|
14 |
- exit(); |
|
15 |
- } |
|
16 |
- else { |
|
17 |
- $error = "Can't $setup_cgi_script mode to 755"; |
|
18 |
- } |
|
19 |
- } |
|
20 |
- else { |
|
21 |
- $error = "Can't change directory"; |
|
22 |
- } |
|
23 |
-?> |
|
24 |
- |
|
25 |
-<!DOCTYPE html> |
|
26 |
-<html> |
|
27 |
- <head> |
|
28 |
- <title>Setup</title> |
|
29 |
- </head> |
|
30 |
- <body> |
|
31 |
- <div class="container"> |
|
32 |
- <div class="text-center"><h1>Setup</h1></div> |
|
33 |
- </div> |
|
34 |
- <hr style="margin-top:0;margin-bottom:0"> |
|
35 |
- <div class="container"> |
|
36 |
- <div style="color:red"> |
|
37 |
- <?php echo $error ?> |
|
38 |
- </div> |
|
39 |
- </div> |
|
40 |
- </body> |
|
41 |
-</html> |
... | ... |
@@ -1,153 +0,0 @@ |
1 |
-<% |
|
2 |
- use Cwd qw/getcwd realpath/; |
|
3 |
- use File::Copy 'copy'; |
|
4 |
- |
|
5 |
- # Parameter |
|
6 |
- my $op = param('op') || ''; |
|
7 |
- |
|
8 |
- # Outputs |
|
9 |
- my @outputs; |
|
10 |
- |
|
11 |
- # Error |
|
12 |
- my $error; |
|
13 |
- |
|
14 |
- # App absolute path |
|
15 |
- my $app_abs_path; |
|
16 |
- |
|
17 |
- if ($op eq 'setup') { |
|
18 |
- |
|
19 |
- # Setup directory |
|
20 |
- my $setup_dir = getcwd; |
|
21 |
- |
|
22 |
- # Home directory |
|
23 |
- my $home_dir = realpath($setup_dir . '/..'); |
|
24 |
- |
|
25 |
- # Script directory |
|
26 |
- my $script_dir = realpath($setup_dir . '/../script'); |
|
27 |
- |
|
28 |
- # cpanm Path |
|
29 |
- my $cpanm_path = "$home_dir/cpanm"; |
|
30 |
- |
|
31 |
- # cpanm home directory |
|
32 |
- $ENV{PERL_CPANM_HOME} = $setup_dir; |
|
33 |
- |
|
34 |
- # Setup script absolute path |
|
35 |
- my $setup_script_abs_path = url_for->to_string; |
|
36 |
- |
|
37 |
- # Application script absolute path |
|
38 |
- $app_abs_path = $setup_script_abs_path; |
|
39 |
- $app_abs_path =~ s#\Q/setup/setup.cgi#.cgi#; |
|
40 |
- |
|
41 |
- # Application script name |
|
42 |
- my ($app_name) = $app_abs_path =~ /([0-9a-zA-Z-_]+\.cgi)$/; |
|
43 |
- |
|
44 |
- # Application script file |
|
45 |
- my $app_file = "$script_dir/$app_name"; |
|
46 |
- |
|
47 |
- # Place application script is moved to |
|
48 |
- my $app_to = realpath("$home_dir/../$app_name"); |
|
49 |
- |
|
50 |
- # Change directory |
|
51 |
- if (chdir $home_dir) { |
|
52 |
- |
|
53 |
- # Install Module::CoreList |
|
54 |
- my $cmd = 'perl cpanm -n -l extlib Module::CoreList 2>&1'; |
|
55 |
- if (open my $fh, "$cmd |") { |
|
56 |
- local $/; |
|
57 |
- my $output = <$fh>; |
|
58 |
- push @outputs, $output; |
|
59 |
- if (close $fh) { |
|
60 |
- |
|
61 |
- # Install modules |
|
62 |
- my $cmd = 'perl -Iextlib/lib/perl5 ' |
|
63 |
- . 'cpanm -n -L extlib --installdeps . 2>&1'; |
|
64 |
- if (open my $fh, "$cmd |") { |
|
65 |
- local $/; |
|
66 |
- my $output = <$fh>; |
|
67 |
- push @outputs, $output; |
|
68 |
- if (close $fh) { |
|
69 |
- |
|
70 |
- # Copy application file |
|
71 |
- if (copy $app_file, $app_to) { |
|
72 |
- push @outputs, "$app_file is moved to $app_to"; |
|
73 |
- |
|
74 |
- # Change mode |
|
75 |
- if (chmod(0755, $app_to)) { |
|
76 |
- push @outputs, "change $app_to mode to 755"; |
|
77 |
- } |
|
78 |
- else { |
|
79 |
- $error = 1; |
|
80 |
- app->log->error("Can't change mode $app_to"); |
|
81 |
- } |
|
82 |
- } |
|
83 |
- else { |
|
84 |
- $error = 1; |
|
85 |
- app->log->error("Can't move $app_file to $app_to"); |
|
86 |
- } |
|
87 |
- } |
|
88 |
- else { |
|
89 |
- $error = 1; |
|
90 |
- app->log->error("Can't close pipe install modules: $!"); |
|
91 |
- } |
|
92 |
- } |
|
93 |
- else { |
|
94 |
- my $error = 1; |
|
95 |
- app->log->error("Can't open pipe install modules: $!"); |
|
96 |
- } |
|
97 |
- } |
|
98 |
- else { |
|
99 |
- $error = 1; |
|
100 |
- app->log->error("Can't close pipe install Module::CoreList: $!"); |
|
101 |
- } |
|
102 |
- } |
|
103 |
- else { |
|
104 |
- $error = 1; |
|
105 |
- app->log->error("Can't open pipe install Module::CoreList: $!"); |
|
106 |
- } |
|
107 |
- } |
|
108 |
- else { |
|
109 |
- $error = 1; |
|
110 |
- app->log->error("Can't cahgne directory: $!"); |
|
111 |
- } |
|
112 |
- } |
|
113 |
-%> |
|
114 |
- |
|
115 |
-<!DOCTYPE html> |
|
116 |
-<html> |
|
117 |
- <head> |
|
118 |
- <meta charset="UTF-8"> |
|
119 |
- <title>Setup</title> |
|
120 |
- </head> |
|
121 |
- <body> |
|
122 |
- <div> |
|
123 |
- <div style="text-align:center"><h1>Setup</h1></div> |
|
124 |
- </div> |
|
125 |
- <hr style="margin-top:0;margin-bottom:0"> |
|
126 |
- <div> |
|
127 |
- <div style="text-align:center"><b><h3>Click only once. Wait for a few minutes.</h3></b></div> |
|
128 |
- <form action="<%= url_for->query(op => 'setup') %>" method="post"> |
|
129 |
- <div style="text-align:center;margin-bottom:10px"> |
|
130 |
- <input type="submit" style="width:200px;height:50px;font-size:200%" value="Setup"> |
|
131 |
- </div> |
|
132 |
- </form> |
|
133 |
- |
|
134 |
- % if ($op eq 'setup') { |
|
135 |
- <span">Result</span> |
|
136 |
-<pre style="height:300px;overflow:auto;margin-bottom:30px"> |
|
137 |
-% if ($error) { |
|
138 |
-<span style="color:red">Error, Setup failed. See setup/log/production.log</span> |
|
139 |
-% } |
|
140 |
-% unless ($error) { |
|
141 |
-% for my $line (@outputs) { |
|
142 |
-%= $line |
|
143 |
-% } |
|
144 |
-% } |
|
145 |
-</pre> |
|
146 |
- % } |
|
147 |
- |
|
148 |
- % if ($op eq 'setup' && !$error) { |
|
149 |
- <div style="font-size:150%;margin-bottom:30px;">Go to <a href="<%= $app_abs_path %>">Application</a></div> |
|
150 |
- % } |
|
151 |
- </div> |
|
152 |
- </body> |
|
153 |
-</html> |