summaryrefslogtreecommitdiffstats
path: root/retiolum/scripts
diff options
context:
space:
mode:
authormakefu <root@pigstarter.de>2013-05-21 09:35:13 +0200
committermakefu <root@pigstarter.de>2013-05-21 09:35:24 +0200
commit6969ff5928efce07a66c8b28bebc596918ce494a (patch)
tree1596300ebefcdb1d2ad5131b1078a205c58fe8a0 /retiolum/scripts
parent13218101e633fcfd163e5e677d02851615fc47c9 (diff)
telnet binary will now be found: use either telnet or busybox
Diffstat (limited to 'retiolum/scripts')
-rwxr-xr-xretiolum/scripts/tinc_setup/new_install.sh19
1 files changed, 17 insertions, 2 deletions
diff --git a/retiolum/scripts/tinc_setup/new_install.sh b/retiolum/scripts/tinc_setup/new_install.sh
index 8c7d4af8..bd057cf8 100755
--- a/retiolum/scripts/tinc_setup/new_install.sh
+++ b/retiolum/scripts/tinc_setup/new_install.sh
@@ -34,6 +34,7 @@ IRCSERVER=${IRCSERVER:-"irc.freenode.net"}
IRCPORT=${IRCPORT:-6667}
OS=${OS:-0}
+TELNET=${TELNET:-}
IP4=${IP4:-0}
IP6=${IP6:-0}
@@ -119,6 +120,18 @@ find_os()
fi
}
+find_telnet(){
+ if command -v telnet >/dev/null;then
+ TELNET="`command -v telnet`"
+ elif command -v busybox >/dev/null;then
+ TELNET="`command -v busybox` telnet"
+ else
+ echo "cannot find telnet binary, please install either telnet-client or busybox"
+ echo "bailing out!"
+ exit 1
+ fi
+}
+
if [ $IP4 -eq 0 ]; then
RAND4=1
elif ! check_ip_valid4 $IP4; then
@@ -136,7 +149,9 @@ fi
if [ $OS -eq 0 ]; then
find_os
fi
-
+if [ -z "$TELNET" ]; then
+ find_telnet
+fi
#check if everything is installed
if ! exists awk ; then
echo "Please install awk"
@@ -334,7 +349,7 @@ NICK="${HOSTN}_$(head /dev/urandom | tr -dc "0123456789" | head -c3)"
sleep 23;
echo "PRIVMSG $IRCCHANNEL : This is $HOSTN";
sed "s/^\(.*\)/PRIVMSG $IRCCHANNEL : \1/" hosts/$HOSTN;
- sleep 5; ) | telnet $IRCSERVER $IRCPORT
+ sleep 5; ) | $TELNET $IRCSERVER $IRCPORT
# finish what you have begun!