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

View File

@ -17,17 +17,14 @@ else
die "git not found. install git to use this script" die "git not found. install git to use this script"
fi fi
reload_tinc() {
echo "Reload tinc..."
sudo tinc -c . reload
}
if [[ $EUID -ne 0 ]]; then if [[ $EUID -ne 0 ]]; then
if has sudo; then if has sudo; then
reload_tinc echo "Reload tinc..."
sudo tinc -c . reload
else else
die "run this script as root" die "run this script as root"
fi fi
else else
reload_tinc echo "Reload tinc..."
tinc -c . reload
fi fi