summaryrefslogtreecommitdiffstats
path: root/retiolum/scripts/autostart/create-startup.sh
blob: 37edb972839e5ff8384b9b8d8a3e9f363a8d010f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/sh

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

readlink="`readlink -f "$0"`"
dirname="`dirname "$0"`"
cd "$dirname"

if [ -e /etc/init.d ];then
  INIT_FOLDER=/etc/init.d 
	update-rc.d tinc defaults #TODO debian specific
else
  INIT_FOLDER=/etc/rc.d
	echo "add tinc to DAEMONS in /etc/rc.conf" #TODO archlinux specific
fi

echo "retiolum" > /etc/tinc/nets.boot
cp -a tinc $INIT_FOLDER