From ffb34d639f9b49d3daaadb31ff5b79e904c41517 Mon Sep 17 00:00:00 2001 From: John McQuah Date: Fri, 10 Jun 2022 13:46:19 -0400 Subject: [PATCH] prt-auf: small fix for the port_edit() function --- scripts/prt-auf | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/scripts/prt-auf b/scripts/prt-auf index 9296baf..e989474 100755 --- a/scripts/prt-auf +++ b/scripts/prt-auf @@ -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 () { 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 () { print $_ ; } - close (PF); - } else { - open (PF, "$pp/Pkgfile") or die "Could not open $pp/Pkgfile.\n"; - while () { 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 () { print $_ ; } + close (PF); + } else { + open (PF, "$pp/Pkgfile") or die "Could not open $pp/Pkgfile.\n"; + while () { print $_ ; } + close (PF); + } } }