From 01eb1f3e1ab26ea1792a35b5600aba968c5fb9fc Mon Sep 17 00:00:00 2001 From: Storm Dragon Date: Sat, 8 Nov 2025 13:07:07 -0500 Subject: [PATCH] Fixed crash bug if yad is not installed and agm is launched from a gui. Insure AGM is not ran as the root users. If people who really should know better still need training wheels, actual newbies might need the protection as well. --- .includes/dialog-interface.sh | 4 +++- .includes/functions.sh | 17 ++++++++++++++--- audiogame-manager.sh | 4 +++- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/.includes/dialog-interface.sh b/.includes/dialog-interface.sh index c096c71..afda207 100644 --- a/.includes/dialog-interface.sh +++ b/.includes/dialog-interface.sh @@ -10,8 +10,10 @@ if [[ -z "$dialogType" ]]; then if [[ -z "$DISPLAY" ]]; then dialogType="dialog" - else + elif command -v yad &> /dev/null; then dialogType="yad" + else + dialogType="dialog" fi fi diff --git a/.includes/functions.sh b/.includes/functions.sh index b73ae3a..5a6d4a0 100644 --- a/.includes/functions.sh +++ b/.includes/functions.sh @@ -8,15 +8,26 @@ alert() { } check_requirements() { - # Make sure the minimum of curl, sox, wine, and winetricks are installed or fex-emu on aarch64 + # Make sure this is not ran as root + if [[ "$(whoami)" == "root" ]]; then + echo "Please do not run ${0##*/} as root." + return 1 + fi + + # Make sure the minimum dependencies are installed if [[ "$(uname -m)" == "aarch64" ]]; then minimumDependencies=("FEXLoader") wine="FEXLoader -- /usr/bin/wine" else - minimumDependencies=("curl" "sox" "wine") + minimumDependencies=( + "curl" + "dialog" + "sox" + "wine" + ) fi for i in "${minimumDependencies[@]}" ; do - if ! command -v $i &> /dev/null ; then + if ! command -v "$i" &> /dev/null ; then echo "Please install $i before continuing." return 1 fi diff --git a/audiogame-manager.sh b/audiogame-manager.sh index caf0ddc..2779f3b 100755 --- a/audiogame-manager.sh +++ b/audiogame-manager.sh @@ -597,8 +597,10 @@ trap "exit 0" SIGINT # This must happen before we modify DISPLAY to preserve console detection if [[ -z "$DISPLAY" ]]; then dialogType="dialog" +elif command -v yad &> /dev/null; then + dialogType="yad" else - dialogType="yad" + dialogType="dialog" fi # Source dialog interface early for progress display