oldfiles: document the use of config file to protect pkg-get index

This commit is contained in:
2023-11-29 00:40:57 +00:00
parent 79dbac7647
commit 15a8fcc3f3
2 changed files with 20 additions and 12 deletions

View File

@@ -41,11 +41,14 @@ if ( $options{"-p"} + $options{"-s"} + $options{"-l"} == 0 ) {
# Read pkgmk.conf
open CONFIG, "/etc/pkgmk.conf" or die "Could not open /etc/pkgmk.conf";
while (<CONFIG>) {
$srcdir = $1 if m/^PKGMK_SOURCE_DIR="(.*)"\n/;
$pkgdir = $1 if m/^PKGMK_PACKAGE_DIR="(.*)"\n/;
$compress = $1 if m/^PKGMK_COMPRESSION_MODE="(.*)"\n/;
$srcdir = $1 if m/^PKGMK_SOURCE_DIR=(.*)\n/;
$pkgdir = $1 if m/^PKGMK_PACKAGE_DIR=(.*)\n/;
$compress = $1 if m/^PKGMK_COMPRESSION_MODE=(.*)\n/;
}
close CONFIG;
$srcdir =~ s/"//g;
$pkgdir =~ s/"//g;
$compress =~ s/"//g;
# Check if dirs are specified / exists
if ( $options{"-p"} ) {
@@ -102,7 +105,7 @@ foreach (split('\n', `prt-get printf "%p:%n:%v:%r:%i\n"`)) {
open SIGNATURES, "$path/$name/.signature" or next;
while (<SIGNATURES>) {
m/^SHA256\s\((.+)\)\s.+\n/;
if ($1 && !($1 =~ "Pkgfile") && !($1 =~ ".footprint")) {
if ($1 && ($1 ne "Pkgfile") && ($1 ne ".footprint")) {
$wanted{$srcdir}{$1} = 1;
}
}
@@ -120,11 +123,11 @@ foreach (split('\n', `prt-get printf "%p:%n:%v:%r:%i\n"`)) {
# Keep user-specified files
if ( -f "/etc/oldfiles.conf") {
my $keep;
my $k;
open KEEPME, "/etc/oldfiles.conf" or die "Could not open /etc/oldfiles.conf";
while ($keep = <KEEPME>) {
chomp($keep);
$keepme{$keep} = 1;
while ($k = <KEEPME>) {
chomp($k);
$keepme{$k} = 1;
}
}
close KEEPME;