From 9c8bc8e3b3ea229129a180c01a0a15311b0b3962 Mon Sep 17 00:00:00 2001 From: Joe Prochazka Date: Mon, 2 May 2016 16:42:32 -0400 Subject: [PATCH 1/7] added option to use Nginx. --- bash/decoders/dump1090-mutability.sh | 42 +++++++++++++++++++++++----- 1 file changed, 35 insertions(+), 7 deletions(-) diff --git a/bash/decoders/dump1090-mutability.sh b/bash/decoders/dump1090-mutability.sh index 6556f8c..f84d084 100755 --- a/bash/decoders/dump1090-mutability.sh +++ b/bash/decoders/dump1090-mutability.sh @@ -50,6 +50,19 @@ echo "https://github.com/mutability/dump1090" echo -e "\033[37m" read -p "Press enter to continue..." CONTINUE +## ASK WHICH WEB SERVER TO INSTALL + +echo -e "\033[31m" +echo "Select Web Server" +echo -e "\033[33m" +echo "Select the web server you wish to use." +echo "Currently Lighttpd is the recommended web server." +echo "" +echo " 1) Lighttpd" +echo " 2) Nginx" +echo -e "\033[37m" +read -p "Which web server do you wish to use? [1] " WEBSERVER + ## CHECK FOR PREREQUISITE PACKAGES echo -e "\033[33m" @@ -64,7 +77,13 @@ CheckPackage rtl-sdr CheckPackage librtlsdr-dev CheckPackage libusb-1.0-0-dev CheckPackage pkg-config -CheckPackage lighttpd + +if [[ $WEBSERVER != "2" ]]; then + CheckPackage lighttpd +else + CheckPackage nginx +fi + CheckPackage fakeroot ## DOWNLOAD OR UPDATE THE DUMP1090-MUTABILITY SOURCE @@ -118,13 +137,22 @@ if [ $(dpkg-query -W -f='${STATUS}' dump1090-mutability 2>/dev/null | grep -c "o kill -9 `ps --pid $$ -oppid=`; exit fi -## CONFIGURE LIGHTTPD +## CONFIGURE THE WEB SERVER -echo -e "\033[33m" -echo "Configuring lighttpd..." -echo -e "\033[37m" -sudo lighty-enable-mod dump1090 -sudo /etc/init.d/lighttpd force-reload +if [[ $WEBSERVER != "2" ]]; then + echo -e "\033[33m" + echo "Configuring lighttpd..." + echo -e "\033[37m" + sudo lighty-enable-mod dump1090 + sudo /etc/init.d/lighttpd force-reload +else + echo -e "\033[33m" + echo "Configuring nginx..." + echo -e "\033[37m" + sudo rm /etc/nginx/sites-enabled/default + sudo ln -s /etc/nginx/sites-available/dump1090-mutability /etc/nginx/sites-enabled/dump1090-mutability + sudo /etc/init.d/nginx force-reload +fi ## DUMP1090-MUTABILITY POST INSTALLATION CONFIGURATION From c79339fecbe47d11c70eb7d210655bd8cd35c200 Mon Sep 17 00:00:00 2001 From: Joe Prochazka Date: Tue, 3 May 2016 16:50:08 -0400 Subject: [PATCH 2/7] Added MySQL databse size function. --- build/portal/html/admin/index.php | 1 + build/portal/html/classes/common.class.php | 34 ++++++++++++++++++++-- 2 files changed, 32 insertions(+), 3 deletions(-) diff --git a/build/portal/html/admin/index.php b/build/portal/html/admin/index.php index 30acdf2..3d07863 100644 --- a/build/portal/html/admin/index.php +++ b/build/portal/html/admin/index.php @@ -523,6 +523,7 @@
Purge Positions
+

Current Database Size: getDatabaseSize("mb"); ?>MB


