Ajout de checklinks

This commit is contained in:
Benjamin VAUDOUR 2021-11-15 21:20:43 +01:00
parent 657e9583bf
commit 91b807267f
1 changed files with 39 additions and 0 deletions

39
aliases/checklinks.elv Normal file
View File

@ -0,0 +1,39 @@
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
}