From cb3f5348551602b15272c1d5a9b4dcae798e8f9b Mon Sep 17 00:00:00 2001 From: Tommy Miland Date: Sun, 6 Oct 2024 17:57:01 +0200 Subject: [PATCH] Update i.sh --- i.sh | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/i.sh b/i.sh index 707f13b..7e2b9ad 100644 --- a/i.sh +++ b/i.sh @@ -1,11 +1,19 @@ #!/usr/bin/env bash +# Detect absolute and full path as well as filename of this script +cd "$(dirname "$0")" || exit +CURRDIR=$(pwd) +SCRIPT_FILENAME=$(basename "$0") +cd - > /dev/null || exit +sfp=$(readlink -f "${BASH_SOURCE[0]}" 2>/dev/null || greadlink -f "${BASH_SOURCE[0]}" 2>/dev/null) +if [ -z "$sfp" ]; then sfp=${BASH_SOURCE[0]}; fi +SCRIPT_DIR=$(dirname "${sfp}") if [[ $1 == "release" ]] then curl -sSL https://github.com/tmiland/Invidious-Updater/releases/latest/download/invidious_update.sh > invidious_update.sh && \ chmod +x invidious_update.sh - . /invidious_update.sh -i + "${SCRIPT_DIR}/${SCRIPT_FILENAME}" -i else curl -sSL https://github.com/tmiland/Invidious-Updater/raw/master/invidious_update.sh > invidious_update.sh && \ chmod +x invidious_update.sh - . ./invidious_update.sh -i + "${SCRIPT_DIR}/${SCRIPT_FILENAME}" -i fi