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
|
.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
|
||||||
|
@ -29,6 +29,6 @@ affected ports using
|
|||||||
.B prt\-get update \-fr
|
.B prt\-get update \-fr
|
||||||
(see \fBprt\-get\fP(8) for more detailed examples).
|
(see \fBprt\-get\fP(8) for more detailed examples).
|
||||||
.SH AUTHORS
|
.SH AUTHORS
|
||||||
Jukka Heino <jukka@karsikkopuu.net>
|
Jukka Heino <jukka@karsikkopuu.net>, John McQuah <jmcquah@disroot.org>
|
||||||
.SH SEE ALSO
|
.SH SEE ALSO
|
||||||
\fBprt\-cache\fP(8), \fBprt\-get\fP(8), \fBPkgfile\fP(5), \fBrevdep\fP(1)
|
\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
|
# 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;
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
PRT_GET=prt-cache
|
PRT_GET=prt-cache
|
||||||
|
RECHECK=1
|
||||||
|
|
||||||
if [ $UID = 0 ]; then
|
if [ $UID = 0 ]; then
|
||||||
PKGRM=pkgrm
|
PKGRM=pkgrm
|
||||||
@ -32,35 +33,29 @@ if [ ! -f "$CONF" ]; then
|
|||||||
touch "$CONF"
|
touch "$CONF"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Checking packages for orphans..."
|
while [ $RECHECK = 1 ] ; do
|
||||||
|
echo
|
||||||
while true ; do
|
echo "(Re-)checking packages for orphans..."
|
||||||
RECHECK=0
|
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" \
|
<(cat <(find "$BASE" -maxdepth 1 -type d -printf "%f\n") "$CONF" \
|
||||||
| sort -u) | tr '\n' ' ')
|
| sort -u) )
|
||||||
|
|
||||||
for PACKAGE in ${orphans[@]}; do
|
for PACKAGE in ${orphans[@]}; do
|
||||||
echo
|
echo
|
||||||
$PRT_GET info $PACKAGE
|
$PRT_GET info "$PACKAGE"
|
||||||
echo
|
echo
|
||||||
|
|
||||||
echo -n "Uninstall $PACKAGE? (y/N) "
|
echo -n "Uninstall $PACKAGE? (y/N) "
|
||||||
read ANSWER
|
read -r ANSWER
|
||||||
|
|
||||||
if [ "$ANSWER" = "y" ] ; then
|
if [ "$ANSWER" = "y" ] ; then
|
||||||
$PKGRM $PACKAGE
|
$PKGRM "$PACKAGE"
|
||||||
RECHECK=1
|
RECHECK=1
|
||||||
else
|
else
|
||||||
echo $PACKAGE >> "$CONF"
|
echo "$PACKAGE" >> "$CONF"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ "$RECHECK" = "0" ] ; then
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo
|
|
||||||
echo "Re-checking packages for new orphans..."
|
|
||||||
done
|
done
|
||||||
|
@ -41,13 +41,13 @@ my @basedirs = @{$bldirs[0]}; my @localports = @{$bldirs[1]};
|
|||||||
|
|
||||||
get_locked_and_aliased();
|
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();
|
@allports = list_ports();
|
||||||
fill_hashes_from_pkgfiles();
|
fill_hashes_from_pkgfiles();
|
||||||
}
|
}
|
||||||
if ($osearch{cache}==1) { fill_hashes_from_cache(); }
|
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";
|
open (DB, "$altroot$pkgdb") or die "Could not open package database!\n";
|
||||||
local $/="";
|
local $/="";
|
||||||
while (<DB>) { $V_INST{$1} = $2 if m/^(.*)\n(.*)\n/; }
|
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 "install") { @results = up_inst(@query);
|
||||||
} elsif ($action eq "dup") { $ind=find_dups(@query);
|
} elsif ($action eq "dup") { $ind=find_dups(@query);
|
||||||
} elsif ($action eq "remove") { $ind=uninstall(@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 =~ /^(isinst|current|sysup)$/) { ($ind, @results) = port_diff($1,@query);
|
||||||
} elsif ($action =~ /(.*)diff$/) { ($ind, @results) = port_diff($1);
|
} elsif ($action =~ /(.*)diff$/) { ($ind, @results) = port_diff($1);
|
||||||
} elsif ($action =~ /^list(.*)/) { @results = list_ports($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 =~ /^(lock|unlock|listlocked|current|isinst)$/) { $action = $1;
|
||||||
} elsif ($arg =~ /^(diff|quickdiff|printf|listinst|listorphans)$/) {
|
} elsif ($arg =~ /^(diff|quickdiff|printf|listinst|listorphans)$/) {
|
||||||
$action = $1; $odepends{tree} = 0;
|
$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 eq "deptree") { $action = $arg; $odepends{tree} = 1;
|
||||||
} elsif ($arg =~ /^(readme|cat|edit|ls|help|version|cache)$/) { $action = $1;
|
} elsif ($arg =~ /^(readme|cat|edit|ls|help|version|cache)$/) { $action = $1;
|
||||||
} elsif ($arg eq "--tree") { $odepends{tree} = 1;
|
} elsif ($arg eq "--tree") { $odepends{tree} = 1;
|
||||||
@ -297,6 +298,33 @@ while (<PORTS>) { chomp;
|
|||||||
return \@basedirs, \@localports;
|
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 {
|
sub find_dups {
|
||||||
my %seen; my $format=shift; my @dupinfo; my @info1; my $dupstr; my @hits;
|
my %seen; my $format=shift; my @dupinfo; my @info1; my $dupstr; my @hits;
|
||||||
foreach my $pp (@allports) { my $pn = (split /\//, $pp)[-1]; $seen{$pn}++; }
|
foreach my $pp (@allports) { my $pn = (split /\//, $pp)[-1]; $seen{$pn}++; }
|
||||||
|
Loading…
Reference in New Issue
Block a user