2024-02-11 18:37:36 +00:00
|
|
|
use re
|
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 {
|
2024-02-11 18:37:36 +00:00
|
|
|
doas ldd $f 2>/dev/null | grep 'not found' | re:awk {|_ 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)
|
2022-08-09 11:32:42 +00:00
|
|
|
doas find /usr/bin -maxdepth 1 -type f 2>/dev/null | each $-check~
|
2021-11-15 20:20:43 +00:00
|
|
|
}
|
|
|
|
|
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)
|
2022-08-09 11:32:42 +00:00
|
|
|
doas find /usr/lib/*.so* -maxdepth 1 -type f 2>/dev/null | each $-check-executable~
|
2021-11-15 20:20:43 +00:00
|
|
|
}
|
|
|
|
|
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)
|
2022-08-09 11:32:42 +00:00
|
|
|
doas find /opt -maxdepth 3 -type f 2>/dev/null | each $-check-executable~
|
2021-11-15 20:20:43 +00:00
|
|
|
}
|
|
|
|
|
2021-12-11 21:09:02 +00:00
|
|
|
edit:add-var checklinks~ {||
|
2021-11-15 20:20:43 +00:00
|
|
|
-cbin
|
|
|
|
-clib
|
|
|
|
-copt
|
|
|
|
}
|