aboutsummaryrefslogtreecommitdiff
path: root/shared/updates.sh
diff options
context:
space:
mode:
authorMinteck <freeziv.ytb@gmail.com>2021-03-07 18:29:17 +0100
committerMinteck <freeziv.ytb@gmail.com>2021-03-07 18:29:17 +0100
commit0f79e708bf07721b73ea41e5d341be08e8ea4dce (patch)
treef3c63cd6a9f4ef0b26f95eec6a031600232e80c8 /shared/updates.sh
downloadelectrode-0f79e708bf07721b73ea41e5d341be08e8ea4dce.tar.gz
electrode-0f79e708bf07721b73ea41e5d341be08e8ea4dce.tar.bz2
electrode-0f79e708bf07721b73ea41e5d341be08e8ea4dce.zip
Initial commit
Diffstat (limited to 'shared/updates.sh')
-rw-r--r--shared/updates.sh80
1 files changed, 80 insertions, 0 deletions
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*