From 732876299f4dccb4caa3a915879d2b5945bbdd42 Mon Sep 17 00:00:00 2001 From: makefu Date: Wed, 2 Apr 2014 11:15:54 +0200 Subject: filehooker is now elchOS --- filehooker/root-image/krebs/lib/retiolum | 99 -------------------------------- 1 file changed, 99 deletions(-) delete mode 100644 filehooker/root-image/krebs/lib/retiolum (limited to 'filehooker/root-image/krebs/lib/retiolum') diff --git a/filehooker/root-image/krebs/lib/retiolum b/filehooker/root-image/krebs/lib/retiolum deleted file mode 100644 index 1e55041c..00000000 --- a/filehooker/root-image/krebs/lib/retiolum +++ /dev/null @@ -1,99 +0,0 @@ -#!/bin/sh -# retiolum host functions -#@include core -#@include network -tinc_path=${tinc_path:-/etc/tinc} -netname=${netname:-retiolum} -hosts_dir=${hosts_dir:-$tinc_path/$netname/hosts} -supernode_urls="http://euer.krebsco.de/retiolum/supernodes.tar.gz" -reload_tinc(){ - info "reloading tinc configuration" - pkill -HUP tincd || tinc -n $netname reload; -} - -refresh_supernode_keys(){ - for url in $supernode_urls;do - info "Trying $url to retrieve supernodes" - if http_get "$url" \ - | tar xvz -C $hosts_dir | xargs -n1 echo "refreshed:" ;then - info "refreshed supernode keys" - return 0 - else - error "$url unusable for retrieving supernode host files" - fi - done && return 1 -} - -find_supernodes(){ - cd $hosts_dir - set +f - for name in ` - grep '^[ ]*Address[ ]*=' * | - cut -d: -f1 | sort | uniq - `; do - if eval "`sed -n ' - s/[ ]\+//g - s/^\(Address\|Port\)=\(.*\)/\1="\${\1+\$\1\n}\2"/p - ' $name`"; then - port=${Port-655} - for host in $Address; do - if nc -zw 2 $host $port 2>/dev/null; then - echo "$name [('$host', $port)]" - fi & - done - wait - fi & - done - wait - cd - >/dev/null -} - -find_active_nodes(){ - # TODO this function currently only supports a single address for a host - cd $hosts_dir - # posix grep does not support [[:space:]] - set +f - for name in ` - grep '^[ ]*Address[ ]*=' * | - cut -d: -f1 | sort | uniq - `; do - if eval "`sed -n ' - s/[ ]\+//g - s/^\(Address\|Port\)=\(.*\)/\1="\${\1+\$\1\n}\2"/p - ' $name`"; then - port=${Port-655} - for host in $Address; do - if nc -zw 2 $host $port 2>/dev/null; then - echo "$name [('$host', $port)]" - fi & - done - wait - fi & - done - wait - cd - >/dev/null -} - -check_free_v4(){ - myipv4=${1-10.243.0.-1} - v4num=${myipv4##*.} - printf "Retard check: " - if [ "$v4num" -gt 0 -a "$v4num" -lt "256" ]; - then - info "No retard detected\n" - cd $hosts_dir - info "Check if ip is still free: " - for i in `ls -1`; do - if grep -q -e $myipv4\$ $i ;then - error "Host IP already taken by $i! " - return 1 - fi - done - info "Passed\n" - return 0 - else - error "you are made of stupid. bailing out\n" - return 1 - fi - cd - >/dev/null -} -- cgit v1.2.3