2021-11-15 20:20:43 +00:00
|
|
|
use str
|
|
|
|
|
2021-12-11 21:09:02 +00:00
|
|
|
fn -check {|f|
|
2021-12-27 17:54:26 +00:00
|
|
|
use str
|
2021-11-15 20:20:43 +00:00
|
|
|
var @missings = (try {
|
2021-12-11 21:09:02 +00:00
|
|
|
sudo ldd $f 2>/dev/null | grep 'not found' | eawk {|_ m @_| put $m }
|
2022-03-20 17:29:23 +00:00
|
|
|
} catch e {
|
2021-11-15 20:20:43 +00:00
|
|
|
})
|
|
|
|
if (> (count $missings) 1) {
|
2022-03-20 17:29:23 +00:00
|
|
|
var p = (tmp E:LC_ALL = C; pacman -Qo $f)
|
2021-12-27 17:54:26 +00:00
|
|
|
printf "%s seem broken: missing %s\n" $p (str:join ', ' $missings)
|
2021-11-15 20:20:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-12-11 21:09:02 +00:00
|
|
|
fn -check-executable {|f|
|
2021-11-15 20:20:43 +00:00
|
|
|
if ?(test -x $f) {
|
|
|
|
-check $f
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-12-11 21:09:02 +00:00
|
|
|
fn -cbin {||
|
2021-11-15 20:20:43 +00:00
|
|
|
echo (styled 'Searching broken binaries…' bold bright-yellow)
|
|
|
|
sudo find /usr/bin -maxdepth 1 -type f 2>/dev/null | each $-check~
|
|
|
|
}
|
|
|
|
|
2021-12-11 21:09:02 +00:00
|
|
|
fn -clib {||
|
2021-11-15 20:20:43 +00:00
|
|
|
echo (styled 'Searching broken libs…' bold bright-yellow)
|
|
|
|
sudo find /usr/lib/*.so* -maxdepth 1 -type f 2>/dev/null | each $-check-executable~
|
|
|
|
}
|
|
|
|
|
2021-12-11 21:09:02 +00:00
|
|
|
fn -copt {||
|
2021-11-15 20:20:43 +00:00
|
|
|
echo (styled 'Searching broken binariess in opt…' bold bright-yellow)
|
|
|
|
sudo find /opt -maxdepth 3 -type f 2>/dev/null | each $-check-executable~
|
|
|
|
}
|
|
|
|
|
2021-12-11 21:09:02 +00:00
|
|
|
edit:add-var checklinks~ {||
|
2021-11-15 20:20:43 +00:00
|
|
|
-cbin
|
|
|
|
-clib
|
|
|
|
-copt
|
|
|
|
}
|