Add support for running installer, when current working directory is not a installer directory.

This commit is contained in:
Dorian Niemiec 2023-12-03 14:43:35 +01:00
parent 51c7f8bd8f
commit bd61978389
2 changed files with 9 additions and 3 deletions

View file

@ -1,5 +1,8 @@
#!/bin/bash #!/bin/bash
##Determine installer directory
installerroot=$(dirname $0)
##Print splash ##Print splash
echo '******************************' echo '******************************'
echo '**SVR.JS installer for Linux**' echo '**SVR.JS installer for Linux**'
@ -67,7 +70,7 @@ install_setcap() {
} }
##Check if svrjs.zip exists ##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".' 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 exit 1
fi fi
@ -114,7 +117,7 @@ fi
##Copy SVR.JS files ##Copy SVR.JS files
echo "Copying SVR.JS files..." echo "Copying SVR.JS files..."
mkdir /usr/lib/svrjs mkdir /usr/lib/svrjs
unzip svrjs.zip -d /usr/lib/svrjs > /dev/null unzip $installerroot/svrjs.zip -d /usr/lib/svrjs > /dev/null
pushd . pushd .
cd /usr/lib/svrjs cd /usr/lib/svrjs
node svr.js > /dev/null node svr.js > /dev/null

View file

@ -1,5 +1,8 @@
#!/bin/bash #!/bin/bash
##Determine installer directory
installerroot=$(dirname $0)
##Print splash ##Print splash
echo '****************************' echo '****************************'
echo '**SVR.JS updater for Linux**' echo '**SVR.JS updater for Linux**'
@ -13,7 +16,7 @@ if [ "$(id -u)" != "0" ]; then
fi fi
##Check if svrjs.zip exists ##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".' 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 exit 1
fi fi