From 25886fa0be445ff684d2de3a302f81842837bb3a Mon Sep 17 00:00:00 2001 From: David Kaufmann Date: Wed, 26 Sep 2018 21:47:04 +0200 Subject: mv load.sh to www --- www/load.sh | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) mode change 120000 => 100755 www/load.sh (limited to 'www') diff --git a/www/load.sh b/www/load.sh deleted file mode 120000 index b7b8324..0000000 --- a/www/load.sh +++ /dev/null @@ -1 +0,0 @@ -../bin/load.sh \ No newline at end of file diff --git a/www/load.sh b/www/load.sh new file mode 100755 index 0000000..82e8420 --- /dev/null +++ b/www/load.sh @@ -0,0 +1,34 @@ +#!/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 -- cgit v1.2.3