> diff --git a/build/portal/html/classes/common.class.php b/build/portal/html/classes/common.class.php index dc86b5b..b5d39ef 100644 --- a/build/portal/html/classes/common.class.php +++ b/build/portal/html/classes/common.class.php @@ -144,11 +144,11 @@ $dbh = NULL; } } - + function deleteSetting($name) { require_once($_SERVER['DOCUMENT_ROOT'].DIRECTORY_SEPARATOR."classes".DIRECTORY_SEPARATOR."settings.class.php"); $settings = new settings(); - + if ($settings::db_driver == "xml") { $xmlSettings = simplexml_load_file($_SERVER['DOCUMENT_ROOT'].DIRECTORY_SEPARATOR."data".DIRECTORY_SEPARATOR."settings.xml"); foreach($xmlSettings as $xmlSetting) { @@ -162,7 +162,7 @@ // PDO require_once($_SERVER['DOCUMENT_ROOT'].DIRECTORY_SEPARATOR."classes".DIRECTORY_SEPARATOR."common.class.php"); $common = new common(); - + $dbh = $common->pdoOpen(); $sql = "DELETE FROM ".$settings::db_prefix."settings WHERE name = :name"; $sth = $dbh->prepare($sql); @@ -291,5 +291,33 @@ 'X-Mailer: PHP/'.phpversion(); return mail($to, $subject, $message, $headers); } + + // Get the size of the database. + function getDatabaseSize($measurment = "") { + $databaseSize = 0; + $dbh = $this->pdoOpen(); + $sql = "SHOW TABLE STATUS"; + $sth = $dbh->prepare($sql); + $sth->execute(); + $databaseSize = $sth->fetch(PDO::FETCH_ASSOC)["Data_length"]; + $sth = NULL; + $dbh = NULL; + switch ($measurment) { + case "kb": + return round($databaseSize / 1024, 2); + break; + case "mb": + return round($databaseSize / 1024 / 1024, 2); + break; + case "gb": + return round($databaseSize / 1024 / 1024 /1024, 2); + break; + case "tb": + return round($databaseSize / 1024 /1024 /1024 /1024, 2); + break; + default: + return $databaseSize; + } + } } ?> From 752259f544e541f12f09ecff56eb223f7f2d26e8 Mon Sep 17 00:00:00 2001 From: Joe Prochazka Date: Tue, 3 May 2016 22:51:59 -0400 Subject: [PATCH 3/7] Open aggregate site links in a new window. Closes issue #180. --- build/portal/html/templates/default/system.tpl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/build/portal/html/templates/default/system.tpl b/build/portal/html/templates/default/system.tpl index fc88e0b..6ca4681 100644 --- a/build/portal/html/templates/default/system.tpl +++ b/build/portal/html/templates/default/system.tpl @@ -25,10 +25,10 @@

System Information

Aggregate Sites Statistics

System Charts

From fd9177782838511fff853ddc3c47ede67d8c95ee Mon Sep 17 00:00:00 2001 From: Joe Prochazka Date: Mon, 2 May 2016 08:55:39 -0400 Subject: [PATCH 4/7] Check for Ubuntu 16.04. --- bash/portal/install.sh | 47 ++++++++++++++++++++++++++++++++++++++---- 1 file changed, 43 insertions(+), 4 deletions(-) diff --git a/bash/portal/install.sh b/bash/portal/install.sh index da1c121..4ab4262 100755 --- a/bash/portal/install.sh +++ b/bash/portal/install.sh @@ -145,20 +145,59 @@ CheckPackage cron CheckPackage collectd-core CheckPackage rrdtool CheckPackage lighttpd -CheckPackage php5-cgi + +# Check if this is Ubuntu 16.04 LTS. +# This needs optimized and made to recognize releases made after 16.04 as well. +if [ -f /etc/lsb-release ]; then + . /etc/lsb-release + if [ $DISTRIB_ID | tr '[:upper:]' '[:lower:]' == "ubuntu" ] && [ $DISTRIB_RELEASE == "16.04" ]; then + CheckPackage php7.0-cgi + else + CheckPackage php5-cgi + fi +else + CheckPackage php5-cgi +fi + CheckPackage libpython2.7 if [[ $ADVANCED =~ ^[yY]$ ]]; then if [[ $DATABASEENGINE == 2 ]]; then - CheckPackage sqlite3 - CheckPackage php5-sqlite + CheckPackage sqlite3 + + # Check if this is Ubuntu 16.04 LTS. + # This needs optimized and made to recognize releases made after 16.04 as well. + if [ -f /etc/lsb-release ]; then + . /etc/lsb-release + if [ $DISTRIB_ID | tr '[:upper:]' '[:lower:]' == "ubuntu" ] && [ $DISTRIB_RELEASE == "16.04" ]; then + CheckPackage php7.0-sqlite + else + CheckPackage php5-sqlite + fi + else + CheckPackage php5-sqlite + fi + else if [[ $LOCALDATABASE != 2 ]]; then # Install MySQL locally. CheckPackage mysql-server fi CheckPackage mysql-client - CheckPackage php5-mysql CheckPackage python-mysqldb + + # Check if this is Ubuntu 16.04 LTS. + # This needs optimized and made to recognize releases made after 16.04 as well. + if [ -f /etc/lsb-release ]; then + . /etc/lsb-release + if [ $DISTRIB_ID | tr '[:upper:]' '[:lower:]' == "ubuntu" ] && [ $DISTRIB_RELEASE == "16.04" ]; then + CheckPackage php7.0-mysql + else + CheckPackage php5-mysql + fi + else + CheckPackage php5-mysql + fi + fi fi From f35fc396692683d72bbe8ecd2185d07c35680aad Mon Sep 17 00:00:00 2001 From: Joe Prochazka Date: Mon, 2 May 2016 12:36:06 -0400 Subject: [PATCH 5/7] Added kernel version check. --- bash/decoders/rtlsdr-ogn.sh | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/bash/decoders/rtlsdr-ogn.sh b/bash/decoders/rtlsdr-ogn.sh index 7182d56..52e77c4 100644 --- a/bash/decoders/rtlsdr-ogn.sh +++ b/bash/decoders/rtlsdr-ogn.sh @@ -109,17 +109,15 @@ sudo chmod a+s rtlsdr-ogn # Check if kernel v4.1 or higher is being used. -################################################ -# ADD A WAY TO CHECK KERNEL # -# THIS WILL NOT WORK AND IS ONLY A PLACEHOLDER # -################################################ +KERNEL=`uname -r` +VERSION="`echo $KERNEL | cut -d \. -f 1`.`echo $KERNEL | cut -d \. -f 2`" -if [[ `uname -r` == $SOMETHING ]]; then - # Kernel is version 4.1 or newer. - sudo mknod gpu_dev c 249 0 -else +if [[ $VERSION < 4.1 ]]; then # Kernel is older than version 4.1. sudo mknod gpu_dev c 100 0 +else + # Kernel is version 4.1 or newer. + sudo mknod gpu_dev c 249 0 fi ## CREATE THE CONFIGURATION FILE From 1f7541f82f91b7b96645e9882d071388d4782626 Mon Sep 17 00:00:00 2001 From: Joe Prochazka Date: Wed, 4 May 2016 00:24:08 -0400 Subject: [PATCH 6/7] Ubuntu 16.04 properly identified. --- bash/portal/install.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bash/portal/install.sh b/bash/portal/install.sh index 4ab4262..4a5cf0a 100755 --- a/bash/portal/install.sh +++ b/bash/portal/install.sh @@ -150,7 +150,7 @@ CheckPackage lighttpd # This needs optimized and made to recognize releases made after 16.04 as well. if [ -f /etc/lsb-release ]; then . /etc/lsb-release - if [ $DISTRIB_ID | tr '[:upper:]' '[:lower:]' == "ubuntu" ] && [ $DISTRIB_RELEASE == "16.04" ]; then + if [ $DISTRIB_ID == "Ubuntu" ] && [ $DISTRIB_RELEASE == "16.04" ]; then CheckPackage php7.0-cgi else CheckPackage php5-cgi @@ -168,7 +168,7 @@ if [[ $ADVANCED =~ ^[yY]$ ]]; then # This needs optimized and made to recognize releases made after 16.04 as well. if [ -f /etc/lsb-release ]; then . /etc/lsb-release - if [ $DISTRIB_ID | tr '[:upper:]' '[:lower:]' == "ubuntu" ] && [ $DISTRIB_RELEASE == "16.04" ]; then + if [ $DISTRIB_ID == "Ubuntu" ] && [ $DISTRIB_RELEASE == "16.04" ]; then CheckPackage php7.0-sqlite else CheckPackage php5-sqlite @@ -189,7 +189,7 @@ if [[ $ADVANCED =~ ^[yY]$ ]]; then # This needs optimized and made to recognize releases made after 16.04 as well. if [ -f /etc/lsb-release ]; then . /etc/lsb-release - if [ $DISTRIB_ID | tr '[:upper:]' '[:lower:]' == "ubuntu" ] && [ $DISTRIB_RELEASE == "16.04" ]; then + if [ $DISTRIB_ID == "Ubuntu" ] && [ $DISTRIB_RELEASE == "16.04" ]; then CheckPackage php7.0-mysql else CheckPackage php5-mysql From e082d6187da37f93f4959313cb3503b4bc1c3c3e Mon Sep 17 00:00:00 2001 From: Joe Prochazka Date: Tue, 10 May 2016 13:03:25 -0400 Subject: [PATCH 7/7] Temporarily force lighttpd choice. --- bash/decoders/dump1090-mutability.sh | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/bash/decoders/dump1090-mutability.sh b/bash/decoders/dump1090-mutability.sh index f84d084..bbfcdd9 100755 --- a/bash/decoders/dump1090-mutability.sh +++ b/bash/decoders/dump1090-mutability.sh @@ -52,16 +52,22 @@ read -p "Press enter to continue..." CONTINUE ## ASK WHICH WEB SERVER TO INSTALL -echo -e "\033[31m" -echo "Select Web Server" -echo -e "\033[33m" -echo "Select the web server you wish to use." -echo "Currently Lighttpd is the recommended web server." -echo "" -echo " 1) Lighttpd" -echo " 2) Nginx" -echo -e "\033[37m" -read -p "Which web server do you wish to use? [1] " WEBSERVER +# Commented out temporarily until choice has been added to +# the portal installations scipt as well. + +#echo -e "\033[31m" +#echo "Select Web Server" +#echo -e "\033[33m" +#echo "Select the web server you wish to use." +#echo "Currently Lighttpd is the recommended web server." +#echo "" +#echo " 1) Lighttpd" +#echo " 2) Nginx" +#echo -e "\033[37m" +#read -p "Which web server do you wish to use? [1] " WEBSERVER + +# For now we will force Lighttpd as the web server chosen. +WEBSERVER=1 ## CHECK FOR PREREQUISITE PACKAGES