#! /bin/sh
set -euf

if test "${nosudo-false}" != true -a `id -u` != 0; then
  echo "we're going sudo..." >&2
  exec sudo "$0" "$@"
  exit 23 # go to hell
fi

# cd //retiolum
cd $(dirname $(readlink -f $0))/..

mkdir -p /etc/tinc/retiolum/hosts
rsync -va --delete hosts/ /etc/tinc/retiolum/hosts/