oldfiles: document the use of config file to protect pkg-get index
This commit is contained in:
parent
79dbac7647
commit
15a8fcc3f3
@ -48,13 +48,18 @@ will remove all outdated packages and sources.
|
|||||||
.SH CONFIGURATION
|
.SH CONFIGURATION
|
||||||
\fBoldfiles\fP looks for the file /etc/oldfiles.conf (if present) that contains
|
\fBoldfiles\fP looks for the file /etc/oldfiles.conf (if present) that contains
|
||||||
a list of files that should be kept. The format is a simple list of filenames
|
a list of files that should be kept. The format is a simple list of filenames
|
||||||
(full path required), e.g.:
|
(full path required). For example, if you share a directory of built packages
|
||||||
|
among other CRUX machines using \fBpkg\-get\fP(1) and \fBportspage\fP(1), you can
|
||||||
|
put something like the following into /etc/oldfiles.conf so that
|
||||||
|
the metadata files and html index will be omitted from the output.
|
||||||
.PP
|
.PP
|
||||||
.nf
|
.nf
|
||||||
.fam C
|
.fam C
|
||||||
/usr/sources/someport-1.3.tar.gz
|
/usr/pkgmk/packages/PKGREPO
|
||||||
/usr/packages/someport#1.3.pkg.tar.gz
|
/usr/pkgmk/packages/PKGDEPS
|
||||||
/usr/packages/index.html
|
/usr/pkgmk/packages/PKGREAD
|
||||||
|
/usr/pkgmk/packages/PKGINST
|
||||||
|
/usr/pkgmk/packages/index.html
|
||||||
|
|
||||||
.fam T
|
.fam T
|
||||||
.fi
|
.fi
|
||||||
|
@ -41,11 +41,14 @@ if ( $options{"-p"} + $options{"-s"} + $options{"-l"} == 0 ) {
|
|||||||
# Read pkgmk.conf
|
# Read pkgmk.conf
|
||||||
open CONFIG, "/etc/pkgmk.conf" or die "Could not open /etc/pkgmk.conf";
|
open CONFIG, "/etc/pkgmk.conf" or die "Could not open /etc/pkgmk.conf";
|
||||||
while (<CONFIG>) {
|
while (<CONFIG>) {
|
||||||
$srcdir = $1 if m/^PKGMK_SOURCE_DIR="(.*)"\n/;
|
$srcdir = $1 if m/^PKGMK_SOURCE_DIR=(.*)\n/;
|
||||||
$pkgdir = $1 if m/^PKGMK_PACKAGE_DIR="(.*)"\n/;
|
$pkgdir = $1 if m/^PKGMK_PACKAGE_DIR=(.*)\n/;
|
||||||
$compress = $1 if m/^PKGMK_COMPRESSION_MODE="(.*)"\n/;
|
$compress = $1 if m/^PKGMK_COMPRESSION_MODE=(.*)\n/;
|
||||||
}
|
}
|
||||||
close CONFIG;
|
close CONFIG;
|
||||||
|
$srcdir =~ s/"//g;
|
||||||
|
$pkgdir =~ s/"//g;
|
||||||
|
$compress =~ s/"//g;
|
||||||
|
|
||||||
# Check if dirs are specified / exists
|
# Check if dirs are specified / exists
|
||||||
if ( $options{"-p"} ) {
|
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;
|
open SIGNATURES, "$path/$name/.signature" or next;
|
||||||
while (<SIGNATURES>) {
|
while (<SIGNATURES>) {
|
||||||
m/^SHA256\s\((.+)\)\s.+\n/;
|
m/^SHA256\s\((.+)\)\s.+\n/;
|
||||||
if ($1 && !($1 =~ "Pkgfile") && !($1 =~ ".footprint")) {
|
if ($1 && ($1 ne "Pkgfile") && ($1 ne ".footprint")) {
|
||||||
$wanted{$srcdir}{$1} = 1;
|
$wanted{$srcdir}{$1} = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -120,11 +123,11 @@ foreach (split('\n', `prt-get printf "%p:%n:%v:%r:%i\n"`)) {
|
|||||||
|
|
||||||
# Keep user-specified files
|
# Keep user-specified files
|
||||||
if ( -f "/etc/oldfiles.conf") {
|
if ( -f "/etc/oldfiles.conf") {
|
||||||
my $keep;
|
my $k;
|
||||||
open KEEPME, "/etc/oldfiles.conf" or die "Could not open /etc/oldfiles.conf";
|
open KEEPME, "/etc/oldfiles.conf" or die "Could not open /etc/oldfiles.conf";
|
||||||
while ($keep = <KEEPME>) {
|
while ($k = <KEEPME>) {
|
||||||
chomp($keep);
|
chomp($k);
|
||||||
$keepme{$keep} = 1;
|
$keepme{$k} = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
close KEEPME;
|
close KEEPME;
|
||||||
|
Loading…
Reference in New Issue
Block a user