From 2fcd075f81e4da367aebdf26baff6c8d3d5519f6 Mon Sep 17 00:00:00 2001 From: Vendicated Date: Fri, 16 Sep 2022 19:45:40 +0200 Subject: [PATCH] Improve installer --- install.sh | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/install.sh b/install.sh index 1b938af6..945d2de6 100755 --- a/install.sh +++ b/install.sh @@ -19,16 +19,19 @@ if [ -z "$discord_actual" ]; then # has shebang? \#!/*) # Wrapper script, assume 2nd line has exec electron call and try to match asar path - path="$(head -n2 "$discord_bin" | tail -1 | grep -Eo "/.+?/app.asar")" - if [ -e "$path" ]; then + path="$(tail -1 "$discord_bin" | grep -Eo "\S+/app.asar" | sed 's/${name}/discord/')" + if [ -z "$path" ]; then + echo "Unsupported Install. $discord_bin is wrapper script but last line isn't exec call?" + exit + elif [ -e "$path" ]; then discord="$(dirname "$path")" else - echo "Unsupported Install at $path" + echo "Unsupported Install. $path not found" exit 1 fi ;; *) - echo "Unsupported Install."; + echo "Unsupported Install. $discord_bin is neither symlink nor a wrapper script."; exit 1 ;; esac @@ -48,7 +51,7 @@ if [ ! -e "$resources" ]; then app="$discord/app.asar" app_asar="_app.asar" else - echo "Unsupported Install" + echo "Unsupported Install. $discord has no resources folder but also isn't system electron install" exit fi fi