34 lines
422 B
Plaintext
34 lines
422 B
Plaintext
|
#!/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
|