Skip to content

Commit

Permalink
Try to detect kernel version for P flag (#1059)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrdomino authored Jan 5, 2024
1 parent 2d93788 commit 80ec6c9
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions ape/apeinstall.sh
Original file line number Diff line number Diff line change
Expand Up @@ -132,13 +132,20 @@ if [ x"$(uname -s)" = xLinux ]; then
echo done >&2
fi

uname_r="$(uname -r)"
if printf '%s\n%s\n' 5.12 "$uname_r" | sort -CV; then
FLAGS=FP
else
FLAGS=F
fi

echo >&2
echo registering APE with binfmt_misc >&2
echo you may need to edit configs to persist across reboot >&2
echo '$SUDO sh -c "echo '"'"':APE:M::MZqFpD::/usr/bin/ape:FP'"'"' >/proc/sys/fs/binfmt_misc/register"' >&2
$SUDO sh -c "echo ':APE:M::MZqFpD::/usr/bin/ape:FP' >/proc/sys/fs/binfmt_misc/register" || exit
echo '$SUDO sh -c "echo '"'"':APE-jart:M::jartsr::/usr/bin/ape:FP'"'"' >/proc/sys/fs/binfmt_misc/register"' >&2
$SUDO sh -c "echo ':APE-jart:M::jartsr::/usr/bin/ape:FP' >/proc/sys/fs/binfmt_misc/register" || exit
echo '$SUDO sh -c "echo '"'"':APE:M::MZqFpD::/usr/bin/ape:'"$FLAGS'"' >/proc/sys/fs/binfmt_misc/register"' >&2
$SUDO sh -c "echo ':APE:M::MZqFpD::/usr/bin/ape:$FLAGS' >/proc/sys/fs/binfmt_misc/register" || exit
echo '$SUDO sh -c "echo '"'"':APE-jart:M::jartsr::/usr/bin/ape:'"$FLAGS'"' >/proc/sys/fs/binfmt_misc/register"' >&2
$SUDO sh -c "echo ':APE-jart:M::jartsr::/usr/bin/ape:$FLAGS' >/proc/sys/fs/binfmt_misc/register" || exit
echo done >&2

if [ x"$(cat /proc/sys/fs/binfmt_misc/status)" = xdisabled ]; then
Expand Down

0 comments on commit 80ec6c9

Please sign in to comment.