.
For Raspbian Jessie/Stretch + dump1090-mutability v1.15~dev install
Only Step-1 is different for Jessie and Stretch, rest is same.
STEP-1 (JESSIE): Install necessary php packages and enable module
sudo apt-get update
sudo apt-get install php5-cgi
sudo lighty-enable-mod fastcgi-php
sudo /etc/init.d/lighttpd force-reload
.
STEP-1 (STRETCH): Install necessary php packages and enable module
sudo apt-get update
sudo apt-get install php7.0-cgi
sudo lighty-enable-mod fastcgi-php
sudo /etc/init.d/lighttpd force-reload
STEP-2: Assign strong password to user www-data, and add it to sudoer’s group
sudo passwd www-data
sudo adduser www-data sudo
groups www-data
REBOOT for sudo permission of user www-data to be implemented.
sudo reboot
.
STEP-3: Create new directory and files
(a) Create new directory
sudo mkdir /var/www/html/setgain
(b) Move inside the new directory
cd /var/www/html/setgain/
(c ) Inside directory /var/www/html/setgain, create a new blank file setgain.sh, make it executable
sudo touch setgain.sh
sudo chmod +x setgain.sh
(d) Open newly created file in nano editor
sudo nano setgain.sh
(e) Add code to the new file
(In code below, replace xxxxxxxxx by the actual password you have set for user www-data)
#!/bin/bash
echo 'xxxxxxxxxx' | sudo -S sed -i '/GAIN=.*/c\GAIN='$1 /etc/default/dump1090-mutability
echo 'xxxxxxxxxx' | sudo -S systemctl restart dump1090-mutability
Save (Ctrl+o) and Close (Ctrl+x) the file.
.
(f) Inside directory /var/www/html/setgain, create a new blank file findgain.sh, make it executable
sudo touch findgain.sh
sudo chmod +x findgain.sh
(g) Open newly created file in nano editor
sudo nano findgain.sh
(h) Add code to the new file
(In code below, replace xxxxxxxxx by the actual password you have set for user www-data)
#!/bin/bash
echo 'xxxxxxxxxx' | sudo -S sed -n 's/\GAIN=//p' /etc/default/dump1090-mutability
Save (Ctrl+o) and Close (Ctrl+x) the file.
.
(i) Inside directory /var/www/html/setgain, create new php file
sudo nano index.php
(j) Copy-paste following code in it
<?php
echo <<<HTML
<form id="myform" name="myform" action="{$_SERVER['PHP_SELF']}" method="post" />
ENTER GAIN VALUE: <input type="text" id="gain" name="gain" value="-10" />
<input type="submit" name="submit" value="Click to Set Gain" />
</form>
HTML;
echo "Your gain was = ";
system("/var/www/html/setgain/findgain.sh");
?>
<BR>
<?php
function setgain(){
$_SERVER['PHP_SELF'];
$gain="{$_POST['gain']}";
echo "You changed gain to = $gain";
system("/var/www/html/setgain/setgain.sh $gain >> /tmp/gain.log 2>&1");
}
if ("{$_POST['gain']}"){
setgain();
}
?>
.
Save (Ctrl+o) and close (Ctrl+x)
.
STEP-4: Load the gain setting file in browser of Win/Mac computer, and set gain.
IP-OF-PI/setgain/
STEP-5: Check if the gain change has actually taken place
(a) Check gain changed or not, and what is its current value
sudo systemctl status dump1090-mutability -l
sudo sed -n '/GAIN.*/p' /etc/default/dump1090-mutability
.
(b) Check for error messages
cat /tmp/gain.log
.