prt-auf: small fix for the port_edit() function

This commit is contained in:
John McQuah 2022-06-10 13:46:19 -04:00
parent 985bb342e7
commit ffb34d639f

View File

@ -231,8 +231,7 @@ sub parse_args {
} }
sub parse_prt_conf { sub parse_prt_conf {
my @basedirs; my @localports; my $runscripts; my $make; my $add; my $remove; my @basedirs; my @localports; my $conf = "/etc/prt-get.conf";
my $conf = "/etc/prt-get.conf";
open(PORTS, $conf) or die "could not open $conf"; open(PORTS, $conf) or die "could not open $conf";
while (<PORTS>) { chomp; while (<PORTS>) { chomp;
@ -426,6 +425,7 @@ sub uninstall {
foreach my $t (@targets) { foreach my $t (@targets) {
($opkg{test} eq "no") ? system($PKGRM,$opkg{rargs},$t) : print "$PKGRM $opkg{rargs} $t\n"; ($opkg{test} eq "no") ? system($PKGRM,$opkg{rargs},$t) : print "$PKGRM $opkg{rargs} $t\n";
$removed{$t}=1 if ($?>>8 == 0); $removed{$t}=1 if ($?>>8 == 0);
if ((" $LOCKED " =~ / $t /) and ($opkg{test} eq "no")) { port_unlock($t); }
} }
return \%removed; return \%removed;
} }
@ -749,18 +749,21 @@ sub port_edit {
port_edit("cat",$pp,"README.md") if (-f "$pp/README.md"); port_edit("cat",$pp,"README.md") if (-f "$pp/README.md");
} }
if (($file) and (-f "$pp/$file") and ($type eq "edit")) { if ($type eq "edit") {
exec ($EDITOR,"$pp/$file"); exec ($EDITOR,"$pp/$file") if (($file) and (-f "$pp/$file"));
} else { exec ($EDITOR,"$pp/Pkgfile"); } exec ($EDITOR,"$pp/Pkgfile") if ((! $file) or (! -f "$pp/$file"));
}
if (($file) and (-f "$pp/$file") and ($type eq "cat")) { if ($type eq "cat") {
open (PF, "$pp/$file") or die "Could not open $pp/$file.\n"; if (($file) and (-f "$pp/$file")) {
while (<PF>) { print $_ ; } open (PF, "$pp/$file") or die "Could not open $pp/$file.\n";
close (PF); while (<PF>) { print $_ ; }
} else { close (PF);
open (PF, "$pp/Pkgfile") or die "Could not open $pp/Pkgfile.\n"; } else {
while (<PF>) { print $_ ; } open (PF, "$pp/Pkgfile") or die "Could not open $pp/Pkgfile.\n";
close (PF); while (<PF>) { print $_ ; }
close (PF);
}
} }
} }