2020-09-01 02:31:11 +00:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# OVERVIEW
|
|
|
|
#
|
|
|
|
# System Sanity Check
|
|
|
|
#
|
|
|
|
# DESCRIPTION
|
|
|
|
#
|
|
|
|
# This script is launched at the start of Makefile to detect if
|
|
|
|
# binfmt_misc was tuned to launch 'MZ' shell scripts under WINE
|
|
|
|
|
|
|
|
if [ x`uname -s` != xLinux ]; then
|
|
|
|
cat <<'EOF' >&2
|
|
|
|
|
|
|
|
ERROR
|
|
|
|
|
|
|
|
Want Linux Build Environment
|
|
|
|
|
|
|
|
DETAILS
|
|
|
|
|
|
|
|
Cosmopolitan builds binaries that run on all major platforms.
|
|
|
|
You need to compile them on Linux, using any distro you like.
|
|
|
|
Consider setting up Alpine, Debian, or Ubuntu in a VMWare VM.
|
|
|
|
|
|
|
|
EOF
|
|
|
|
kill $1
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2022-05-22 11:51:02 +00:00
|
|
|
if [ ! -f /proc/sys/fs/binfmt_misc/status ]; then
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2022-08-08 05:10:18 +00:00
|
|
|
if ! build/bootstrap/echo.com -n; then
|
2020-09-01 02:31:11 +00:00
|
|
|
cat <<'EOF' >&2
|
|
|
|
|
|
|
|
ERROR
|
|
|
|
|
2022-05-22 11:51:02 +00:00
|
|
|
APE Execution error.
|
2020-09-01 02:31:11 +00:00
|
|
|
|
|
|
|
DETAILS
|
|
|
|
|
2022-05-22 11:51:02 +00:00
|
|
|
Your system has probably been configured to use binfmt_misc. You need
|
|
|
|
to run the command below to install /usr/bin/ape and register it with
|
|
|
|
binfmt_misc. See ape/loader.c for source code, and technical details.
|
2020-09-01 02:31:11 +00:00
|
|
|
|
|
|
|
WORKAROUND
|
|
|
|
|
2022-05-21 14:52:58 +00:00
|
|
|
ape/apeinstall.sh
|
2020-09-01 02:31:11 +00:00
|
|
|
|
2022-05-22 11:51:02 +00:00
|
|
|
NOTES
|
|
|
|
|
|
|
|
If it still doesn't work, possibly due to an overly aggressive WINE
|
|
|
|
or WSL registration, or possibly due to the ordering of definitions,
|
|
|
|
then one troubleshooting step is to just unregister everything using
|
|
|
|
sudo sh -c 'echo -1 >/proc/sys/fs/binfmt_misc/status' and try again.
|
|
|
|
|
2020-09-01 02:31:11 +00:00
|
|
|
SEE ALSO
|
|
|
|
|
2022-05-22 11:51:02 +00:00
|
|
|
https://justine.lol/ape.html
|
2020-09-01 02:31:11 +00:00
|
|
|
|
|
|
|
EOF
|
|
|
|
kill $1
|
|
|
|
exit 1
|
|
|
|
fi
|