diff options
author | makefu <github@syntax-fehler.de> | 2014-03-09 22:32:48 +0100 |
---|---|---|
committer | makefu <github@syntax-fehler.de> | 2014-03-09 22:32:48 +0100 |
commit | 0970f673456cf8bef932aef048bb89f6178eb104 (patch) | |
tree | 6e0151b3b614a6569d68db7f1256567809457eda /ship | |
parent | d352ce6c3d6d8f7d4588dbf51ea479f2af89a7b2 (diff) |
ship:implement ncdc configuration
Diffstat (limited to 'ship')
-rw-r--r-- | ship/lib/filehooker | 18 | ||||
-rw-r--r-- | ship/src/filehooker_configure_ncdc | 15 | ||||
-rw-r--r-- | ship/src/filehooker_configure_netshare | 6 |
3 files changed, 31 insertions, 8 deletions
diff --git a/ship/lib/filehooker b/ship/lib/filehooker index bd658c42..a6987733 100644 --- a/ship/lib/filehooker +++ b/ship/lib/filehooker @@ -1,14 +1,12 @@ #@include core - -netshare= -dc_hub=${dc_hub:-adcs://localhost:2781} ncdc_user=${ncdc_user:-hooker} - +ncdc_bin=${ncdc_bin:-/usr/bin/ncdc} ncdc_config(){ # maybe we want to use the running ncdc process and communicate via tmux send-keys ? - (sleep 1;cat;printf "/quit\n") | sudo -u $ncdc_user + (sleep 1;cat;printf "/quit\n") | sudo -u $ncdc_user "$ncdc_bin" } + ncdc_configure_netshare(){ :${1?provide path to share} rnd=`hexdump -n 2 -e '/2 "%u"' /dev/urandom` @@ -25,15 +23,19 @@ ncdc_configure_nick(){ echo "/nick $nick" | ncdc_config } ncdc_configure_hub(){ - hub=${1:-$dc_hub} + rnd=`hexdump -n 2 -e '/2 "%u"' /dev/urandom` + hubname="hub_$rnd" + hub=${1?adcs://localhost:2781} info "configuring DC Hub: $hub, activating autconnect" - (echo "/open c1 ${hub}" ; + (echo "/open ${hubname} ${hub}" ; echo "/hset autoconnect true") | ncdc_config } ncdc_install(){ -curl http://dev.yorhel.nl/download/ncdc-linux-x86_64-1.19.tar.gz | tar xz -C /usr/bin/ +install_dir="$(dirname "${ncdc_bin}")" +info "installing ncdc to $install_dir" +curl http://dev.yorhel.nl/download/ncdc-linux-x86_64-1.19.tar.gz | tar xz -C "$install_dir" useradd -m $ncdc_user ||: } diff --git a/ship/src/filehooker_configure_ncdc b/ship/src/filehooker_configure_ncdc new file mode 100644 index 00000000..c980ebf2 --- /dev/null +++ b/ship/src/filehooker_configure_ncdc @@ -0,0 +1,15 @@ +#!/bin/sh +#@info +#@strict +#@include filehooker + +dc_hub="adcs://elch.nsupdate.info:2781" +rnd=`hexdump -n 2 -e '/2 "%u"' /dev/urandom` +nick="filehooker_$rnd" + + +ncdc_install +ncdc_autostart + +ncdc_configure_nick "$nick" +ncdc_configure_hub "$dc_hub" diff --git a/ship/src/filehooker_configure_netshare b/ship/src/filehooker_configure_netshare new file mode 100644 index 00000000..ffd53e08 --- /dev/null +++ b/ship/src/filehooker_configure_netshare @@ -0,0 +1,6 @@ +#!/bin/sh +#@info +#@strict +#@include filehooker + +ncdc_configure_netshare "${1?provide share folder}" |