From a8ac16bbe29d2c8462105efec7668cda90f5adfc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Mon, 26 Jan 2015 13:55:21 +0100 Subject: [PATCH] add tinc-update --- tinc-update | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100755 tinc-update diff --git a/tinc-update b/tinc-update new file mode 100755 index 0000000..105dc68 --- /dev/null +++ b/tinc-update @@ -0,0 +1,33 @@ +#!/bin/sh +set -eu + +has() { + command -v "$1" >/dev/null 2>&1 +} + +die() { + echo $1 &>2 + exit 1 +} + +if has git; then + echo "Git pull..." + git pull origin master +else + die "git not found. install git to use this script" +fi + +reload_tinc() { + echo "Reload tinc..." + sudo tinc -c . reload +} + +if [[ $EUID -ne 0 ]]; then + if has sudo; then + reload_tinc + else + die "run this script as root" + fi +else + reload_tinc +fi