diff --git a/man1/oldfiles.1 b/man1/oldfiles.1 index 02cbb3c..84e27d5 100644 --- a/man1/oldfiles.1 +++ b/man1/oldfiles.1 @@ -48,13 +48,18 @@ will remove all outdated packages and sources. .SH CONFIGURATION \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 -(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 .nf .fam C - /usr/sources/someport-1.3.tar.gz - /usr/packages/someport#1.3.pkg.tar.gz - /usr/packages/index.html + /usr/pkgmk/packages/PKGREPO + /usr/pkgmk/packages/PKGDEPS + /usr/pkgmk/packages/PKGREAD + /usr/pkgmk/packages/PKGINST + /usr/pkgmk/packages/index.html .fam T .fi diff --git a/scripts/oldfiles.pl b/scripts/oldfiles.pl index 71e741c..37f7a8c 100755 --- a/scripts/oldfiles.pl +++ b/scripts/oldfiles.pl @@ -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 () { - $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 () { 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 = ) { - chomp($keep); - $keepme{$keep} = 1; + while ($k = ) { + chomp($k); + $keepme{$k} = 1; } } close KEEPME;