From 14ee58ef4e9dfda2bbb41044025e7d51910a1173 Mon Sep 17 00:00:00 2001
From: makefu <github@syntax-fehler.de>
Date: Mon, 24 Mar 2014 16:17:16 +0100
Subject: make filehooker lib try to use tmux channel if ncdc is already
 running

---
 filehooker/root-image/krebs/lib/filehooker | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/filehooker/root-image/krebs/lib/filehooker b/filehooker/root-image/krebs/lib/filehooker
index f6f4c0a7..d30fb519 100644
--- a/filehooker/root-image/krebs/lib/filehooker
+++ b/filehooker/root-image/krebs/lib/filehooker
@@ -5,9 +5,12 @@
 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 "$ncdc_bin"
+    txt="$(cat)"
+    (sleep 1;printf "%s" "$txt";printf "/quit\n") | sudo -u $ncdc_user "$ncdc_bin" 2>/dev/null || \
+       sudo -u $ncdc_user /usr/bin/tmux send-keys -t dcpp:ncdc "$txt"  C-m
 }
 
 ncdc_configure_netshare(){
-- 
cgit v1.2.3