diff options
| author | B. Watson <urchlay@slackware.uk> | 2026-09-19 19:55:36 -0400 |
|---|---|---|
| committer | B. Watson <urchlay@slackware.uk> | 2026-09-19 19:55:36 -0400 |
| commit | 56a58819e725b0e7b3b8421604bff101c5732403 (patch) | |
| tree | ff36619d11c14daa9371564b3d3daf56f1598459 /find_installed_orphans | |
| parent | 9bb196b9271332eb7de4b2eed183a9f10bd36a24 (diff) | |
| download | sbo-maintainer-tools-56a58819e725b0e7b3b8421604bff101c5732403.tar.gz | |
find_installed_orphans: added.
Diffstat (limited to 'find_installed_orphans')
| -rwxr-xr-x | find_installed_orphans | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/find_installed_orphans b/find_installed_orphans new file mode 100755 index 0000000..1b1b1d9 --- /dev/null +++ b/find_installed_orphans @@ -0,0 +1,41 @@ +#!/usr/bin/perl -w + +($SELF = $0) =~ s,.*/,,; +if(@ARGV) { + print <<EOF; +$SELF - find installed SBo orphan packages + +Usage: $SELF + +Output is a list of installed SBo packages that are listed as +orphans on the SBo site. + +Exit status is 0 (success) if no orphans are installed (if there +is no output), or 1 (failure) if any orphans are installed. + +To use an alternate package database directory (other than +/var/log/packages), set PKGDIR in the environment. +EOF + exit 0; +} + +$URL = 'https://slackbuilds.org/advsearch.php?stype=maint&q=NOEMAIL'; + +$PKGDIR = $ENV{PKGDIR} || "/var/log/packages"; +chdir $PKGDIR || die "can't cd to $PKGDIR: $!\n"; + +for(<*_SBo>) { + my $r = reverse; + my @a = split /-/, $r, 4; + my $pkg = reverse $a[3]; + $installed{$pkg}++; +} + +open my $pipe, "-|", "wget", "-qO-", "$URL" or die $!; +while(<$pipe>) { + next unless m{a href="/repository/[\d.]+/\w+/(\S+)/">}; + $count++; + print "$1\n" if $installed{$1}; +} + +exit ($count != 0); |
