This is a maintenance fork
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

57 lines
1.1 KiB

#!/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
build/sanitycheck2
if [ $? -ne 123 ]; then
cat <<'EOF' >&2
ERROR
Thompson Shell Backwards Compatibility Issue Detected
DETAILS
Actually Portable Executable assumes stock Linux configuration.
Normal behavior is non-ELF files with x bit are run by /bin/sh.
Linux lets people globally define arbitrary magic interpreters.
Your computer couldve been tuned to run MZ scripts inside WINE.
So if you use binfmt_misc you need to explicitly register this.
WORKAROUND
sudo sh -c "echo ':APE:M::MZqFpD::/bin/sh:' >/proc/sys/fs/binfmt_misc/register"
SEE ALSO
https://justine.storage.googleapis.com/ape.html
EOF
kill $1
exit 1
fi