From a4bde9ae3273eceb125d2916baa78fd6714aa75a Mon Sep 17 00:00:00 2001 From: David Kaufmann Date: Wed, 26 Apr 2017 01:11:19 +0200 Subject: add config updater --- home/bin/config-update.sh | 25 +++++++++++++++++++++++++ home/var/system/config-updater/post-update | 1 + home/var/system/config-updater/pre-update | 1 + 3 files changed, 27 insertions(+) create mode 100755 home/bin/config-update.sh create mode 100644 home/var/system/config-updater/post-update create mode 100644 home/var/system/config-updater/pre-update (limited to 'home') diff --git a/home/bin/config-update.sh b/home/bin/config-update.sh new file mode 100755 index 0000000..a0dc1bb --- /dev/null +++ b/home/bin/config-update.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +URL="http://pluto.fsinf.at/~astra/config/" +FILE="skel.tar.gz" + +cd ${HOME} + +# fetch file from server +TMP=`mktemp -u --suffix=".tar.gz" "config-updater-XXXXXX"` +curl -s "${URL}${FILE}" > $TMP + +# check if file is empty +if [ -s $TMP ]; then + if [ -r ${HOME}/var/system/config-updater/pre-update ]; then + source ${HOME}/var/system/config-updater/pre-update + fi + tar -xzf $TMP --strip-components=1 + if [ -r ${HOME}/var/system/config-updater/pre-update ]; then + source ${HOME}/var/system/config-updater/pre-update + fi +else + echo "Could not fetch updated config, $TMP is empty" +fi + +rm -f $TMP diff --git a/home/var/system/config-updater/post-update b/home/var/system/config-updater/post-update new file mode 100644 index 0000000..4985512 --- /dev/null +++ b/home/var/system/config-updater/post-update @@ -0,0 +1 @@ +rm -f this_file_will_be_deleted diff --git a/home/var/system/config-updater/pre-update b/home/var/system/config-updater/pre-update new file mode 100644 index 0000000..ad97a25 --- /dev/null +++ b/home/var/system/config-updater/pre-update @@ -0,0 +1 @@ +rm -rf .vim -- cgit v1.2.3