Files
faumaray bba5c8a39a initial commit
Signed-off-by: Aleksey Selihov <faumaray@gmail.com>
2026-05-22 02:40:32 +03:00

48 lines
1.3 KiB
Bash
Executable File

#!/usr/bin/env bash
# VoidLibC Linux uninstaller.
# Reverses install.sh: removes binaries and deregisters binfmt_misc.
# Must be run as root (or with sudo).
set -euo pipefail
INSTALL_BIN="${INSTALL_BIN:-/usr/local/bin}"
BINFMT_CONF_DIR="${BINFMT_CONF_DIR:-/etc/binfmt.d}"
MAGIC_DIR="${MAGIC_DIR:-/usr/share/file/magic}"
BINFMT_PROC="/proc/sys/fs/binfmt_misc"
BINFMT_ENTRY_NAME="vlc"
# --- Deregister binfmt_misc ---
if [[ -f "${BINFMT_PROC}/${BINFMT_ENTRY_NAME}" ]]; then
echo "Deregistering binfmt_misc entry '${BINFMT_ENTRY_NAME}'"
echo -1 > "${BINFMT_PROC}/${BINFMT_ENTRY_NAME}"
else
echo "(binfmt_misc entry '${BINFMT_ENTRY_NAME}' not active — skipping)"
fi
# --- Remove binfmt.d config ---
if [[ -f "${BINFMT_CONF_DIR}/vlc.conf" ]]; then
echo "Removing ${BINFMT_CONF_DIR}/vlc.conf"
rm -f "${BINFMT_CONF_DIR}/vlc.conf"
fi
# --- Remove binaries ---
for f in "${INSTALL_BIN}/voidlink" "${INSTALL_BIN}/voidloader"; do
if [[ -f "$f" ]]; then
echo "Removing $f"
rm -f "$f"
fi
done
# --- Remove file(1) magic entry ---
if [[ -f "${MAGIC_DIR}/vlc" ]]; then
echo "Removing ${MAGIC_DIR}/vlc"
rm -f "${MAGIC_DIR}/vlc"
if command -v file &>/dev/null; then
echo "Recompiling magic database..."
file -C -m "$MAGIC_DIR" 2>/dev/null || true
fi
fi
echo ""
echo "VoidLibC uninstalled."