-
Notifications
You must be signed in to change notification settings - Fork 68
/
migrate.pl
executable file
·65 lines (51 loc) · 1.04 KB
/
migrate.pl
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
#!/usr/bin/perl
use strict;
use Getopt::Std;
use vars qw($opt_p $opt_h);
getopts('p:h');
sub usage {
print ("usage: $0 -p [path of nginx binary file]\n");
}
if ($opt_h) {
&usage;
exit 0;
}
if (!$opt_p) {
&usage;
exit 1;
}
# we have a path of original nginx binary file
my $nginx = "$opt_p";
my @rslt = split("\n", `$nginx -V 2>&1`);
my ($version, $config);
if (!@rslt) {
print "Invalid nginx binary file\n";
exit 1;
}
foreach (@rslt) {
m/nginx version: nginx\/(.*)/;
$version = $1;
m/configure arguments: (.*)/;
$config = $1;
}
print "\n";
print "nginx found at $nginx, version: $version\n";
print "\n";
print "use configuration: $config\n";
print "\n";
print "Are you sure to continue?[y/n] ";
chomp(my $flag = <STDIN>);
if ($flag eq "y") {
print "Configuring SEnginx...";
`./se-configure.sh $config`;
print "Done.\n";
print "Building SEnginx...";
`make`;
print "Done.\n";
print "Installing SEnginx...";
`make install`;
print "Done.\n";
} else {
exit 0;
}
exit 0;