evenet/tinc-debug

39 lines
623 B
Plaintext
Raw Normal View History

2015-01-26 13:26:18 +00:00
#!/usr/bin/env bash
if [ -z "$BASH" ]; then
echo "All vpn scripts requires bash!"
exit 1
fi
2015-01-26 13:37:42 +00:00
set -eu
die() {
echo $1 &>2
exit 1
}
warn() {
echo $1 &>2
}
2015-01-26 13:26:18 +00:00
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
2015-01-26 13:37:42 +00:00
if [ ! -f "$DIR/ed25519_key.priv" ]; then
warn "No ed25519_key.priv found!"
fi
if [ ! -f "$DIR/rsa_key.priv" ]; then
warn "No rsa_key.priv found!"
fi
2015-01-26 13:26:18 +00:00
if [[ $EUID -ne 0 ]]; then
if has sudo; then
echo "Start tinc. Cancel with Ctrl+C ..."
sudo tincd -c "$DIR" -D -d
else
die "run this script as root"
fi
else
echo "Start tinc. Cancel with Ctrl+C ..."
tincd -c "$DIR" -D -d
fi