From 0f79e708bf07721b73ea41e5d341be08e8ea4dce Mon Sep 17 00:00:00 2001 From: Minteck Date: Sun, 7 Mar 2021 18:29:17 +0100 Subject: Initial commit --- shared/updates.sh | 80 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 shared/updates.sh (limited to 'shared/updates.sh') diff --git a/shared/updates.sh b/shared/updates.sh new file mode 100644 index 0000000..4291665 --- /dev/null +++ b/shared/updates.sh @@ -0,0 +1,80 @@ +#!/bin/bash + +echo "updater: Downloading update..." + +wget https://github.com/Minteck-Projects/Neutron-Core/archive/trunk.zip &>/dev/null +code=$? +if [[ $code -eq 0 ]]; then + echo "updater: Success" +else + echo "updater: Failed with code $code" + echo "updater: Cleaning up..." + rm -dr trunk.zip* + exit $code +fi + +echo "updater: Extracting..." + +unzip trunk.zip +code=$? +if [[ $code -eq 0 || $code -eq 2 ]]; then + echo "updater: Success" +else + echo "updater: Failed with code $code" + echo "updater: Cleaning up..." + rm -dr trunk.zip* + exit $code +fi + +echo "updater: Please wait while Updater prepare Neutron-Core to be installed..." + +rm -dr ./public/api +rm -dr ./public/cms-special +rm -dr ./public/widgets +rm -dr ./public/resources/css +rm -dr ./public/resources/image +rm -dr ./public/resources/fonts +rm -dr ./public/resources/i18n +rm -dr ./public/resources/js +rm -dr ./public/resources/lib +rm -dr ./public/resources/private +rm -dr ./public/index.php + +echo "updater: Installing..." + +cp -r Neutron-Core-trunk/* ./public/ +code=$? +if [[ $code -eq 0 ]]; then + echo "updater: Success" +else + echo "updater: Failed with code $code" + echo "updater: Cleaning up..." + rm -dr trunk.zip* + exit $code +fi + +rm -dr Neutron-Core-trunk/ +code=$? +if [[ $code -eq 0 ]]; then + echo "updater: Success" +else + echo "updater: Failed with code $code" + echo "updater: Cleaning up..." + rm -dr trunk.zip* + exit $code +fi + +echo "updater: Updating version..." +date +%Y%m%d-#-electrode > ./public/api/version +code=$? +if [[ $code -eq 0 ]]; then + echo "updater: Success" +else + echo "updater: Failed with code $code" + echo "updater: Cleaning up..." + rm -dr trunk.zip* + exit $code +fi + +echo "updater: Cleaning up..." +rm -dr trunk.zip* -- cgit