aboutsummaryrefslogtreecommitdiffstats
path: root/BCD/Stagex.pm
blob: 7b6d2fb558bfd11aad278e264304b2cc9207afd9 (plain)
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
package BCD::Stagex;


use strict;
use XML::Simple;
use File::Copy::Recursive qw(dircopy pathrm);
use BCD::Common qw(:DEFAULT $isoconf $wd $name $arch $based_on $repo $version $builddir $error_color);

our @ISA = qw(Exporter);
our @EXPORT = qw(main_stagex);

my $LOG="STAGEX -";
my $color = "blue";
my $installer_destdir = "$builddir/$isoconf->{installer}{defaultpath}";

sub update_stage {
-d $repo or print_color("$LOG $repo does not exists !", $color) and exit;

my $installer_dir;
if (!defined($isoconf->{installer}{fullpath})) {
        $installer_dir = "$repo/$based_on/$arch/$isoconf->{installer}{defaultpath}";
} else {
	$installer_dir = "$isoconf->{installer}{fullpath}/install";
}
-d $installer_dir or print_color("$LOG $installer_dir does not exists !", $error_color) and exit;


#	print "$LOG remove old copy $builddir\n";
#	pathrm($builddir) or die $!;
	print_color("$LOG copy $installer_dir to $installer_destdir", $color);
	dircopy($installer_dir, $installer_destdir) or die $!;
}

sub update_advertising {
if (defined($isoconf->{installer}{advertising}{fullpath})) {
	print_color("$LOG copy $isoconf->{installer}{advertising}{fullpath} to $installer_destdir/extra/", $color);
	system("rm -rf $installer_destdir/extra/advertising");
	system("cp -a $isoconf->{installer}{advertising}{fullpath} $installer_destdir/extra/");
    }
}

sub copy_dosutils {
        print_color("$LOG copy of dosutils directory from $repo/$based_on/$arch to $builddir/../", $color);
        if (-d "$repo/$based_on/$arch/dosutils") {
                system("cp -a $repo/$based_on/$arch/dosutils $builddir/../");
                system("cp -a $repo/$based_on/$arch/autorun.inf $builddir/../");
        } else {
                print_color("$LOG FAILED copy of dosutils directory from $repo/$based_on/$arch", $error_color);
        }
}

sub copy_doc {
        print_color("$LOG copy of doc directory from $repo/$based_on/$arch to $builddir/", $color);
        if (-d "$repo/$based_on/$arch/doc") {
                system("cp -a $repo/$based_on/$arch/doc $builddir/");
        } else {
                print_color("$LOG FAILED copy of doc directory from $repo/$based_on/$arch", $error_color);
        }
}

sub copy_misc {
        print_color("$LOG copy of misc directory from $repo/$based_on/$arch to $builddir/../", $color);
        if (-d "$repo/$based_on/$arch/misc") {
		system("rm -rf $builddir/misc && mkdir $builddir/misc");
                system("cp -a $repo/$based_on/$arch/misc/drakx-in-chroot $builddir/misc/");
                system("cp -a $repo/$based_on/$arch/misc/mdkinst_stage2_tool $builddir/misc/");
        } else {
                print_color("$LOG FAILED copy of misc directory from $repo/$based_on/$arch", $error_color);
        }
}

sub patch_oem {
    if (-f $isoconf->{installer}{patch}) {
	print_color("$LOG copy $isoconf->{installer}{patch} to $installer_destdir/", $color);
	system("cp -a $isoconf->{installer}{patch} $installer_destdir/");
    }
}

sub main_stagex {
	update_stage;
	update_advertising;
	copy_dosutils;
	copy_doc;
	copy_misc;
	patch_oem;
}

1;