diff options
Diffstat (limited to 'modules')
-rwxr-xr-x | modules/retiolum/bin/update_tinc_hosts | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/modules/retiolum/bin/update_tinc_hosts b/modules/retiolum/bin/update_tinc_hosts new file mode 100755 index 00000000..623ea315 --- /dev/null +++ b/modules/retiolum/bin/update_tinc_hosts @@ -0,0 +1,29 @@ +#!/bin/sh +DIRNAME=`dirname $0` +HERE=`readlink -f ${DIRNAME}` + +if test `id -u` != 0; then + echo "we're going sudo..." >&2 + exec sudo "$0" "$@" + exit 23 # go to hell +fi + +case $1 in + start) + $0 stop + echo "# BEGIN OF RETIOLUM" >> /etc/hosts + $HERE/hosts >> /etc/hosts + echo "# END OF RETIOLUM" >> /etc/hosts + + ;; + stop) + sed -ie "/\# BEGIN OF RETIOLUM/,/\# END OF RETIOLUM/d" /etc/hosts + ;; + restart) + $0 stop + $0 start + ;; + *) + echo "You are made of stupid!" + exit 23 +esac |