diff options
author | Felix Richter <Felix.Richter@syntax-fehler.de> | 2011-05-27 22:58:53 +0200 |
---|---|---|
committer | Felix Richter <Felix.Richter@syntax-fehler.de> | 2011-05-27 22:58:53 +0200 |
commit | b253c118a9455ecec755271432cd761dae3bf975 (patch) | |
tree | 86e20652cd0f188858027f43f80d618656e99834 /modules/retiolum | |
parent | e338c4d436efcb2661740a7d49fdc782b8a8a4e0 (diff) |
added script to start and stop name resolution via hosts file
using magic line will always work because sed will look for the longest match.
update_tinc_hosts is made to be daemonized and to be started with tinc
Diffstat (limited to 'modules/retiolum')
-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 |