This repository has been archived by the owner on Apr 25, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
DidbsConfigurator.pm
68 lines (58 loc) · 1.77 KB
/
DidbsConfigurator.pm
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
package DidbsConfigurator;
use DidbsUtils;
sub new
{
my $self = bless {}, shift;
my $scriptLocation = shift;
my $packageDefsDir = shift;
my $packageId = shift;
my $packageDir = shift;
my $buildDir = shift;
my $installDir = shift;
my $didbsPackage = shift;
my $didbsExtractor = shift;
my $didbsPatcher = shift;
$self->{scriptLocation} = $scriptLocation;
$self->{packageDefsDir} = $packageDefsDir;
$self->{packageId} = $packageId;
$self->{packageDir} = $packageDir;
$self->{buildDir} = $buildDir;
$self->{installDir} = $installDir;
$self->{didbsPackage} = $didbsPackage;
$self->{didbsExtractor} = $didbsExtractor;
$self->{didbsPatcher} = $didbsPatcher;
return $self;
}
sub configureit
{
my $self = shift;
my $packageId = $self->{packageId};
didbsprint "Configuring $packageId\n";
my $builddir = "$self->{buildDir}/$packageId/$self->{didbsPackage}->{packageDir}";
didbsprint "Would configure in $builddir\n";
my $installdir = $self->{installDir};
my $extraargs;
didbsprint "Checking if $packageId begins with stage1.\n";
if( begins_with($packageId,"stage1") )
{
$extraargs="/usr/didbs/current";
}
else
{
$extraargs=$self->{scriptLocation};
}
my $packageDefDir = $self->{packageDefsDir} . "/" . $packageId;
didbsprint "Changing directory to $packageDefDir\n";
chdir $packageDefDir;
my $configureRecipe = "$self->{packageDefsDir}/$packageId/$self->{didbsPackage}->{configureRecipe}";
my $cmd = "$configureRecipe $builddir $installdir $extraargs";
didbsprint "About to execute $cmd\n";
system($cmd) == 0 || die $!;
return 1;
}
sub debug
{
my $self = shift;
didbsprint "DidbsConfigurator constructed for $self->{packageId}\n";
}
1;