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