svrjs-installer-linux/updater.sh

47 lines
1.6 KiB
Bash
Raw Normal View History

2023-08-04 17:39:06 +02:00
#!/bin/bash
##Determine installer directory
installerroot=$(dirname $0)
2023-08-04 17:39:06 +02:00
##Print splash
2024-04-05 14:51:01 +02:00
echo '********************************'
echo '**SVR.JS updater for GNU/Linux**'
echo '********************************'
2023-08-04 17:39:06 +02:00
echo
##Check if user is root
if [ "$(id -u)" != "0" ]; then
echo 'You need to have root privileges to update SVR.JS'
exit 1
fi
##Check if svrjs.zip exists
if ! [ -f $installerroot/svrjs.zip ]; then
2023-08-04 17:39:06 +02:00
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
##Check if SVR.JS is installed
if ! [ -d /usr/lib/svrjs ]; then
echo 'SVR.JS isn'"'"'t installed (or it'"'"'s installed without using SVR.JS installer)!'
exit 1
fi
##Copy SVR.JS files
echo "Copying SVR.JS files..."
2023-09-09 22:25:21 +02:00
unzip -o svrjs.zip -d /usr/lib/svrjs svr.compressed modules.compressed svr.js > /dev/null
chown svrjs:svrjs /usr/lib/svrjs/svr.compressed /usr/lib/svrjs/modules.compressed /usr/lib/svrjs/svr.js
chmod 775 /usr/lib/svrjs/svr.compressed /usr/lib/svrjs/modules.compressed /usr/lib/svrjs/svr.js
2023-09-09 22:25:21 +02:00
unzip -o svrjs.zip -d /usr/lib/svrjs logviewer.js loghighlight.js > /dev/null
chown svrjs:svrjs /usr/lib/svrjs/logviewer.js /usr/lib/svrjs/loghighlight.js
chmod 775 /usr/lib/svrjs/logviewer.js /usr/lib/svrjs/loghighlight.js
2023-09-09 22:25:21 +02:00
unzip -o svrjs.zip -d /usr/lib/svrjs svrpasswd.js > /dev/null
chown svrjs:svrjs /usr/lib/svrjs/svrpasswd.js
chmod 775 /usr/lib/svrjs/svrpasswd.js
2023-08-04 17:39:06 +02:00
pushd .
cd /usr/lib/svrjs
node svr.js > /dev/null
popd
2024-04-05 14:51:01 +02:00
echo "Done! SVR.JS is updated successfully! You can now restart SVR.JS using \"/etc/init.d/svrjs restart\" or \"systemctl restart svrjs\"."