Changeset 2014 in ProjectBuilder


Ignore:
Timestamp:
Nov 25, 2015, 2:01:28 PM (8 years ago)
Author:
Bruno Cornec
Message:
  • Continue to fix issues with rights between docker container and host (mode of build dir should be more open at least 751, no sudo should be used to copy files back to avoid them belonging to root, and the initial cleanup is now done correctly for the TDIR)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • devel/pb/bin/pb

    r2012 r2014  
    15731573
    15741574    pb_mkdir_p("$ENV{'PBBUILDDIR'}") if (! -d "$ENV{'PBBUILDDIR'}");
     1575    # Need to be traversed by others if using containers
     1576    chmod 0751,"$ENV{'PBBUILDDIR'}";
    15751577    chdir "$ENV{'PBBUILDDIR'}" || die "Unable to chdir to $ENV{'PBBUILDDIR'}";
    15761578    my $made = ""; # pkgs made during build
     
    24882490        }
    24892491        $shcmd = "setarch i386 $shcmd" if (($pbos->{'arch'} =~ /i[3456]86/) && ($arch eq 'x86_64'));
    2490         $cpcmd = "sudo /bin/cp -r ";
    24912492        if (($cmt =~ /VE/) && ($vetype ne "docker")) {
    24922493            # We need to get the home dir of the target account to deliver in the right place
     
    24982499            }
    24992500            close(PASS);
     2501            $cpcmd = "sudo /bin/cp -r ";
    25002502        }
    25012503        if (($cmt =~ /VE/) && ($vetype eq "docker")) {
     
    25122514                $homedir = "/";
    25132515            }
    2514 
     2516            $cpcmd = "cp -r ";
    25152517        }
    25162518        $cptarget = "$tpdir/$homedir/$tdir";
     
    26792681        print DOCKER pb_get_content($pbscript1);
    26802682        print DOCKER "\n# Get content back from guest in a host dir\n";
     2683        # Host dir seen as TDIR in container
    26812684        $cp2target = "$ENV{'PBBUILDDIR'}/$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}-$pbos->{'name'}-$pbos->{'version'}-$pbos->{'arch'}";
    26822685        pb_mkdir_p("$cp2target");
    26832686        chmod 0777,"$cp2target";
    26842687        print DOCKER "TDIR=$homedir/$bdir-2/$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}-$pbos->{'name'}-$pbos->{'version'}-$pbos->{'arch'}\n";
    2685         print DOCKER "for i in $homedir/$bdir/*; do";
     2688        print DOCKER "for i in $homedir/$bdir/*; do\n";
    26862689        print DOCKER "  # Cleanup first to avoid rights issues for root owned files e.g.\n";
    2687         print DOCKER "  rm -f \$TDIR/\$i\n";
     2690        print DOCKER "  j=\`basename \$i\`\n";
     2691        print DOCKER "  rm -f \$TDIR/\$j\n";
    26882692        print DOCKER "  cp -r \$i \$TDIR\n";
    26892693        print DOCKER "done\n";
    26902694        print DOCKER "find \$TDIR -type f -print0 | xargs -0 chmod 644\n";
    26912695        print DOCKER "find \$TDIR -type d -print0 | xargs -0 chmod 777 2> /dev/null\n";
     2696        #print DOCKER "ls -al \$TDIR\n";
    26922697        close(DOCKER);
    26932698        $shcmd .= " -v $ENV{'PBBUILDDIR'}:$homedir/$bdir-2 -v $ENV{'PBTMP'}/vebuild:$homedir/$tdir-2 -w $homedir/$tdir-2 $tag{$pbstep} $dkcmd";
Note: See TracChangeset for help on using the changeset viewer.