prt-auf: improved the parsing of prt-get.conf

This commit is contained in:
John McQuah 2022-06-23 14:01:46 -04:00
parent c67a446cbb
commit af7d4a6e65
1 changed files with 5 additions and 4 deletions

View File

@ -22,7 +22,8 @@ my %odepends = ( tree => 0, recursive => 0, all => 0 );
my %opkg = ( margs => "", aargs => "", rargs => "", runscripts => "yes",
makecommand => "/usr/bin/pkgmk", addcommand => "/usr/bin/pkgadd",
removecommand => "/usr/bin/pkgrm", test => "no" );
my %olog = ( write => "disabled", mode => "overwrite", rm_on_success => "yes");
my %olog = ( write => "disabled", mode => "overwrite", rm_on_success => "yes",
file => "/var/log/pkgbuild/%n.log" );
my $prtconf = "/etc/prt-get.conf"; my @bldirs = parse_prt_conf($prtconf);
my @basedirs = @{$bldirs[0]}; my @localports = @{$bldirs[1]};
@ -252,8 +253,8 @@ sub parse_prt_conf {
$olog{write} = $1 if /^writelog\s+(enabled|disabled)/;
$olog{mode} = $1 if /^logmode\s+(append|overwrite)/;
$olog{rm_on_success} = $1 if /^rmlog_on_success\s+(no|yes)/;
$olog{file} = $1 if /^logfile\s+(.*)#/;
$prtcache = $1 if /^cachefile\s+(.*)#/;
$olog{file} = $1 if /^logfile\s+(.*)\s*(#|$)/;
$prtcache = $1 if /^cachefile\s+(.*)\s*(#|$)/;
}
close(PORTS);
return \@basedirs, \@localports;
@ -681,7 +682,7 @@ sub up_inst { # returns scalar references to five arrays
$addcmd{$t} = "$PKGADD -u $builtpkg{$t}";
$status{$t} = "not done";
if ($olog{write} eq "enabled") {
$logfile{$t} = ($olog{file}) ? $olog{file} : "/var/log/pkgmk/%n.log";
$logfile{$t} = $olog{file};
$logfile{$t} =~ s/(%n|%v|%r|%p)/$pvars{$1}/g;
$mkcmd{$t} .= ($olog{mode} eq "append") ? " 2>&1 |/usr/bin/tee -a $logfile{$t}"
: " 2>&1 |/usr/bin/tee $logfile{$t}";