pkg-get.pl: add more tests for installscripts on target rootfs

This commit is contained in:
John McQuah 2023-08-21 07:03:04 -04:00
parent 719575d0fb
commit 1e7a63f5b3
1 changed files with 4 additions and 2 deletions

View File

@ -13,6 +13,7 @@ use warnings;
use strict;
use Getopt::Long;
use Digest::file qw(digest_file_hex);
use File::Path;
my $VERSION = "0.4.8";
my $CFGFILE = "/etc/pkg-get.conf";
@ -442,7 +443,7 @@ sub doscript {
($pkg{$when . "_install"} eq "yes") or return;
my $cmd = ($root) ? "chroot $root " : "";
$cmd .= "/bin/bash $pkg{'path'}/PKGINST $pkg{'name'} $when";
if (system($cmd) == 0) {
if ((-e "$root$pkg{'path'}/PKGINST") and (system($cmd) == 0)) {
$pptasks{$pkg{'name'}} .= " [$when: ok]";
} else {
$pptasks{$pkg{'name'}} .= " [$when: failed]";
@ -815,8 +816,9 @@ sub upinst {
if ($root) {
foreach my $repo(@repos) {
my ($dir, $url) = split(/\|/, $repo);
( -e "$root$dir" ) or make_path("$root$dir");
( -d "$root$dir" ) or next;
open(my $host, "$dir/PKGINST") or next;
( -d "$root$dir" ) or mkdir("$root$dir",0755);
open(my $mount, ">$root$dir/PKGINST");
while (<$host>) { print $mount $_; }
close($mount);