Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/vm.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Hansson <daniel@techandme.se>2017-04-09 23:43:30 +0300
committerGitHub <noreply@github.com>2017-04-09 23:43:30 +0300
commitab649db479a05da1589a2158f446eda699480c37 (patch)
tree3b88db4f4a2d5487db1f0edf3f5e14b165ede498 /static/update.sh
parent05001d9d2fe479f7a3f8fabdfb47f172c8b183e6 (diff)
Rewrite is now done! (#196)
Diffstat (limited to 'static/update.sh')
-rw-r--r--static/update.sh42
1 files changed, 27 insertions, 15 deletions
diff --git a/static/update.sh b/static/update.sh
index 1c325543..b2cc945b 100644
--- a/static/update.sh
+++ b/static/update.sh
@@ -1,33 +1,45 @@
#!/bin/bash
-## Tech and Me ## - ©2017, https://www.techandme.se/
-#
-# Tested on Ubuntu Server 14.04 & 16.04.
+# Tech and Me © - 2017, https://www.techandme.se/
+
+# shellcheck disable=2034,2059
+true
+# shellcheck source=lib.sh
+. <(curl -sL https://raw.githubusercontent.com/nextcloud/vm/master/lib.sh)
+
+# Check for errors + debug code and abort if something isn't right
+# 1 = ON
+# 0 = OFF
+DEBUG=0
+debug_mode
FILE=nextcloud_update.sh
-SCRIPTS=/var/scripts
# Must be root
-[[ `id -u` -eq 0 ]] || { echo "Must be root to run script, in Ubuntu type: sudo -i"; exit 1; }
+if ! is_root
+then
+ echo "Must be root to run script, in Ubuntu type: sudo -i"
+ exit 1
+fi
-mkdir -p $SCRIPTS
+mkdir -p "$SCRIPTS"
-if [ -f $SCRIPTS/$FILE ]
+if [ -f "$SCRIPTS/$FILE" ]
then
- rm $SCRIPTS/$FILE
- wget -q https://raw.githubusercontent.com/nextcloud/vm/master/$FILE -P $SCRIPTS
- bash $SCRIPTS/$FILE
+ rm -f "$SCRIPTS/$FILE"
+ wget -q "$GITHUB_REPO/$FILE" -P "$SCRIPTS"
+ bash "$SCRIPTS/$FILE"
else
- wget -q https://raw.githubusercontent.com/nextcloud/vm/master/$FILE -P $SCRIPTS
- bash $SCRIPTS/$FILE
+ wget -q "$GITHUB_REPO/$FILE" -P "$SCRIPTS"
+ bash "$SCRIPTS/$FILE"
fi
-chmod +x $SCRIPTS/$FILE
+chmod +x "$SCRIPTS/$FILE"
# Remove potenial copy of the same file
-if [ -f $SCRIPTS/$FILE.1 ]
+if [ -f "$SCRIPTS/$FILE*" ]
then
- rm $SCRIPTS/$FILE.1
+ rm -f "$SCRIPTS/$FILE*"
fi
exit