summaryrefslogtreecommitdiff
path: root/www
diff options
context:
space:
mode:
authorDavid Kaufmann <astra@ionic.at>2018-09-26 21:47:04 +0200
committerDavid Kaufmann <astra@ionic.at>2018-09-26 21:47:04 +0200
commit25886fa0be445ff684d2de3a302f81842837bb3a (patch)
tree430c20a03e2d0ca9625acdb46645fb267dfe8200 /www
parent493c3bcaead57e1a1cd14011eb99797e6e799c81 (diff)
downloadconfig-25886fa0be445ff684d2de3a302f81842837bb3a.tar.gz
mv load.sh to www
Diffstat (limited to 'www')
-rwxr-xr-x[l---------]www/load.sh35
1 files changed, 34 insertions, 1 deletions
diff --git a/www/load.sh b/www/load.sh
index b7b8324..82e8420 120000..100755
--- a/www/load.sh
+++ b/www/load.sh
@@ -1 +1,34 @@
-../bin/load.sh \ No newline at end of file
+#!/bin/sh
+
+URL="http://pluto.fsinf.at/~astra/config/"
+FILE="skel.tar.gz"
+
+cd ${HOME}
+
+# fetch file from server
+TMP=`mktemp -u "config-updater-XXXXXX"`
+curl -L -s "${URL}${FILE}" -o $TMP.tar.gz
+
+# check if file exists and is not empty
+if [ -e $TMP.tar.gz ]; then
+ if [ -s $TMP.tar.gz ]; then
+ # run pre-update commands if file exists
+ if [ -r ${HOME}/var/system/config-updater/pre-update ]; then
+ . ${HOME}/var/system/config-updater/pre-update
+ fi
+
+ # unpack new structure
+ tar -xzf $TMP.tar.gz --strip-components=1
+
+ # run post-update commands if file exists
+ if [ -r ${HOME}/var/system/config-updater/post-update ]; then
+ . ${HOME}/var/system/config-updater/post-update
+ fi
+ else
+ echo "Could not fetch updated config, $TMP.tar.gz is empty"
+ fi
+else
+ echo "Could not fetch updated config, $TMP.tar.gz is missing"
+fi
+
+rm -f $TMP.tar.gz