evenet/tinc-update

31 lines
420 B
Plaintext
Raw Permalink Normal View History

2015-01-26 12:55:21 +00:00
#!/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
if [[ $EUID -ne 0 ]]; then
if has sudo; then
2015-01-26 13:26:01 +00:00
echo "Reload tinc..."
sudo tinc -c . reload
2015-01-26 12:55:21 +00:00
else
die "run this script as root"
fi
else
2015-01-26 13:26:01 +00:00
echo "Reload tinc..."
tinc -c . reload
2015-01-26 12:55:21 +00:00
fi