From f6cab967485efb691a316b5c2cd1df62a1fe6d20 Mon Sep 17 00:00:00 2001 From: mid-kid Date: Thu, 4 Jan 2024 18:07:16 +0100 Subject: [PATCH] Initial commit --- check.sh | 3 ++ orphans.sh | 16 ++++++ orphans_ignore.txt | 23 +++++++++ orphans_ignore/app-vim_gentoo-syntax.txt | 3 ++ orphans_ignore/dev-lang_mono.txt | 2 + orphans_ignore/dev-lang_perl.txt | 39 +++++++++++++++ orphans_ignore/dev-libs_nss.txt | 3 ++ orphans_ignore/dev-perl_XML-SAX.txt | 1 + orphans_ignore/dev-perl_libwww-perl.txt | 3 ++ orphans_ignore/eselect_arptables.txt | 1 + orphans_ignore/eselect_binutils.txt | 57 ++++++++++++++++++++++ orphans_ignore/eselect_compiler-shadow.txt | 3 ++ orphans_ignore/eselect_ctags.txt | 2 + orphans_ignore/eselect_ebtables.txt | 3 ++ orphans_ignore/eselect_gcc.txt | 30 ++++++++++++ orphans_ignore/eselect_iptables.txt | 7 +++ orphans_ignore/eselect_lua.txt | 4 ++ orphans_ignore/eselect_notify-send.txt | 1 + orphans_ignore/eselect_pinentry.txt | 1 + orphans_ignore/eselect_python.txt | 1 + orphans_ignore/eselect_rust.txt | 11 +++++ orphans_ignore/eselect_vi.txt | 6 +++ orphans_ignore/media-gfx_graphviz.txt | 1 + orphans_ignore/sys-apps_gawk.txt | 1 + orphans_ignore/sys-apps_openrc.txt | 3 ++ orphans_ignore/sys-libs_glibc.txt | 1 + 26 files changed, 226 insertions(+) create mode 100755 check.sh create mode 100755 orphans.sh create mode 100644 orphans_ignore.txt create mode 100644 orphans_ignore/app-vim_gentoo-syntax.txt create mode 100644 orphans_ignore/dev-lang_mono.txt create mode 100644 orphans_ignore/dev-lang_perl.txt create mode 100644 orphans_ignore/dev-libs_nss.txt create mode 100644 orphans_ignore/dev-perl_XML-SAX.txt create mode 100644 orphans_ignore/dev-perl_libwww-perl.txt create mode 100644 orphans_ignore/eselect_arptables.txt create mode 100644 orphans_ignore/eselect_binutils.txt create mode 100644 orphans_ignore/eselect_compiler-shadow.txt create mode 100644 orphans_ignore/eselect_ctags.txt create mode 100644 orphans_ignore/eselect_ebtables.txt create mode 100644 orphans_ignore/eselect_gcc.txt create mode 100644 orphans_ignore/eselect_iptables.txt create mode 100644 orphans_ignore/eselect_lua.txt create mode 100644 orphans_ignore/eselect_notify-send.txt create mode 100644 orphans_ignore/eselect_pinentry.txt create mode 100644 orphans_ignore/eselect_python.txt create mode 100644 orphans_ignore/eselect_rust.txt create mode 100644 orphans_ignore/eselect_vi.txt create mode 100644 orphans_ignore/media-gfx_graphviz.txt create mode 100644 orphans_ignore/sys-apps_gawk.txt create mode 100644 orphans_ignore/sys-apps_openrc.txt create mode 100644 orphans_ignore/sys-libs_glibc.txt diff --git a/check.sh b/check.sh new file mode 100755 index 0000000..04904fb --- /dev/null +++ b/check.sh @@ -0,0 +1,3 @@ +#!/bin/sh +# Check the files in the filesystem against what is recorded in the package database +qcheck -vPB | tee check.txt diff --git a/orphans.sh b/orphans.sh new file mode 100755 index 0000000..a3965d7 --- /dev/null +++ b/orphans.sh @@ -0,0 +1,16 @@ +#!/bin/sh +# Scan the filesystem for orphaned/unused files (super slow because portage-utils doesn't accept stdin) +# Note that this files a *lot* of pre/postinstall files that should(!) exist +tmp1="$(mktemp)" +tmp2="$(mktemp)" +trap "rm -f '$tmp1' '$tmp2'" EXIT + +cat orphans_ignore.txt orphans_ignore/*.txt | grep '^/' | sort > "$tmp1" +find /bin /sbin /lib /lib64 /usr > "$tmp2" + +grep -xvf "$tmp1" "$tmp2" | xargs -P$(nproc) -d '\n' qfile -o | tee orphans.txt +grep -Fxvf "$tmp2" "$tmp1" | grep -v '\*' | tee orphans_missing.txt + +#find /etc | \ + #grep -xvf "$tmp" | \ + #xargs -P$(nproc) -d '\n' qfile -o | tee orphans.txt diff --git a/orphans_ignore.txt b/orphans_ignore.txt new file mode 100644 index 0000000..a67d26d --- /dev/null +++ b/orphans_ignore.txt @@ -0,0 +1,23 @@ +/lib/modules +/lib/modules/.* +/lib/rc/cache +/lib/rc/cache/.* +/usr/lib/locale/locale-archive +/usr/local +/usr/local/.* +/usr/portage +/usr/portage/.* +/usr/share/applications/mimeinfo.cache +/usr/share/binutils-data/[^/]*/[^/]*/info/dir +/usr/share/fonts/.*\.uuid +/usr/share/fonts/[^/]*/encodings.dir +/usr/share/fonts/[^/]*/fonts.dir +/usr/share/fonts/[^/]*/fonts.scale +/usr/share/gcc-data/[^/]*/[^/]*/info/dir +/usr/share/icons/[^/]*/icon-theme.cache +/usr/share/info/dir +/usr/share/mime +/usr/share/mime/.* +/usr/src +/usr/src/.* +/usr/tmp diff --git a/orphans_ignore/app-vim_gentoo-syntax.txt b/orphans_ignore/app-vim_gentoo-syntax.txt new file mode 100644 index 0000000..91a9764 --- /dev/null +++ b/orphans_ignore/app-vim_gentoo-syntax.txt @@ -0,0 +1,3 @@ +/usr/share/vim/vim90/doc/gentoo-syntax.txt +/usr/share/vim/vim90/doc/tags +/usr/share/vim/vim90/doc/eselect-syntax.txt diff --git a/orphans_ignore/dev-lang_mono.txt b/orphans_ignore/dev-lang_mono.txt new file mode 100644 index 0000000..323b61c --- /dev/null +++ b/orphans_ignore/dev-lang_mono.txt @@ -0,0 +1,2 @@ +/usr/share/.mono +/usr/share/.mono/.* diff --git a/orphans_ignore/dev-lang_perl.txt b/orphans_ignore/dev-lang_perl.txt new file mode 100644 index 0000000..a92ba62 --- /dev/null +++ b/orphans_ignore/dev-lang_perl.txt @@ -0,0 +1,39 @@ +/usr/bin/corelist +/usr/bin/cpan +/usr/bin/enc2xs +/usr/bin/instmodsh +/usr/bin/json_pp +/usr/bin/perldoc +/usr/bin/piconv +/usr/bin/pod2man +/usr/bin/pod2text +/usr/bin/pod2usage +/usr/bin/podchecker +/usr/bin/podselect +/usr/bin/prove +/usr/bin/ptar +/usr/bin/ptardiff +/usr/bin/ptargrep +/usr/bin/shasum +/usr/bin/xsubpp +/usr/bin/zipdetails +/usr/share/man/man1/corelist.1.bz2 +/usr/share/man/man1/cpan.1.bz2 +/usr/share/man/man1/enc2xs.1.bz2 +/usr/share/man/man1/instmodsh.1.bz2 +/usr/share/man/man1/json_pp.1.bz2 +/usr/share/man/man1/perldoc.1.bz2 +/usr/share/man/man1/perlpodstyle.1.bz2 +/usr/share/man/man1/piconv.1.bz2 +/usr/share/man/man1/pod2man.1.bz2 +/usr/share/man/man1/pod2text.1.bz2 +/usr/share/man/man1/pod2usage.1.bz2 +/usr/share/man/man1/podchecker.1.bz2 +/usr/share/man/man1/podselect.1.bz2 +/usr/share/man/man1/prove.1.bz2 +/usr/share/man/man1/ptar.1.bz2 +/usr/share/man/man1/ptardiff.1.bz2 +/usr/share/man/man1/ptargrep.1.bz2 +/usr/share/man/man1/shasum.1.bz2 +/usr/share/man/man1/xsubpp.1.bz2 +/usr/share/man/man1/zipdetails.1.bz2 diff --git a/orphans_ignore/dev-libs_nss.txt b/orphans_ignore/dev-libs_nss.txt new file mode 100644 index 0000000..f6b1fca --- /dev/null +++ b/orphans_ignore/dev-libs_nss.txt @@ -0,0 +1,3 @@ +/usr/lib64/libnssdbm3.chk +/usr/lib64/libsoftokn3.chk +/usr/lib64/libfreebl3.chk diff --git a/orphans_ignore/dev-perl_XML-SAX.txt b/orphans_ignore/dev-perl_XML-SAX.txt new file mode 100644 index 0000000..3c423ec --- /dev/null +++ b/orphans_ignore/dev-perl_XML-SAX.txt @@ -0,0 +1 @@ +/usr/lib64/perl5/vendor_perl/[^/]*/XML/SAX/ParserDetails.ini diff --git a/orphans_ignore/dev-perl_libwww-perl.txt b/orphans_ignore/dev-perl_libwww-perl.txt new file mode 100644 index 0000000..6897500 --- /dev/null +++ b/orphans_ignore/dev-perl_libwww-perl.txt @@ -0,0 +1,3 @@ +/usr/bin/HEAD +/usr/bin/POST +/usr/bin/GET diff --git a/orphans_ignore/eselect_arptables.txt b/orphans_ignore/eselect_arptables.txt new file mode 100644 index 0000000..88c4adc --- /dev/null +++ b/orphans_ignore/eselect_arptables.txt @@ -0,0 +1 @@ +/sbin/arptables diff --git a/orphans_ignore/eselect_binutils.txt b/orphans_ignore/eselect_binutils.txt new file mode 100644 index 0000000..b427095 --- /dev/null +++ b/orphans_ignore/eselect_binutils.txt @@ -0,0 +1,57 @@ +/usr/bin/addr2line +/usr/bin/ar +/usr/bin/as +/usr/bin/c++filt +/usr/bin/dwp +/usr/bin/elfedit +/usr/bin/gprof +/usr/bin/ld +/usr/bin/ld.bfd +/usr/bin/ld.gold +/usr/bin/nm +/usr/bin/objcopy +/usr/bin/objdump +/usr/bin/ranlib +/usr/bin/readelf +/usr/bin/size +/usr/bin/strings +/usr/bin/strip +/usr/bin/x86_64-pc-linux-gnu-addr2line +/usr/bin/x86_64-pc-linux-gnu-ar +/usr/bin/x86_64-pc-linux-gnu-as +/usr/bin/x86_64-pc-linux-gnu-c++filt +/usr/bin/x86_64-pc-linux-gnu-dwp +/usr/bin/x86_64-pc-linux-gnu-elfedit +/usr/bin/x86_64-pc-linux-gnu-gprof +/usr/bin/x86_64-pc-linux-gnu-ld +/usr/bin/x86_64-pc-linux-gnu-ld.bfd +/usr/bin/x86_64-pc-linux-gnu-ld.gold +/usr/bin/x86_64-pc-linux-gnu-nm +/usr/bin/x86_64-pc-linux-gnu-objcopy +/usr/bin/x86_64-pc-linux-gnu-objdump +/usr/bin/x86_64-pc-linux-gnu-ranlib +/usr/bin/x86_64-pc-linux-gnu-readelf +/usr/bin/x86_64-pc-linux-gnu-size +/usr/bin/x86_64-pc-linux-gnu-strings +/usr/bin/x86_64-pc-linux-gnu-strip +/usr/x86_64-pc-linux-gnu/bin +/usr/x86_64-pc-linux-gnu/bin/addr2line +/usr/x86_64-pc-linux-gnu/bin/ar +/usr/x86_64-pc-linux-gnu/bin/as +/usr/x86_64-pc-linux-gnu/bin/c++filt +/usr/x86_64-pc-linux-gnu/bin/dwp +/usr/x86_64-pc-linux-gnu/bin/elfedit +/usr/x86_64-pc-linux-gnu/bin/gprof +/usr/x86_64-pc-linux-gnu/bin/ld +/usr/x86_64-pc-linux-gnu/bin/ld.bfd +/usr/x86_64-pc-linux-gnu/bin/ld.gold +/usr/x86_64-pc-linux-gnu/bin/nm +/usr/x86_64-pc-linux-gnu/bin/objcopy +/usr/x86_64-pc-linux-gnu/bin/objdump +/usr/x86_64-pc-linux-gnu/bin/ranlib +/usr/x86_64-pc-linux-gnu/bin/readelf +/usr/x86_64-pc-linux-gnu/bin/size +/usr/x86_64-pc-linux-gnu/bin/strings +/usr/x86_64-pc-linux-gnu/bin/strip +/usr/x86_64-pc-linux-gnu/lib +/usr/x86_64-pc-linux-gnu/lib/ldscripts diff --git a/orphans_ignore/eselect_compiler-shadow.txt b/orphans_ignore/eselect_compiler-shadow.txt new file mode 100644 index 0000000..6a2d386 --- /dev/null +++ b/orphans_ignore/eselect_compiler-shadow.txt @@ -0,0 +1,3 @@ +/usr/lib/ccache +/usr/lib/ccache/bin +/usr/lib/ccache/bin/.* diff --git a/orphans_ignore/eselect_ctags.txt b/orphans_ignore/eselect_ctags.txt new file mode 100644 index 0000000..e35006c --- /dev/null +++ b/orphans_ignore/eselect_ctags.txt @@ -0,0 +1,2 @@ +/usr/bin/ctags +/usr/share/man/man1/ctags.1.bz2 diff --git a/orphans_ignore/eselect_ebtables.txt b/orphans_ignore/eselect_ebtables.txt new file mode 100644 index 0000000..3b2b6db --- /dev/null +++ b/orphans_ignore/eselect_ebtables.txt @@ -0,0 +1,3 @@ +/sbin/ebtables-save +/sbin/ebtables-restore +/sbin/ebtables diff --git a/orphans_ignore/eselect_gcc.txt b/orphans_ignore/eselect_gcc.txt new file mode 100644 index 0000000..4e96fdd --- /dev/null +++ b/orphans_ignore/eselect_gcc.txt @@ -0,0 +1,30 @@ +/lib/cpp +/usr/bin/c++ +/usr/bin/cc +/usr/bin/cpp +/usr/bin/g++ +/usr/bin/gcc +/usr/bin/gcc-ar +/usr/bin/gcc-nm +/usr/bin/gcc-ranlib +/usr/bin/gcov +/usr/bin/gcov-dump +/usr/bin/gcov-tool +/usr/bin/gfortran +/usr/bin/lto-dump +/usr/bin/x86_64-pc-linux-gnu-c++ +/usr/bin/x86_64-pc-linux-gnu-cc +/usr/bin/x86_64-pc-linux-gnu-cpp +/usr/bin/x86_64-pc-linux-gnu-g++ +/usr/bin/x86_64-pc-linux-gnu-gcc +/usr/bin/x86_64-pc-linux-gnu-gcc-ar +/usr/bin/x86_64-pc-linux-gnu-gcc-nm +/usr/bin/x86_64-pc-linux-gnu-gcc-ranlib +/usr/bin/x86_64-pc-linux-gnu-gcov +/usr/bin/x86_64-pc-linux-gnu-gcov-dump +/usr/bin/x86_64-pc-linux-gnu-gcov-tool +/usr/bin/x86_64-pc-linux-gnu-gfortran +/usr/bin/x86_64-pc-linux-gnu-lto-dump +/usr/x86_64-pc-linux-gnu/binutils-bin/lib +/usr/x86_64-pc-linux-gnu/binutils-bin/lib/bfd-plugins +/usr/x86_64-pc-linux-gnu/binutils-bin/lib/bfd-plugins/liblto_plugin.so diff --git a/orphans_ignore/eselect_iptables.txt b/orphans_ignore/eselect_iptables.txt new file mode 100644 index 0000000..bf9feba --- /dev/null +++ b/orphans_ignore/eselect_iptables.txt @@ -0,0 +1,7 @@ +/sbin/ip6tables +/sbin/ip6tables-restore +/sbin/ip6tables-save +/sbin/iptables +/sbin/iptables-restore +/sbin/iptables-save +/sbin/iptables-xml diff --git a/orphans_ignore/eselect_lua.txt b/orphans_ignore/eselect_lua.txt new file mode 100644 index 0000000..a4c8b5c --- /dev/null +++ b/orphans_ignore/eselect_lua.txt @@ -0,0 +1,4 @@ +/usr/bin/lua +/usr/bin/luac +/usr/share/man/man1/lua.1.bz2 +/usr/share/man/man1/luac.1.bz2 diff --git a/orphans_ignore/eselect_notify-send.txt b/orphans_ignore/eselect_notify-send.txt new file mode 100644 index 0000000..4075ec4 --- /dev/null +++ b/orphans_ignore/eselect_notify-send.txt @@ -0,0 +1 @@ +/usr/bin/notify-send diff --git a/orphans_ignore/eselect_pinentry.txt b/orphans_ignore/eselect_pinentry.txt new file mode 100644 index 0000000..800b21c --- /dev/null +++ b/orphans_ignore/eselect_pinentry.txt @@ -0,0 +1 @@ +/usr/bin/pinentry diff --git a/orphans_ignore/eselect_python.txt b/orphans_ignore/eselect_python.txt new file mode 100644 index 0000000..c1128fe --- /dev/null +++ b/orphans_ignore/eselect_python.txt @@ -0,0 +1 @@ +/usr/share/man/man1/python.1 diff --git a/orphans_ignore/eselect_rust.txt b/orphans_ignore/eselect_rust.txt new file mode 100644 index 0000000..4982ba7 --- /dev/null +++ b/orphans_ignore/eselect_rust.txt @@ -0,0 +1,11 @@ +/usr/bin/cargo +/usr/bin/rust-gdb +/usr/bin/rust-gdbgui +/usr/bin/rust-lldb +/usr/bin/rustc +/usr/bin/rustdoc +/usr/lib/rust/lib +/usr/lib/rust/libexec +/usr/lib/rust/man +/usr/lib/rustlib +/usr/share/doc/rust diff --git a/orphans_ignore/eselect_vi.txt b/orphans_ignore/eselect_vi.txt new file mode 100644 index 0000000..41fd8ef --- /dev/null +++ b/orphans_ignore/eselect_vi.txt @@ -0,0 +1,6 @@ +/usr/bin/ex +/usr/bin/vi +/usr/bin/view +/usr/share/man/man1/ex.1.bz2 +/usr/share/man/man1/vi.1.bz2 +/usr/share/man/man1/view.1.bz2 diff --git a/orphans_ignore/media-gfx_graphviz.txt b/orphans_ignore/media-gfx_graphviz.txt new file mode 100644 index 0000000..e0b5d71 --- /dev/null +++ b/orphans_ignore/media-gfx_graphviz.txt @@ -0,0 +1 @@ +/usr/lib64/graphviz/config6 diff --git a/orphans_ignore/sys-apps_gawk.txt b/orphans_ignore/sys-apps_gawk.txt new file mode 100644 index 0000000..e98dc96 --- /dev/null +++ b/orphans_ignore/sys-apps_gawk.txt @@ -0,0 +1 @@ +/usr/share/man/man1/awk.1.bz2 diff --git a/orphans_ignore/sys-apps_openrc.txt b/orphans_ignore/sys-apps_openrc.txt new file mode 100644 index 0000000..c00c3d5 --- /dev/null +++ b/orphans_ignore/sys-apps_openrc.txt @@ -0,0 +1,3 @@ +/lib/rc/console +/lib/rc/console/keymap +/lib/rc/console/unicode diff --git a/orphans_ignore/sys-libs_glibc.txt b/orphans_ignore/sys-libs_glibc.txt new file mode 100644 index 0000000..439600d --- /dev/null +++ b/orphans_ignore/sys-libs_glibc.txt @@ -0,0 +1 @@ +/usr/lib64/gconv/gconv-modules.cache