Skip to content

Instantly share code, notes, and snippets.

@ormaaj
Last active Jul 1, 2022
Embed
What would you like to do?
builtin loader
shopt -s lastpipe extglob globstar
shopt -u assoc_expand_once
function initializeBuiltins {
set +m
typeset libdir=${fsRoot%%+(/)}/usr/lib64
typeset -a a
typeset x
for x in "${libdir}"/{ctypes.so,bash/!(hello|truefalse|mypid|ln|head|rm|necho|*.*)}; do
if [[ $(file -b --mime-type -- "$x") == 'application/x-sharedlib' && !$? -ne 0 ]]; then
nm -CDj --without-symbol-versions -- "$x" |
sed -nE 's/(.*)_struct$/\1/p' |
mapfile -t a
(( PIPESTATUS[0] )) || enable -f "$x" -- "${a[@]}"
fi
done
return 0
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment