Compare commits
3 Commits
79dbac7647
...
c749f5c595
Author | SHA1 | Date | |
---|---|---|---|
|
c749f5c595 | ||
56a8fc12d4 | |||
15a8fcc3f3 |
@ -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
|
||||
|
@ -29,6 +29,6 @@ affected ports using
|
||||
.B prt\-get update \-fr
|
||||
(see \fBprt\-get\fP(8) for more detailed examples).
|
||||
.SH AUTHORS
|
||||
Jukka Heino <jukka@karsikkopuu.net>
|
||||
Jukka Heino <jukka@karsikkopuu.net>, John McQuah <jmcquah@disroot.org>
|
||||
.SH SEE ALSO
|
||||
\fBprt\-cache\fP(8), \fBprt\-get\fP(8), \fBPkgfile\fP(5), \fBrevdep\fP(1)
|
||||
|
@ -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;
|
||||
|
@ -12,6 +12,7 @@
|
||||
#
|
||||
|
||||
PRT_GET=prt-cache
|
||||
RECHECK=1
|
||||
|
||||
if [ $UID = 0 ]; then
|
||||
PKGRM=pkgrm
|
||||
@ -32,35 +33,29 @@ if [ ! -f "$CONF" ]; then
|
||||
touch "$CONF"
|
||||
fi
|
||||
|
||||
echo "Checking packages for orphans..."
|
||||
|
||||
while true ; do
|
||||
while [ $RECHECK = 1 ] ; do
|
||||
echo
|
||||
echo "(Re-)checking packages for orphans..."
|
||||
RECHECK=0
|
||||
|
||||
orphans=$(comm -23 <($PRT_GET listorphans | sort) \
|
||||
mapfile -t orphans < <(comm -23 <($PRT_GET listorphans | sort) \
|
||||
<(cat <(find "$BASE" -maxdepth 1 -type d -printf "%f\n") "$CONF" \
|
||||
| sort -u) | tr '\n' ' ')
|
||||
| sort -u) )
|
||||
|
||||
for PACKAGE in ${orphans[@]}; do
|
||||
echo
|
||||
$PRT_GET info $PACKAGE
|
||||
$PRT_GET info "$PACKAGE"
|
||||
echo
|
||||
|
||||
echo -n "Uninstall $PACKAGE? (y/N) "
|
||||
read ANSWER
|
||||
read -r ANSWER
|
||||
|
||||
if [ "$ANSWER" = "y" ] ; then
|
||||
$PKGRM $PACKAGE
|
||||
$PKGRM "$PACKAGE"
|
||||
RECHECK=1
|
||||
else
|
||||
echo $PACKAGE >> "$CONF"
|
||||
echo "$PACKAGE" >> "$CONF"
|
||||
fi
|
||||
done
|
||||
|
||||
if [ "$RECHECK" = "0" ] ; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "Re-checking packages for new orphans..."
|
||||
done
|
||||
|
@ -41,13 +41,13 @@ my @basedirs = @{$bldirs[0]}; my @localports = @{$bldirs[1]};
|
||||
|
||||
get_locked_and_aliased();
|
||||
|
||||
if (($action !~ /^(fsearch|isinst|current)$/) and ($osearch{cache}==0)) {
|
||||
if (($action !~ /^(fsearch|isinst|current|sync)$/) and ($osearch{cache}==0)) {
|
||||
@allports = list_ports();
|
||||
fill_hashes_from_pkgfiles();
|
||||
}
|
||||
if ($osearch{cache}==1) { fill_hashes_from_cache(); }
|
||||
|
||||
if ($action !~ /^(search|dsearch|fsearch|info|dup|ls|readme|cat)$/) {
|
||||
if ($action !~ /^(search|dsearch|fsearch|info|dup|ls|readme|cat|sync)$/) {
|
||||
open (DB, "$altroot$pkgdb") or die "Could not open package database!\n";
|
||||
local $/="";
|
||||
while (<DB>) { $V_INST{$1} = $2 if m/^(.*)\n(.*)\n/; }
|
||||
@ -75,6 +75,7 @@ if ($action eq "path") { @results = find_port_by_name($query[0],1,1,0);
|
||||
} elsif ($action eq "install") { @results = up_inst(@query);
|
||||
} elsif ($action eq "dup") { $ind=find_dups(@query);
|
||||
} elsif ($action eq "remove") { $ind=uninstall(@query);
|
||||
} elsif ($action eq "sync") { sync(@query);
|
||||
} elsif ($action =~ /^(isinst|current|sysup)$/) { ($ind, @results) = port_diff($1,@query);
|
||||
} elsif ($action =~ /(.*)diff$/) { ($ind, @results) = port_diff($1);
|
||||
} elsif ($action =~ /^list(.*)/) { @results = list_ports($1);
|
||||
@ -202,7 +203,7 @@ while (my $arg = shift) {
|
||||
} elsif ($arg =~ /^(lock|unlock|listlocked|current|isinst)$/) { $action = $1;
|
||||
} elsif ($arg =~ /^(diff|quickdiff|printf|listinst|listorphans)$/) {
|
||||
$action = $1; $odepends{tree} = 0;
|
||||
} elsif ($arg =~ /^(depends|quickdep|dup|dependent)$/) { $action = $1;
|
||||
} elsif ($arg =~ /^(depends|quickdep|dup|dependent|sync)$/) { $action = $1;
|
||||
} elsif ($arg eq "deptree") { $action = $arg; $odepends{tree} = 1;
|
||||
} elsif ($arg =~ /^(readme|cat|edit|ls|help|version|cache)$/) { $action = $1;
|
||||
} elsif ($arg eq "--tree") { $odepends{tree} = 1;
|
||||
@ -297,6 +298,33 @@ while (<PORTS>) { chomp;
|
||||
return \@basedirs, \@localports;
|
||||
}
|
||||
|
||||
sub sync {
|
||||
my $sup_path = "/etc/ports";
|
||||
my @OPT_COLLECTIONS=@_; my @drivers;
|
||||
opendir(my $drv, "$sup_path/drivers") or return;
|
||||
foreach my $d (sort(readdir($drv))) {
|
||||
next if ($d =~ /^\./) or (! -x "$sup_path/drivers/$d");
|
||||
push @drivers, $d;
|
||||
}
|
||||
closedir($drv);
|
||||
if ($#OPT_COLLECTIONS >= 0) { # Update selected collections
|
||||
foreach my $coll (@OPT_COLLECTIONS) {
|
||||
if (! glob("$sup_path/$coll.*")) {
|
||||
print("$coll not configured in $sup_path!\n"); next;
|
||||
}
|
||||
foreach my $suffix (@drivers) {
|
||||
system("$sup_path/drivers/$suffix","$sup_path/$coll.$suffix") if (-f "$sup_path/$coll.$suffix");
|
||||
}
|
||||
}
|
||||
} else { # Update all collections
|
||||
foreach my $driver (@drivers) {
|
||||
while (my $active = glob("$sup_path/*.$driver")) {
|
||||
system("$sup_path/drivers/$driver",$active);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub find_dups {
|
||||
my %seen; my $format=shift; my @dupinfo; my @info1; my $dupstr; my @hits;
|
||||
foreach my $pp (@allports) { my $pn = (split /\//, $pp)[-1]; $seen{$pn}++; }
|
||||
|
Loading…
Reference in New Issue
Block a user