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

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

Docker runs locally thru genapp with run directory mounted on container

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