Downloader: Install perl modules and set up environment

Signed-off-by: Robert C. Helling <helling@lmu.de>
This commit is contained in:
Robert C. Helling 2024-01-27 23:14:13 +01:00 committed by Dirk Hohndel
parent 301059c6c9
commit 4fdaf3e8de
2 changed files with 14 additions and 5 deletions

View file

@ -38,18 +38,23 @@ sudo ln -s /etc/apache2/mods-available/cgi* /etc/apache2/mods-enabled/
and restart apache2 and restart apache2
6) copy ~/src/subsurface/scripts/downloader.pl to /usr/lib/cgi-bin and run 6) Install two perl modules:
sudo cpan CGI
sudo cpan Get:Repository
7) copy ~/src/subsurface/scripts/downloader.pl to /usr/lib/cgi-bin and run
sudo chmod a+x /usr/lib/cgi-bin/downloader.pl sudo chmod a+x /usr/lib/cgi-bin/downloader.pl
It should then be there when you direct your browser to It should then be there when you direct your browser to
subsurfacepi.local/cgi-bin/downloader.pl subsurfacepi.local/cgi-bin/downloader.pl
7) Give the www user access to the serial interface 8) Give the www user access to the serial interface
sudo adduser pi dialout sudo adduser pi dialout
and restart apache2 and restart apache2
8) Create a directory to store the data 9) Create a directory to store the data
sudo mkdir /opt/ssrf/ sudo mkdir /opt/ssrf/
sudo touch /opt/ssrf/ssrf.conf sudo touch /opt/ssrf/ssrf.conf
sudo chown -R www-data.www-data /opt/ssrf sudo chown -R www-data.www-data /opt/ssrf
9) If you want to use the pi with an iPhone where the iPhone provides the internet connectivity, follow https://gist.github.com/antronic/157e047cdefa98b3150195c2eacb56b8 10) If you want to use the pi with an iPhone where the iPhone provides the internet connectivity, follow https://gist.github.com/antronic/157e047cdefa98b3150195c2eacb56b8

View file

@ -17,6 +17,10 @@ my %conf;
# Use unbuffered output # Use unbuffered output
$| = 1; $| = 1;
# Setup some environemnt variables to make subsurface startup happy
$ENV{HOME} = '/tmp';
$ENV{LOGNAME} = 'www-data';
my $q = CGI->new; my $q = CGI->new;
print $q->header('text/html'); print $q->header('text/html');
@ -114,7 +118,7 @@ print $q->end_form();
print $q->br(), $q->a({-href => $q->url() . "?action=config"}, "Configure cloud credentials"); print $q->br(), $q->a({-href => $q->url() . "?action=config"}, "Configure cloud credentials");
sub load_supported_dcs { sub load_supported_dcs {
open IN, "/home/pi/src/subsurface/build/subsurface-downloader --list-dc|"; open IN, "$downloader --list-dc|" || die "Cannot run $downloader: $!";
while(<IN>) { while(<IN>) {
last if /Supported dive computers:/; last if /Supported dive computers:/;