From 718bfb6ac6f684fc740eaad037aabef790c33f99 Mon Sep 17 00:00:00 2001 From: jim-p Date: Fri, 9 May 2014 13:34:19 -0400 Subject: Make tinc pkg respect proper clog path for >= 2.1.3 --- config/tinc/status_tinc.php | 20 ++++++++++++++++++-- config/tinc/tinc.xml | 2 +- 2 files changed, 19 insertions(+), 3 deletions(-) (limited to 'config/tinc') diff --git a/config/tinc/status_tinc.php b/config/tinc/status_tinc.php index 725ccce6..cd7b0aad 100644 --- a/config/tinc/status_tinc.php +++ b/config/tinc/status_tinc.php @@ -6,7 +6,15 @@ require("guiconfig.inc"); function tinc_status_1() { exec("/usr/local/sbin/tincd --config=/usr/local/etc/tinc -kUSR1"); usleep(500000); - exec("/usr/sbin/clog /var/log/tinc.log | sed -e 's/.*tinc\[.*\]: //'",$result); + $clog_path = ""; + $result = array(); + if (is_executable("/usr/local/sbin/clog")) { + $clog_path = "/usr/local/sbin/clog"; + } elseif (is_executable("/usr/sbin/clog")) { + $clog_path = "/usr/sbin/clog"; + + if (!empty($clog_path)) + exec("{$clog_path} /var/log/tinc.log | sed -e 's/.*tinc\[.*\]: //'",$result); $i=0; foreach($result as $line) { @@ -30,7 +38,15 @@ function tinc_status_1() { function tinc_status_2() { exec("/usr/local/sbin/tincd --config=/usr/local/etc/tinc -kUSR2"); usleep(500000); - exec("/usr/sbin/clog /var/log/tinc.log | sed -e 's/.*tinc\[.*\]: //'",$result); + $clog_path = ""; + $result = array(); + if (is_executable("/usr/local/sbin/clog")) { + $clog_path = "/usr/local/sbin/clog"; + } elseif (is_executable("/usr/sbin/clog")) { + $clog_path = "/usr/sbin/clog"; + + if (!empty($clog_path)) + exec("{$clog_path} /var/log/tinc.log | sed -e 's/.*tinc\[.*\]: //'",$result); $i=0; foreach($result as $line) { diff --git a/config/tinc/tinc.xml b/config/tinc/tinc.xml index f016dd41..183ae161 100644 --- a/config/tinc/tinc.xml +++ b/config/tinc/tinc.xml @@ -42,7 +42,7 @@ Describe your package requirements here Currently there are no FAQ items provided. tinc - 1.0.21 v1.1 + 1.0.23 v1.2.1 VPN: tinc -- cgit v1.2.3 From 9e6166c1047d1310646b4f42690e9f5130a8ae86 Mon Sep 17 00:00:00 2001 From: PiBa-NL Date: Tue, 13 May 2014 00:16:26 +0200 Subject: fix tinc status page. --- config/tinc/status_tinc.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'config/tinc') diff --git a/config/tinc/status_tinc.php b/config/tinc/status_tinc.php index cd7b0aad..86ad5b29 100644 --- a/config/tinc/status_tinc.php +++ b/config/tinc/status_tinc.php @@ -12,8 +12,9 @@ function tinc_status_1() { $clog_path = "/usr/local/sbin/clog"; } elseif (is_executable("/usr/sbin/clog")) { $clog_path = "/usr/sbin/clog"; + } - if (!empty($clog_path)) + if (!empty($clog_path)) { exec("{$clog_path} /var/log/tinc.log | sed -e 's/.*tinc\[.*\]: //'",$result); $i=0; foreach($result as $line) @@ -32,7 +33,8 @@ function tinc_status_1() { $output .= $line . "\n"; $i++; } - return $output; + } + return $output; } function tinc_status_2() { @@ -44,8 +46,9 @@ function tinc_status_2() { $clog_path = "/usr/local/sbin/clog"; } elseif (is_executable("/usr/sbin/clog")) { $clog_path = "/usr/sbin/clog"; + } - if (!empty($clog_path)) + if (!empty($clog_path)) { exec("{$clog_path} /var/log/tinc.log | sed -e 's/.*tinc\[.*\]: //'",$result); $i=0; foreach($result as $line) @@ -64,7 +67,8 @@ function tinc_status_2() { $output .= $line . "\n"; $i++; } - return $output; + } + return $output; } $shortcut_section = "tinc"; -- cgit v1.2.3 From 81714335cddd6a59c21cd1b48fb1c07286722d9c Mon Sep 17 00:00:00 2001 From: PiBa-NL Date: Wed, 14 May 2014 19:26:52 +0200 Subject: tinc, as commented on previous commit removed {...} block around the for-loops + whitespace changed to tabs --- config/tinc/status_tinc.php | 70 ++++++++++++++++++++++----------------------- 1 file changed, 34 insertions(+), 36 deletions(-) (limited to 'config/tinc') diff --git a/config/tinc/status_tinc.php b/config/tinc/status_tinc.php index 86ad5b29..f50ea640 100644 --- a/config/tinc/status_tinc.php +++ b/config/tinc/status_tinc.php @@ -14,25 +14,24 @@ function tinc_status_1() { $clog_path = "/usr/sbin/clog"; } - if (!empty($clog_path)) { + if (!empty($clog_path)) exec("{$clog_path} /var/log/tinc.log | sed -e 's/.*tinc\[.*\]: //'",$result); - $i=0; - foreach($result as $line) - { - if(preg_match("/Connections:/",$line)) - $begin=$i; - if(preg_match("/End of connections./",$line)) - $end=$i; - $i++; - } - $output=""; - $i=0; - foreach($result as $line) - { - if($i >= $begin && $i<= $end) - $output .= $line . "\n"; - $i++; - } + $i=0; + foreach($result as $line) + { + if(preg_match("/Connections:/",$line)) + $begin=$i; + if(preg_match("/End of connections./",$line)) + $end=$i; + $i++; + } + $output=""; + $i=0; + foreach($result as $line) + { + if($i >= $begin && $i<= $end) + $output .= $line . "\n"; + $i++; } return $output; } @@ -48,25 +47,24 @@ function tinc_status_2() { $clog_path = "/usr/sbin/clog"; } - if (!empty($clog_path)) { + if (!empty($clog_path)) exec("{$clog_path} /var/log/tinc.log | sed -e 's/.*tinc\[.*\]: //'",$result); - $i=0; - foreach($result as $line) - { - if(preg_match("/Statistics for Generic BSD tun device/",$line)) - $begin=$i; - if(preg_match("/End of subnet list./",$line)) - $end=$i; - $i++; - } - $output=""; - $i=0; - foreach($result as $line) - { - if($i >= $begin && $i<= $end) - $output .= $line . "\n"; - $i++; - } + $i=0; + foreach($result as $line) + { + if(preg_match("/Statistics for Generic BSD tun device/",$line)) + $begin=$i; + if(preg_match("/End of subnet list./",$line)) + $end=$i; + $i++; + } + $output=""; + $i=0; + foreach($result as $line) + { + if($i >= $begin && $i<= $end) + $output .= $line . "\n"; + $i++; } return $output; } -- cgit v1.2.3