This repository has been archived by the owner on Apr 25, 2019. It is now read-only.
forked from 101companies/101worker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall
executable file
·83 lines (56 loc) · 1.54 KB
/
install
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
79
80
81
82
83
#!/usr/bin/perl
use strict;
use warnings;
use Cwd;
use File::Find;
use Getopt::Long;
use Pod::Usage;
close STDIN;
my %opts;
my $getopt = GetOptions \%opts, qw(help|h build|b);
my %usage;
$usage{'-message'} = "unknown options: @ARGV" if @ARGV;
$usage{'-verbose'} = 99 if $opts{help};
pod2usage(%usage) if %usage || !$getopt;
my $target;
if ($opts{build}) # build mode
{
die "Please be less root.\n" if $> == 0;
$target = 'build';
}
else # install mode
{
die "Please be more root.\n" if $> != 0;
$ENV{PERL_MM_USE_DEFAULT } = 1;
$ENV{PERL_EXTUTILS_AUTOINSTALL} = '--defaultdeps';
$ENV{WORKER101_ASSUME_YES } = '-y';
$target = 'install';
}
my @make;
find sub {
return if not $_ eq 'Makefile';
my $code = system "make -nsf '$File::Find::name' $target >/dev/null 2>&1";
push @make, $File::Find::dir if $code == 0;
}, glob getcwd . '/*';
for my $path (sort @make)
{
chdir $path;
system make => $target;
}
__END__
=head1 NAME
install - run all C<make install> or C<make build> in this repository.
=head1 SYNOPSIS
To run all C<make install> targets in 101worker, just run C<install> as root.
It will blow up if you're not root.
To run all C<make build> targets in 101worker, run C<install -b>. Do B<not> run
this as root, but instead as the user that will be executing 101worker. Will
blow up if you're root.
=head1 OPTIONS
=over
=item --build, -b
Run all C<make build> targets instead of C<make install>.
=item --help, -h
Show this help.
=back
=cut