-
Notifications
You must be signed in to change notification settings - Fork 0
/
inject.pl
executable file
·95 lines (70 loc) · 2.53 KB
/
inject.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#!/usr/bin/perl -w
#
# inject.pl - perl script to install a CVS version of one of the
# fink packages into an existing Fink tree
#
# Fink - a package manager that downloads source and installs it
# Copyright (c) 2001 Christoph Pfisterer
# Copyright (c) 2001-2015 The Fink Package Manager Team
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA.
#
$| = 1;
use 5.008_001; # perl 5.8.1 or newer required
use strict;
use FindBin;
use lib "$FindBin::RealBin/perlmod";
use File::Copy;
require Fink::Services;
import Fink::Services qw(&execute);
### use sudo
if ($> != 0) {
print "This script must be run under sudo, which requires your password.\n";
my $cmd = "/usr/bin/sudo $FindBin::RealBin/$0";
if ($#ARGV >= 0) {
$cmd .= " '".join("' '", @ARGV)."'";
}
exit &execute($cmd,quiet=>1);
}
### create FinkVersion.pm from FinkVersion.pm.in (we don't care about the
### @ARCHITECTURE@ and @VERSION@ strings, because this copy of Fink is just
### here for the purpose of running the inject_packages() script, which
### doesn't need that information)
my $output = "$FindBin::RealBin/perlmod/Fink/FinkVersion.pm";
my $input = $output . '.in';
copy("$input", "$output") or die "Copy failed: $!";
require Fink::Bootstrap;
### which package are we injecting?
my $package = "fink";
### check if we're unharmed, and specify files for tarball
import Fink::Bootstrap qw(&check_files &fink_packagefiles);
my $res = check_files();
if ($res == 1 ) {
exit 1;
}
my $packagefiles = fink_packagefiles();
my $info_script = "";
# quit immediately if pod2man isn't executable, to avoid folks nearly building
### fink and then having it crap out.
system "./pre-build-test.sh" and exit 1;
### run the inject_package script
import Fink::Bootstrap qw(&inject_package);
my $param = shift;
my $result = inject_package($package, $packagefiles, $info_script, $param);
if ($result == 1) {
exit 1;
}
### eof
exit 0;