From 8f3efd0b9c3abf64499743c7975bf2de0751d9ea Mon Sep 17 00:00:00 2001 From: the-sane <3657071+the-sane@users.noreply.github.com> Date: Sun, 27 Dec 2020 16:32:55 -0500 Subject: [PATCH] Fix url parsing Be more specific for when grep returns multiple matches --- lug-helper.sh | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/lug-helper.sh b/lug-helper.sh index 6232a05..ef7fd2f 100755 --- a/lug-helper.sh +++ b/lug-helper.sh @@ -650,8 +650,8 @@ lutris_restart() { else message info "Lutris does not appear to be running." fi - lutris_needs_restart="false" fi + lutris_needs_restart="false" fi } @@ -713,10 +713,16 @@ runner_install() { exit 0 fi - # Use menu selection from last menu to select version from array + # Store the selected runner name and url runner_name="${runner_versions[$1]}" - runner_url="$(curl -s "$latest_url" | grep "browser_download_url.*$runner_name" | cut -d \" -f4)" - + if [ "$latest_url" = "$snatella_url" ]; then + # Runners with .tgz file extension + runner_url="$(curl -s "$latest_url" | grep "browser_download_url.*$runner_name.tgz" | cut -d \" -f4)" + else + # Runners with .tar.gz file extension + runner_url="$(curl -s "$latest_url" | grep "browser_download_url.*$runner_name.tar.gz" | cut -d \" -f4)" + fi + # Sanity check if [ -z "$runner_url" ]; then message warning "Could not find the requested runner. The Github API may be down or rate limited."