source: genappalpha/languages/docker/build_docker_header.pl @ 1494

Last change on this file since 1494 was 1494, checked in by ehb, 3 years ago

docker target language updates

File size: 1.9 KB
Line 
1#!/usr/bin/perl
2
3{
4    if ( $] < 5.018 ) {
5        my $f = "/etc/profile.d/genapp.sh";
6        my $gb;
7        if ( -e $f ) {
8            my $fh;
9            !open $fh, $f || die "Error: the version of perl found is < 5.18 and, although there exists $f, the permissions do now allow reading by this process\n";
10            my @l = <$fh>;
11            close $fh;
12            @l = grep !/^\s*#/, @l;
13            @l = grep /GENAPP=/, @l;
14            grep chomp, @l;
15            die "Error: the version of perl found is < 5.18 and, although there exists $f, there is no definition of GENAPP available within it.\n" if !@l;
16            my $l = pop @l;
17            ( $gb ) = $l =~ /GENAPP=([^#;]+)/;
18            die "Error: the version of perl found is < 5.18 and, although there exists $f, the value of GENAPP within it could not be parsed.\n" if !$gb;
19            die "Error: the version of perl found is < 5.18 and, although there exists $f, the value of GENAPP within it ($gb) is not a directory.\n" if !-d $gb;
20        } else {
21            die "Error: the version of perl found is < 5.18 and $f does not exist\n";
22        }       
23        if ( -e "$gb/perl/bin/perl" ) {
24            $pv =`$gb/perl/bin/perl -e 'print \$];'`;
25            if ( $pv >= 5.018 ) {
26                unshift @ARGV, $0;
27                exec( "$gb/perl/bin/perl", @ARGV );
28            } else {
29                die "$gb/perl/bin/perl exists, but not a correct version of perl (needs a minimum of 5.18)\n";
30            }
31        } else {
32            die "you need to install a version of perl >= 5.18 in $gb/perl\n
33there is a script $gb/sbin/install-perl-stable to do this";
34        }
35    }
36}
37
38my $rc = eval {
39    require JSON;         JSON->import();
40};
41
42my %dependencies;
43my %module_json;
44my $executable_path = "__executable_path:docker__";
45my $workdir = "/genapp/run";
46
47my $wdir = $0;
48$wdir =~ s/\/[^\/]*$//;
49chdir $wdir || die "Error: could not chdir to $wdir\n";
Note: See TracBrowser for help on using the repository browser.