diff --git a/.gitpod.yml b/.gitpod.yml
new file mode 100644
index 0000000..25871f3
--- /dev/null
+++ b/.gitpod.yml
@@ -0,0 +1,6 @@
+tasks:
+ # To get linting of shell files
+ - before: brew install shellcheck
+vscode:
+ extensions:
+ - timonwong.shellcheck@0.9.0:HV7fROO4OHK245UUeWPLRw==
\ No newline at end of file
diff --git a/config/steam-check.sh b/config/steam-check.sh
index 9b99bbf..3471fa0 100644
--- a/config/steam-check.sh
+++ b/config/steam-check.sh
@@ -1,12 +1,331 @@
-#!/bin/bash
-if [ -z ${STEAM_RUNTIME} ]; then
- echo "WARNING: ${FERAL_GAME_NAME_FULL} not launched within the steam runtime"
- echo " This is likely incorrect and is not officially supported"
- echo " Launching steam in 3 seconds with steam://rungameid/${FERAL_GAME_STEAMID}"
- sleep 3
- steam "steam://rungameid/${FERAL_GAME_STEAMID}"
- exit
-elif [ ${STEAM_RUNTIME} == 0 ]; then
- echo "WARNING: ${FERAL_GAME_NAME_FULL} launched with STEAM_RUNTIME=0"
- echo " We recommend using the steam runtime if possible"
+#!/bin/sh
+# Created by Feral Interactive somewhere around 2017 under MIT license
+# Refactored by Jacob Hrbek under GPLv3 license in 23.06.2020 19:48:54 CEST
+
+# shellcheck shell=sh # Written as POSIX-compatible
+
+###! Script to check if steam runtime is provided
+###! Requires:
+###! - Standard toolchain
+###! Exit codes:
+###! - FIXME-DOCS(Krey): Defined in die()
+###! Platforms:
+###! - [ ] Linux
+###! - [ ] Debian
+###! - [ ] Ubuntu
+###! - [ ] Fedora
+###! - [ ] NixOS
+###! - [ ] Archlinux
+###! - [ ] Alpine
+###! - [ ] FreeBSD
+###! - [ ] Darwin
+###! - [ ] Redox
+###! - [ ] ReactOS
+###! - [ ] Windows
+###! - [ ] Windows/Cygwin
+
+# Command overrides
+# NOTICE(Krey): These might be required on Windows/Cygwin or systems without standardized toolchain
+[ -z "$PRINTF" ] && PRINTF="printf"
+[ -z "$WGET" ] && WGET="wget"
+[ -z "$CURL" ] && CURL="curl"
+[ -z "$ARIA2C" ] && ARIA2C="aria2c"
+[ -z "$CHMOD" ] && CHMOD="chmod"
+[ -z "$UNAME" ] && UNAME="uname"
+[ -z "$TR" ] && TR="tr"
+[ -z "$SED" ] && SED="sed"
+[ -z "$GREP" ] && GREP="grep"
+[ -z "$EXIT" ] && EXIT="exit"
+[ -z "$SLEEP" ] && SLEEP="sleep"
+[ -z "$STEAM" ] && STEAM="steam"
+[ -z "$MKDIR" ] && MKDIR="mkdir"
+[ -z "$DATE" ] && DATE="date"
+
+
+# Customization of the output
+## efixme
+[ -z "$EFIXME_FORMAT_STRING" ] && EFIXME_FORMAT_STRING="FIXME: %s\n"
+[ -z "$EFIXME_FORMAT_STRING_LOG" ] && EFIXME_FORMAT_STRING="${logPrefix}FIXME: %s\n"
+[ -z "$EFIXME_FORMAT_STRING_DEBUG" ] && EFIXME_FORMAT_STRING_DEBUG="FIXME($myName:$0): %s\n"
+[ -z "$EFIXME_FORMAT_STRING_DEBUG_LOG" ] && EFIXME_FORMAT_STRING_DEBUG_LOG="${logPrefix}FIXME($myName:$0): %s\n"
+## eerror
+[ -z "$EERROR_FORMAT_STRING" ] && EERROR_FORMAT_STRING="ERROR: %s\n"
+[ -z "$EERROR_FORMAT_STRING_LOG" ] && EERROR_FORMAT_STRING_LOG="${logPrefix}ERROR: %s\n"
+[ -z "$EERROR_FORMAT_STRING_DEBUG" ] && EERROR_FORMAT_STRING_DEBUG="ERROR($myName:$0): %s\n"
+[ -z "$EERROR_FORMAT_STRING_DEBUG_LOG" ] && EERROR_FORMAT_STRING_DEBUG_LOG="${logPrefix}ERROR($myName:$0): %s\n"
+## edebug
+[ -z "$EERROR_FORMAT_STRING" ] && EERROR_FORMAT_STRING="ERROR: %s\n"
+[ -z "$EERROR_FORMAT_STRING_LOG" ] && EERROR_FORMAT_STRING_LOG="${logPrefix}ERROR: %s\n"
+[ -z "$EERROR_FORMAT_STRING_DEBUG" ] && EERROR_FORMAT_STRING_DEBUG="ERROR($myName:$0): %s\n"
+[ -z "$EERROR_FORMAT_STRING_DEBUG_LOG" ] && EERROR_FORMAT_STRING_DEBUG_LOG="${logPrefix}ERROR($myName:$0): %s\n"
+## einfo
+[ -z "$EINFO_FORMAT_STRING" ] && EINFO_FORMAT_STRING="INFO: %s\n"
+[ -z "$EINFO_FORMAT_STRING_LOG" ] && EINFO_FORMAT_STRING_LOG="${logPrefix}INFO: %s\n"
+[ -z "$EINFO_FORMAT_STRING_DEBUG" ] && EINFO_FORMAT_STRING_DEBUG="INFO($myName:$0): %s\n"
+[ -z "$EINFO_FORMAT_STRING_DEBUG_LOG" ] && EINFO_FORMAT_STRING_DEBUG_LOG="${logPrefix}INFO($myName:$0): %s\n"
+## die
+[ -z "$DIE_FORMAT_STRING" ] && DIE_FORMAT_STRING="FATAL: %s in script '$myName' located at '$0'\\n"
+[ -z "$DIE_FORMAT_STRING_LOG" ] && DIE_FORMAT_STRING_LOG="${logPath}FATAL: %s in script '$myName' located at '$0'\\n"
+[ -z "$DIE_FORMAT_STRING_DEBUG" ] && DIE_FORMAT_STRING_DEBUG="FATAL($myName:$1): %s\n"
+[ -z "$DIE_FORMAT_STRING_DEBUG_LOG" ] && DIE_FORMAT_STRING_DEBUG_LOG="${logPrefix}FATAL($myName:$1): %s\\n"
+### Fixme trap
+[ -z "$DIE_FORMAT_STRING_FIXME" ] && DIE_FORMAT_STRING_FIXME="FATAL: %s in script '$myName' located at '$0', fixme?\n"
+[ -z "$DIE_FORMAT_STRING_FIXME_LOG" ] && DIE_FORMAT_STRING_FIXME_LOG="${logPrefix}FATAL: %s, fixme?\n"
+[ -z "$DIE_FORMAT_STRING_FIXME_DEBUG" ] && DIE_FORMAT_STRING_FIXME_DEBUG="FATAL($myName:$1): %s, fixme?\n"
+[ -z "$DIE_FORMAT_STRING_FIXME_DEBUG_LOG" ] && DIE_FORMAT_STRING_FIXME_DEBUG_LOG="${logPrefix}FATAL($myName:$1): %s, fixme?\\n"
+### Unexpected trap
+[ -z "$DIE_FORMAT_STRING_UNEXPECTED" ] && DIE_FORMAT_STRING_UNEXPECTED="FATAL: Unexpected happend while %s in $myName located at $0\\n"
+[ -z "$DIE_FORMAT_STRING_UNEXPECTED_LOG" ] && DIE_FORMAT_STRING_UNEXPECTED_LOG="${logPrefix}FATAL: Unexpected happend while %s\\n"
+[ -z "$DIE_FORMAT_STRING_UNEXPECTED_DEBUG" ] && DIE_FORMAT_STRING_UNEXPECTED_DEBUG="FATAL($myName:$1): Unexpected happend while %s in $myName located at $0\\n"
+[ -z "$DIE_FORMAT_STRING_UNEXPECTED_DEBUG_LOG" ] && DIE_FORMAT_STRING_UNEXPECTED_DEBUG="${logPrefix}FATAL($myName:$1): Unexpected happend while %s\\n"
+
+# Exit on anything unexpected
+set -e
+
+# NOTICE(Krey): By default busybox outputs a full path in '$0' this is used to strip it
+myName="${0##*/}"
+
+# To identify upstream for issues/contribs
+UPSTREAM="https://github.com/FeralInteractive/ferallinuxscripts"
+
+# Used to prefix logs with timestemps, uses ISO 8601 by default
+logPrefix="[ $("$DATE" -u +"%Y-%m-%dT%H:%M:%SZ") ] "
+
+# Path to which we will save logs
+# NOTICE(Krey): To avoid storing file '$HOME/.some-name.sh.log' we are stripping the '.sh' here
+# FIXME: This may fail if '$HOME/.local/share' is not present
+if [ -d "$HOME/.local/share" ]; then
+ logPath="${XDG_DATA_HOME:-$HOME/.local/share}/${myName%%.sh}.log"
+elif [ ! -d "$HOME/.local/share" ]; then
+ eerror "Standard directory '$HOME/.local/share' is not available on this system, trying to resolve.."
+ logPath="${XDG_DATA_HOME:-$HOME/.local/share}/${myName%%.sh}.log"
+ "$MKDIR" -p "$HOME/.local/share" || "$PRINTF" 'ERROR: %s\n' "Unable to create the required directory '$HOME/.local/share' for logs, using '$HOME' instead" && logPath="$HOME/${myName%%.sh}.log"
+
+ # Self-check
+ if [ -d "$HOME/.local/share" ]; then
+ "$PRINTF" 'INFO: %s\n' "Directory '$HOME/.local/share' has been confirmed to be present for logs"
+ elif [ ! -d "$HOME/.local/share" ]; then
+ "$PRINTF" 'FATAL: %s\n' "Self-check for directory '$HOME/.local/share' failed"
+ "$EXIT" 1
+ else
+ "$PRINTF" 'FATAL: Unexpected happend while %s\n' "self-checking log path"
+ "$EXIT" 255
+ fi
+else
+ "$PRINTF" 'FATAL: Unexpected happend while %s\n' "checking log path"
+ "$EXIT" 255
fi
+
+# inicialize the script in logs
+"$PRINTF" '%s\n' "Started $myName on $("$UNAME" -s || true) at $(date -u +"%Y-%m-%dT%H:%M:%SZ")" >> "$logPath"
+
+# Simple assertion wrapper with message
+# NOTICE(Krey): Aliases are required for posix-compatible line output (https://gist.github.com/Kreyren/4fc76d929efbea1bc874760e7f78c810)
+# NOTICE(Krey): Aliases are required for posix-compatible line output (https://gist.github.com/Kreyren/4fc76d929efbea1bc874760e7f78c810)
+die() { funcname=die
+ case "$2" in
+ 38|fixme) # FIXME
+ if [ "$DEBUG" = 0 ] || [ -z "$DEBUG" ]; then
+ "$PRINTF" "$DIE_FORMAT_STRING_FIXME" "$3"
+ "$PRINTF" "$DIE_FORMAT_STRING_FIXME_LOG" "$3" >> "$logPath"
+ funcname="$myName"
+ elif [ "$DEBUG" = 1 ]; then
+ "$PRINTF" "$DIE_FORMAT_STRING_FIXME_DEBUG" "$3"
+ "$PRINTF" "$DIE_FORMAT_STRING_FIXME_DEBUG_LOG" "$3" >> "$logPath"
+ funcname="$myName"
+ else
+ # NOTICE(Krey): Do not use die() here
+ "$PRINTF" 'FATAL: %s\n' "Unexpected happend while processing variable DEBUG with value '$DEBUG' in $funcname"
+ fi
+
+ "$EXIT" 38
+ ;;
+ 255) # Unexpected trap
+ if [ "$DEBUG" = 0 ] || [ -z "$DEBUG" ]; then
+ "$PRINTF" "$DIE_FORMAT_STRING_UNEXPECTED" "$3"
+ "$PRINTF" "$DIE_FORMAT_STRING_UNEXPECTED_LOG" "$3" >> "$logPath"
+ funcname="$myName"
+ elif [ "$DEBUG" = 1 ]; then
+ "$PRINTF" "$DIE_FORMAT_STRING_UNEXPECTED_DEBUG" "$3"
+ "$PRINTF" "$DIE_FORMAT_STRING_UNEXPECTED_DEBUG_LOG" "$3" >> "$logPath"
+ funcname="$myName"
+ else
+ # NOTICE(Krey): Do not use die() here
+ "$PRINTF" "$DIE_FORMAT_STRING" "Unexpected happend while processing variable DEBUG with value '$DEBUG' in $funcname"
+ fi
+ ;;
+ *)
+ if [ "$DEBUG" = 0 ] || [ -z "$DEBUG" ]; then
+ "$PRINTF" "$DIE_FORMAT_STRING" "$3"
+ "$PRINTF" "$DIE_FORMAT_STRING_LOG" "$3" >> "$logPath"
+ funcname="$myName"
+ elif [ "$DEBUG" = 1 ]; then
+ "$PRINTF" "$DIE_FORMAT_STRING_DEBUG" "$3"
+ "$PRINTF" "$DIE_FORMAT_STRING_DEBUG_LOG" "$3" >> "$logPath"
+ funcname="$myName"
+ else
+ # NOTICE(Krey): Do not use die() here
+ "$PRINTF" 'FATAL: %s\n' "Unexpected happend while processing variable DEBUG with value '$DEBUG' in $funcname"
+ fi
+ esac
+
+ "$EXIT" "$2"
+
+ # In case invalid argument has been parsed in $2
+ "$EXIT" 255
+}; alias die='die "$LINENO"'
+
+einfo() { funcname=einfo
+ if [ "$DEBUG" = 0 ] || [ -z "$DEBUG" ]; then
+ "$PRINTF" "$EINFO_FORMAT_STRING" "$2"
+ "$PRINTF" "$EINFO_FORMAT_STRING_LOG" "$2" >> "$logPath"
+ funcname="$myName"
+ return 0
+ elif [ "$DEBUG" = 1 ]; then
+ "$PRINTF" "$EINFO_FORMAT_STRING_DEBUG" "$2"
+ "$PRINTF" "$EINFO_FORMAT_STRING_DEBUG_LOG" "$2" >> "$logPath"
+ funcname="$myName"
+ return 0
+ else
+ die 255 "processing variable DEBUG with value '$DEBUG' in $funcname"
+ fi
+}; alias einfo='einfo "$LINENO"'
+
+ewarn() { funcname=ewarn
+ if [ "$DEBUG" = 0 ] || [ -z "$DEBUG" ]; then
+ "$PRINTF" "$EWARN_FORMAT_STRING" "$2"
+ "$PRINTF" "$EWARN_FORMAT_STRING_LOG" "$2" >> "$logPath"
+ funcname="$myName"
+ return 0
+ elif [ "$DEBUG" = 1 ]; then
+ "$PRINTF" "$EWARN_FORMAT_STRING_DEBUG" "$2"
+ "$PRINTF" "$EWARN_FORMAT_STRING_DEBUG_LOG" "$2" >> "$logPath"
+ funcname="$myName"
+ return 0
+ else
+ die 255 "processing variable DEBUG with value '$DEBUG' in $funcname"
+ fi
+}; alias ewarn='ewarn "$LINENO"'
+
+eerror() { funcname=eerror
+ if [ "$DEBUG" = 0 ] || [ -z "$DEBUG" ]; then
+ "$PRINTF" "$EERROR_FORMAT_STRING" "$2"
+ "$PRINTF" "$EERROR_FORMAT_STRING_LOG" "$2" >> "$logPath"
+ funcname="$myName"
+ return 0
+ elif [ "$DEBUG" = 1 ]; then
+ "$PRINTF" "$EERROR_FORMAT_STRING_DEBUG" "$2"
+ "$PRINTF" "$EERROR_FORMAT_STRING_DEBUG_LOG" "$2" >> "$logPath"
+ funcname="$myName"
+ return 0
+ else
+ die 255 "processing variable DEBUG with value '$DEBUG' in $funcname"
+ fi
+}; alias eerror='eerror "$LINENO"'
+
+edebug() { funcname=edebug
+ if [ "$DEBUG" = 0 ] || [ -z "$DEBUG" ]; then
+ "$PRINTF" "$EDEBUG_FORMAT_STRING" "$2"
+ "$PRINTF" "$EDEBUG_FORMAT_STRING_LOG" "$2" >> "$logPath"
+ funcname="$myName"
+ return 0
+ elif [ "$DEBUG" = 1 ]; then
+ "$PRINTF" "$EDEBUG_FORMAT_STRING_DEBUG" "$2"
+ "$PRINTF" "$EDEBUG_FORMAT_STRING_DEBUG_LOG" "$2" >> "$logPath"
+ funcname="$myName"
+ return 0
+ else
+ die 255 "processing variable DEBUG with value '$DEBUG' in $funcname"
+ fi
+}; alias eerror='eerror "$LINENO"'
+
+efixme() { funcname=efixme
+ if [ "$IGNORE_FIXME" = 1 ]; then
+ true
+ elif [ "$IGNORE_FIXME" = 0 ] || [ -z "$IGNORE_FIXME" ]; then
+ if [ "$DEBUG" = 0 ] || [ -z "$DEBUG" ]; then
+ "$PRINTF" "$EFIXME_FORMAT_STRING" "$2"
+ "$PRINTF" "$EFIXME_FORMAT_STRING" "$2" >> "$logPath"
+ funcname="$myName"
+ return 0
+ elif [ "$DEBUG" = 1 ]; then
+ "$PRINTF" "$EFIXME_FORMAT_STRING_DEBUG" "$2"
+ "$PRINTF" "$EFIXME_FORMAT_STRING_DEBUG_LOG" "$2" >> "$logPath"
+ funcname="$myName"
+ return 0
+ else
+ die 255 "processing DEBUG variable with value '$DEBUG' in $funcname"
+ fi
+ else
+ die 255 "processing variable IGNORE_FIXME with value '$IGNORE_FIXME' in $0"
+ fi
+}; alias efixme='efixme "$LINENO"'
+
+# Identify system
+if "$COMMAND" -v "$UNAME" 1>/dev/null; then
+ unameKernel="$("$UNAME" -s)"
+ edebug "Identified the kernel as '$unameKernel"
+ case "$unameKernel" in
+ Linux)
+ KERNEL="$unameKernel"
+
+ # Assume Linux Distro and release
+ # NOTICE(Krey): We are expecting this to return a lowercase value
+ if "$COMMAND" -v "$LSB_RELEASE" 1>/dev/null; then
+ assumedDistro="$("$LSB_RELEASE" -si | "$TR" :[upper]: :[lower]:)"
+ assumedRelease="$("$LSB_RELEASE" -cs | "$TR" :[upper]: :[lower]:)"
+ elif ! "$COMMAND" -v "$LSB_RELEASE" 1>/dev/null && [ -f /etc/os-release ]; then
+ assumedDistro="$("$GREP" -o "^ID\=.*" /etc/os-release | "$SED" "s/ID=//gm")"
+ assumedRelease="$("$GREP" -o "^VERSION_CODENAME\=.*" /etc/os-release | "$SED" "s/^VERSION_CODENAME=//gm")"
+ elif ! "$COMMAND" -v "$LSB_RELEASE" 1>/dev/null && [ ! -f /etc/os-release ]; then
+ die 1 "Unable to identify linux distribution using command 'lsb_release' nor file '/etc/os-release'"
+ else
+ die 255 "attempting to assume linux distro and release"
+ fi
+
+ edebug "Identified distribution as '$assumedDistro'"
+ edebug "Identified distribution release as '$assumedRelease'"
+
+ # Verify Linux Distro
+ efixme "Add sanitization logic for other linux distributions"
+ case "$assumedDistro" in
+ ubuntu | debian | fedora | nixos | opensuse | gentoo | exherbo)
+ DISTRO="$assumedDistro"
+ ;;
+ *) die fixme "Unexpected Linux distribution '$assumedDistro' has been detected."
+ esac
+
+ # Verify Linux Distro Release
+ efixme "Sanitize verification of linux distro release"
+ RELEASE="$assumedRelease"
+ ;;
+ FreeBSD | Redox | Darwin | Windows)
+ KERNEL="$unameKernel"
+ ;;
+ *) die 255 "Unexpected kernel '$unameKernel'"
+ esac
+elif ! "$COMMAND" -v "$UNAME" 1>/dev/null; then
+ die 1 "Standard command '$UNAME' is not available on this system, unable to identify kernel"
+else
+ die 255 "Identifying system"
+fi
+
+case "$KERNEL" in
+ linux)
+ # FIXME-QA(Krey): Are other distros and releases a concern?
+ if [ -z "$STEAM_RUNTIME" ]; then
+ "$PRINTF" '%s\n' \
+ "WARNING: $FERAL_GAME_NAME_FULL not launched within the steam runtime" \
+ " This is likely incorrect and is not officially supported" \
+ " Launching steam in 3 seconds with steam://rungameid/$FERAL_GAME_STEAMID" \
+ "$SLEEP" 3
+ "$STEAM" "steam://rungameid/$FERAL_GAME_STEAMID" || die 1 "Steam failed to start steam game '$FERAL_GAME_NAME_FULL' with ID '$FERAL_GAME_STEAMID"
+ "$EXIT" 0
+ elif [ "$STEAM_RUNTIME" = 0 ]; then
+ "$PRINTF" '%s\n' \
+ "WARNING: $FERAL_GAME_NAME_FULL launched with STEAM_RUNTIME=0" \
+ " We recommend using the steam runtime if possible"
+ fi
+ ;;
+ *) die fixme "Kernel '$KERNEL' is not supported, see $UPSTREAM for contribution or issue tracking"
+esac
\ No newline at end of file