elvish_config/aliases/checklinks.elv

40 lines
882 B
Plaintext
Raw Normal View History

2021-11-15 20:20:43 +00:00
use str
fn -check [f]{
var @missings = (try {
sudo ldd $f 2>/dev/null | grep 'not found' | eawk [_ m @_]{ put $m }
} except e {
})
if (> (count $missings) 1) {
var p = (LC_ALL=C pacman -Qo $f)
echo $p' seem broken: missing '(str:join ', ' $missings)
}
}
fn -check-executable [f]{
if ?(test -x $f) {
-check $f
}
}
fn -cbin []{
echo (styled 'Searching broken binaries…' bold bright-yellow)
sudo find /usr/bin -maxdepth 1 -type f 2>/dev/null | each $-check~
}
fn -clib []{
echo (styled 'Searching broken libs…' bold bright-yellow)
sudo find /usr/lib/*.so* -maxdepth 1 -type f 2>/dev/null | each $-check-executable~
}
fn -copt []{
echo (styled 'Searching broken binariess in opt…' bold bright-yellow)
sudo find /opt -maxdepth 3 -type f 2>/dev/null | each $-check-executable~
}
edit:add-var checklinks~ []{
-cbin
-clib
-copt
}