tinc-debug: only sudo if necessary

This commit is contained in:
Jörg Thalheim 2015-01-26 14:26:01 +01:00
parent a8bb6f609e
commit 148d9fe0e1
1 changed files with 4 additions and 7 deletions

View File

@ -17,17 +17,14 @@ 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
echo "Reload tinc..."
sudo tinc -c . reload
else
die "run this script as root"
fi
else
reload_tinc
echo "Reload tinc..."
tinc -c . reload
fi