From 5c9d8118729c2e5524324bc340da45405ce69505 Mon Sep 17 00:00:00 2001 From: makefu Date: Sun, 9 Mar 2014 12:45:23 +0100 Subject: add filehooker ncdc pseudocode --- ship/lib/filehooker | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 ship/lib/filehooker (limited to 'ship') diff --git a/ship/lib/filehooker b/ship/lib/filehooker new file mode 100644 index 00000000..fac84b93 --- /dev/null +++ b/ship/lib/filehooker @@ -0,0 +1,56 @@ +#@include core +#@include tmux +# +netshare= +dc_hub=${dc_hub:-adcs://localhost:2781} +ncdc_user=hooker +ncdc_install(){ +curl http://dev.yorhel.nl/download/ncdc-linux-x86_64-1.19.tar.gz | tar xz -C /usr/bin/ +} + + + +ncdc_configure(){ + # 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 +# not implemented yet +# /set active +# /share $random $netshare +: +} +ncdc_configure_netshare(){ + :${1?provide path to share} + rnd=`hexdump -n 2 -e '/2 "%u"' /dev/urandom` + rnd_name="share_$rnd" + info "setting active as true" + info "adding share" + (echo "/set active true" ; + echo "/share $rnd_name $1") | ncdc_configure + +} +ncdc_configure_hub(){ + info "configuring DC Hub: $dc_hub, activating autconnect" + (echo "/open c1 $dc_hub" ; + echo "/hset autoconnect true") | ncdc_configure +} +ncdc_autostart(){ +# only systemd +# punani install tmux +cat > /etc/systemd/system/ncdc@.service <