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