Files
emcomm-tools-os-community/overlay/etc/skel/add-ons/wine/common-checks.sh
T
2025-02-01 01:14:42 -07:00

35 lines
1.1 KiB
Bash
Executable File

#!/bin/bash
# Author : Gaston Gonzalez
# Date : 1 February 2025
# Purpose : Performs various checks to ensure that changes can be made
# to a user's local WINE installation.
source /opt/emcomm-tools/bin/et-common
WINE_OUT=$(which winetricks)
if [[ $? -ne 0 ]]; then
echo -e "${RED}Wine is not installed. As root, first run: ${WHITE}/root/emcomm-tools-os-community/scripts/install-wine.sh${NC}"
exit 1
fi
if [[ "${EUID}" -eq 0 ]]; then
echo -e "${RED}This script must not be run as root. Run it as your normal user.${NC}"
exit 1
fi
if [[ -z "${WINARCH}" ]]; then
echo -e "The WINARCH environment variable is not set. Setting it for you."
export WINARCH="win32"
fi
if [[ -z "${WINEPREFIX}" ]]; then
echo -e "The WINEPREFIX environment variable is not set. Setting it for you."
export WINEPREFIX="${HOME}/.wine32"
fi
if [[ -z "${DISPLAY}" && -z "${WAYLAND_DISPLAY}" ]]; then
echo -e "${RED}No graphical environment detected. Run this command from a desktop session.${NC}"
echo -e "${RED}This can't be run from within Cubic.${NC}"
exit 1
fi