From d174fcedcb9c9e9d3af21035de5a0be1d7e165b6 Mon Sep 17 00:00:00 2001 From: fbt Date: Mon, 19 Jan 2015 16:59:09 +0300 Subject: [PATCH 1/2] code cleanup --- init.d/lo.iface | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/init.d/lo.iface b/init.d/lo.iface index 2ad1484..a62c25a 100755 --- a/init.d/lo.iface +++ b/init.d/lo.iface @@ -9,8 +9,8 @@ wait_for_iface() { local iface="$1" timer='0' timeout='6' until [[ "ip link show $iface up" ]]; do - [[ "$timer" -ge "$timeout" ]] && { return 1; } - timer=$[timer+1] + (( timer >= timeout )) && { return 1; } + (( timer++ )) done } From 1502ea1931f19b24eb151302ec185c53284e9e71 Mon Sep 17 00:00:00 2001 From: fbt Date: Mon, 26 Jan 2015 12:38:29 +0300 Subject: [PATCH 2/2] cjdroute --- init.d/cjdroute | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/init.d/cjdroute b/init.d/cjdroute index 798404e..cdf9555 100755 --- a/init.d/cjdroute +++ b/init.d/cjdroute @@ -2,8 +2,8 @@ # Two warnings: # 1) This script uses a script to run cjdroute and feed it # the config. It can be found in the main cjdns repo: -# contrib/bash/run-cjdroute.bash -# Or here: http://sprunge.us/gYKX +# contrib/sh/run-cjdroute.sh +# Or here: http://ix.io/fYT # 2) service_respawn is disabled by default because you need # "noBackground":1 in cjdroute.conf for it to actually work. # Barely. @@ -12,8 +12,6 @@ unset reload #service_respawn=true service_command='/usr/bin/run-cjdroute' - -cjdroute_config='/etc/cjdroute.conf' cjdroute_admin_port='11234' cjdroute.check_tun_module() { @@ -27,12 +25,6 @@ cjdroute.check_tun_module() { start() { cjdroute.check_tun_module || { return 1; } - - [[ -e "$cjdroute_config" ]] || { - watchman.err "$cjdroute_config does not exist, please create it by running cjdroute --genconf >> /etc/cjdroute.conf" - return 1 - } - watchman.start } @@ -40,7 +32,7 @@ stop() { [[ "$service_respawn" == 'true' ]] && { watchman.stop; } # stopping the watchdog # Stopping the actual s-o-b daemon that won't die properly. - cjdroute_control_pid=`lsof -i :"$cjdroute_admin_port" | tail -1 | cut -d ' ' -f 2` + cjdroute_control_pid=$(lsof -i :"$cjdroute_admin_port" | tail -1 | cut -d ' ' -f 2) watchman.pid_check "$cjdroute_control_pid" && { kill "$cjdroute_control_pid" watchman.pid_wait "$cjdroute_control_pid"