From bd619783898ac2e832eca52b3008c055523037d3 Mon Sep 17 00:00:00 2001 From: Dorian Niemiec Date: Sun, 3 Dec 2023 14:43:35 +0100 Subject: [PATCH] Add support for running installer, when current working directory is not a installer directory. --- installer.sh | 7 +++++-- updater.sh | 5 ++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/installer.sh b/installer.sh index 964b21e..7dd9e51 100755 --- a/installer.sh +++ b/installer.sh @@ -1,5 +1,8 @@ #!/bin/bash +##Determine installer directory +installerroot=$(dirname $0) + ##Print splash echo '******************************' echo '**SVR.JS installer for Linux**' @@ -67,7 +70,7 @@ install_setcap() { } ##Check if svrjs.zip exists -if ! [ -f svrjs.zip ]; then +if ! [ -f $installerroot/svrjs.zip ]; then echo 'Can'"'"'t find SVR.JS archive in "svrjs.zip"! Make sure to download SVR.JS archive file from https://svrjs.org and rename it to "svrjs.zip".' exit 1 fi @@ -114,7 +117,7 @@ fi ##Copy SVR.JS files echo "Copying SVR.JS files..." mkdir /usr/lib/svrjs -unzip svrjs.zip -d /usr/lib/svrjs > /dev/null +unzip $installerroot/svrjs.zip -d /usr/lib/svrjs > /dev/null pushd . cd /usr/lib/svrjs node svr.js > /dev/null diff --git a/updater.sh b/updater.sh index 40205e6..3f2f9ec 100755 --- a/updater.sh +++ b/updater.sh @@ -1,5 +1,8 @@ #!/bin/bash +##Determine installer directory +installerroot=$(dirname $0) + ##Print splash echo '****************************' echo '**SVR.JS updater for Linux**' @@ -13,7 +16,7 @@ if [ "$(id -u)" != "0" ]; then fi ##Check if svrjs.zip exists -if ! [ -f svrjs.zip ]; then +if ! [ -f $installerroot/svrjs.zip ]; then echo 'Can'"'"'t find SVR.JS archive in "svrjs.zip"! Make sure to download SVR.JS archive file from https://svrjs.org and rename it to "svrjs.zip".' exit 1 fi