2022-07-10 21:13:45 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
if [ "$UID" = "0" ]; then
|
|
|
|
SUDO=
|
|
|
|
else
|
|
|
|
SUDO=sudo
|
|
|
|
fi
|
|
|
|
|
|
|
|
{
|
|
|
|
echo
|
Introduce new `jartsr='` ape prefix
Files beginning with "MZqFpD" are Actually Portable Executables,
which have a printf statement in the first 4096 bytes with octal
codes that specify the ELF header. APE also specifies `jartsr='`
as an alternative prefix, intended for binaries that do not want
to be identified as Windows executables. Like the \177ELF magic,
all these prefixes decode as x86 jump instructions that could be
used for 16-bit bootloaders or 32-bit / 64-bit flat executables.
Most importantly they provide a fallback path for Thompson shell
copmatible command interpreters, which do not require a shebang,
e.g. bash, zsh, fish, bourne, almquist, etc. Please note that in
order to meet the requirements of POSIX.1, the single quote must
be followed by a newline character, before any null bytes occur.
See also: https://www.austingroupbugs.net/view.php?id=1250
2022-11-11 04:58:48 +00:00
|
|
|
echo "APE Uninstaller intends to run (in pseudo-shell)"
|
2022-07-10 21:13:45 +00:00
|
|
|
echo
|
Introduce new `jartsr='` ape prefix
Files beginning with "MZqFpD" are Actually Portable Executables,
which have a printf statement in the first 4096 bytes with octal
codes that specify the ELF header. APE also specifies `jartsr='`
as an alternative prefix, intended for binaries that do not want
to be identified as Windows executables. Like the \177ELF magic,
all these prefixes decode as x86 jump instructions that could be
used for 16-bit bootloaders or 32-bit / 64-bit flat executables.
Most importantly they provide a fallback path for Thompson shell
copmatible command interpreters, which do not require a shebang,
e.g. bash, zsh, fish, bourne, almquist, etc. Please note that in
order to meet the requirements of POSIX.1, the single quote must
be followed by a newline character, before any null bytes occur.
See also: https://www.austingroupbugs.net/view.php?id=1250
2022-11-11 04:58:48 +00:00
|
|
|
echo " sudo echo -1 into /proc/sys/fs/binfmt_misc/APE*"
|
2023-07-01 12:10:12 +00:00
|
|
|
echo " sudo rm -f /usr/bin/ape ~/.ape /tmp/.ape # etc."
|
2022-07-10 21:13:45 +00:00
|
|
|
echo
|
|
|
|
echo "You may then use ape/apeinstall.sh to reinstall it"
|
|
|
|
echo
|
|
|
|
} >&2
|
|
|
|
|
|
|
|
set -ex
|
Introduce new `jartsr='` ape prefix
Files beginning with "MZqFpD" are Actually Portable Executables,
which have a printf statement in the first 4096 bytes with octal
codes that specify the ELF header. APE also specifies `jartsr='`
as an alternative prefix, intended for binaries that do not want
to be identified as Windows executables. Like the \177ELF magic,
all these prefixes decode as x86 jump instructions that could be
used for 16-bit bootloaders or 32-bit / 64-bit flat executables.
Most importantly they provide a fallback path for Thompson shell
copmatible command interpreters, which do not require a shebang,
e.g. bash, zsh, fish, bourne, almquist, etc. Please note that in
order to meet the requirements of POSIX.1, the single quote must
be followed by a newline character, before any null bytes occur.
See also: https://www.austingroupbugs.net/view.php?id=1250
2022-11-11 04:58:48 +00:00
|
|
|
for f in /proc/sys/fs/binfmt_misc/APE*; do
|
|
|
|
if [ -f $f ]; then
|
|
|
|
$SUDO sh -c "echo -1 >$f" || exit
|
|
|
|
fi
|
|
|
|
done
|
2023-07-01 12:10:12 +00:00
|
|
|
|
|
|
|
# system installation
|
|
|
|
if [ -f /usr/bin/ape ]; then
|
|
|
|
$SUDO rm -f /usr/bin/ape
|
|
|
|
fi
|
|
|
|
|
|
|
|
# legacy installations
|
|
|
|
rm -f o/tmp/ape /tmp/ape "${TMPDIR:-/tmp}/ape"
|
|
|
|
|
|
|
|
# ad-hoc installations
|
|
|
|
for x in .ape \
|
|
|
|
.ape-1.1 \
|
2023-07-24 00:07:38 +00:00
|
|
|
.ape-1.3 \
|
2023-07-25 12:43:04 +00:00
|
|
|
.ape-1.4 \
|
2023-07-26 20:54:49 +00:00
|
|
|
.ape-1.5 \
|
2023-07-01 12:10:12 +00:00
|
|
|
.ape-blink-0.9.2 \
|
|
|
|
.ape-blink-1.0.0; do
|
|
|
|
rm -f \
|
|
|
|
~/$x \
|
|
|
|
/tmp/$x \
|
|
|
|
o/tmp/$x \
|
|
|
|
"${TMPDIR:-/tmp}/$x"
|
|
|
|
done
|