diff options
author | Robert C. Helling <helling@atdotde.de> | 2020-11-27 22:21:05 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2020-12-03 13:26:55 -0800 |
commit | 8934d9744a9b80a11061c4b7f73aaa4e85795e76 (patch) | |
tree | 89c572c2903568c848c12ad63972cb2580cfab73 | |
parent | 40311362f323fd8a4d62a0b044dbf2e778654174 (diff) | |
download | subsurface-8934d9744a9b80a11061c4b7f73aaa4e85795e76.tar.gz |
downloader: make cgi-script functional and add documentation
Signed-off-by: Robert C. Helling <helling@atdotde.de>
-rw-r--r-- | packaging/headless/Setting-up-downloader | 47 | ||||
-rw-r--r-- | packaging/headless/downloader_packages | 1473 | ||||
-rw-r--r-- | scripts/downloader.pl | 155 |
3 files changed, 1663 insertions, 12 deletions
diff --git a/packaging/headless/Setting-up-downloader b/packaging/headless/Setting-up-downloader new file mode 100644 index 000000000..421b1ba6c --- /dev/null +++ b/packaging/headless/Setting-up-downloader @@ -0,0 +1,47 @@ +How to set up a Raspberry Pi to use as a Subsurface downloader + +1) Get an image file for RaspianPi + +2) Set up your local network according to https://www.raspberrypi.org/documentation/configuration/wireless/headless.md +You also need to create a file named "ssh" in the boot partition to enable the ssh server. Set the hostname to subsurfacepi + +3) apt-get install some more packages. On my pi, the packages listed in downloader_packages are installed, you can install them with +sudo xargs -a downloader_packages apt install + +4) Clone the subsurface repository and build it as for any Debian based system: Run build.sh, then cd to the build directory, run +ccamke . +and select SUBSURFACE_TARGET_EXECUTABLE as DownloaderExecutable and make once more + +5) Add the following lines to /etc/apache2/sites-available/000-default.conf + + ScriptAlias /pi-cgi-bin/ /home/pi/cgi-bin/ + <Directory "/home/pi/cgi-bin"> + AllowOverride None + Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch + Order allow,deny + Require all granted + </Directory> + <Directory "/usr/lib/cgi-bin"> + AllowOverride None + Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch + Order allow,deny + Allow from all + </Directory> + +and restart apache2 + +6) copy ~/src/subsurface/scripts/downloader.pl to /usr/lib/cgi-bin and run +sudo chmod a+x /usr/lib/cgi-bin/downloader.pl +It should then be there when you direct your browser to +subsurfacepi.local/cgi-bin/downloader.pl + +7) Give the www user access to the serial interface +sudo adduser pi dialout +and restart apache2 + +8) Create a directory to store the data +sudo mkdir /opt/ssrf/ +sudo touch /opt/ssrf/ssrf.conf +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
\ No newline at end of file diff --git a/packaging/headless/downloader_packages b/packaging/headless/downloader_packages new file mode 100644 index 000000000..ec0f1a692 --- /dev/null +++ b/packaging/headless/downloader_packages @@ -0,0 +1,1473 @@ +adduser +adwaita-icon-theme +agnostics +alacarte +alsa-utils +apache2 +apache2-bin +apache2-data +apache2-utils +apt +apt-listchanges +apt-utils +arandr +aspell +aspell-en +autoconf +automake +autotools-dev +avahi-daemon +base-files +base-passwd +bash +bash-completion +bind9-host +binutils +binutils-arm-linux-gnueabihf +binutils-common:armhf +blt +bluealsa +bluez +bluez-firmware +bsdmainutils +bsdutils +bubblewrap +build-essential +busybox +bzip2 +ca-certificates +chromium-browser +chromium-browser-l10n +chromium-codecs-ffmpeg-extra +cifs-utils +cmake +cmake-curses-gui +cmake-data +console-setup +console-setup-linux +coreutils +cpio +cpp +cpp-8 +crda +cron +curl +dash +dbus +dbus-user-session +dbus-x11 +dc +dconf-gsettings-backend:armhf +dconf-service +debconf +debconf-i18n +debconf-utils +debian-reference-common +debian-reference-en +debianutils +debsums +desktop-base +desktop-file-utils +device-tree-compiler +dh-python +dhcpcd5 +dictionaries-common +diffutils +dillo +dirmngr +distro-info-data +dmidecode +dmsetup +docutils-common +dosfstools +dphys-swapfile +dpkg +dpkg-dev +e2fsprogs +ed +eject +emacsen-common +ethtool +fake-hwclock +fakeroot +fbset +fdisk +ffmpeg +file +findutils +fio +firmware-atheros +firmware-brcm80211 +firmware-libertas +firmware-misc-nonfree +firmware-realtek +flashrom +fontconfig +fontconfig-config +fonts-dejavu-core +fonts-droid-fallback +fonts-freefont-ttf +fonts-liberation2 +fonts-noto-mono +fonts-piboto +fonts-quicksand +fuse +g++ +g++-8 +galculator +gcc +gcc-4.9-base:armhf +gcc-5-base:armhf +gcc-6-base:armhf +gcc-7-base:armhf +gcc-8 +gcc-8-base:armhf +gdb +gdbm-l10n +gdisk +geany +geany-common +geoclue-2.0 +geoip-database +gettext-base +giblib1:armhf +gir1.2-atk-1.0:armhf +gir1.2-freedesktop:armhf +gir1.2-gdkpixbuf-2.0:armhf +gir1.2-glib-2.0:armhf +gir1.2-gmenu-3.0:armhf +gir1.2-gtk-3.0:armhf +gir1.2-pango-1.0:armhf +git +git-man +gldriver-test +glib-networking:armhf +glib-networking-common +glib-networking-services +gnome-accessibility-themes +gnome-icon-theme +gnome-menus +gnome-themes-extra:armhf +gnome-themes-extra-data +gnome-themes-standard +gnupg +gnupg-l10n +gnupg-utils +gpg +gpg-agent +gpg-wks-client +gpg-wks-server +gpgconf +gpgsm +gpgv +gpicview +grep +groff-base +gsettings-desktop-schemas +gstreamer1.0-alsa:armhf +gstreamer1.0-libav:armhf +gstreamer1.0-omx +gstreamer1.0-omx-rpi +gstreamer1.0-omx-rpi-config +gstreamer1.0-plugins-bad:armhf +gstreamer1.0-plugins-base:armhf +gstreamer1.0-plugins-good:armhf +gstreamer1.0-x:armhf +gtk-update-icon-cache +gtk2-engines:armhf +gtk2-engines-clearlookspix:armhf +gtk2-engines-pixbuf:armhf +gtk2-engines-pixflat:armhf +gvfs:armhf +gvfs-backends +gvfs-bin +gvfs-common +gvfs-daemons +gvfs-fuse +gvfs-libs:armhf +gzip +hardlink +hicolor-icon-theme +hostname +htop +hunspell-en-gb +hyphen-en-gb +i2c-tools +ibverbs-providers:armhf +icu-devtools +ifupdown +ifuse +iio-sensor-proxy +info +init +init-system-helpers +initramfs-tools +initramfs-tools-core +install-info +ipheth-utils +iproute2 +iptables +iputils-ping +isc-dhcp-client +isc-dhcp-common +iso-codes +iw +javascript-common +kbd +keyboard-configuration +keyutils +klibc-utils +kmod +laptop-detect +less +liba52-0.7.4:armhf +libaa1:armhf +libacl1:armhf +libaio1:armhf +libalgorithm-diff-perl +libalgorithm-diff-xs-perl +libalgorithm-merge-perl +libaom0:armhf +libapparmor1:armhf +libappstream4:armhf +libapr1:armhf +libaprutil1:armhf +libaprutil1-dbd-sqlite3:armhf +libaprutil1-ldap:armhf +libapt-inst2.0:armhf +libapt-pkg5.0:armhf +libarchive13:armhf +libargon2-1:armhf +libaribb24-0:armhf +libasan5:armhf +libasound2:armhf +libasound2-data +libaspell15:armhf +libass9:armhf +libassuan0:armhf +libasyncns0:armhf +libatasmart4:armhf +libatk-bridge2.0-0:armhf +libatk1.0-0:armhf +libatk1.0-data +libatomic1:armhf +libatspi2.0-0:armhf +libattr1:armhf +libaudit-common +libaudit1:armhf +libavahi-client3:armhf +libavahi-common-data:armhf +libavahi-common3:armhf +libavahi-core7:armhf +libavahi-glib1:armhf +libavc1394-0:armhf +libavcodec58:armhf +libavdevice58:armhf +libavfilter7:armhf +libavformat58:armhf +libavresample4:armhf +libavutil56:armhf +libb-hooks-endofscope-perl +libb-hooks-op-check-perl +libbabeltrace1:armhf +libbasicusageenvironment1:armhf +libbind9-161:armhf +libbinutils:armhf +libblas3:armhf +libblkid1:armhf +libblockdev-fs2:armhf +libblockdev-loop2:armhf +libblockdev-part-err2:armhf +libblockdev-part2:armhf +libblockdev-swap2:armhf +libblockdev-utils2:armhf +libblockdev2:armhf +libbluetooth-dev:armhf +libbluetooth3:armhf +libbluray2:armhf +libboost-atomic1.67.0:armhf +libboost-iostreams1.58.0:armhf +libboost-iostreams1.67.0:armhf +libboost-regex1.67.0:armhf +libboost-system1.67.0:armhf +libboost-thread1.67.0:armhf +libbrotli1:armhf +libbs2b0:armhf +libbsd0:armhf +libbz2-1.0:armhf +libc-bin +libc-dev-bin +libc-l10n +libc6:armhf +libc6-dbg:armhf +libc6-dev:armhf +libcaca0:armhf +libcairo-gobject2:armhf +libcairo2:armhf +libcanberra-gtk3-0:armhf +libcanberra0:armhf +libcap-ng0:armhf +libcap2:armhf +libcap2-bin +libcc1-0:armhf +libcddb2 +libcdio-cdda2:armhf +libcdio-paranoia2:armhf +libcdio18:armhf +libcdparanoia0:armhf +libcgi-fast-perl +libcgi-pm-perl +libchromaprint1:armhf +libclang1-7 +libcodec2-0.8.1:armhf +libcolord2:armhf +libcom-err2:armhf +libcroco3:armhf +libcrypto++-dev +libcrypto++6 +libcryptsetup12:armhf +libcups2:armhf +libcupsfilters1:armhf +libcupsimage2:armhf +libcurl3-gnutls:armhf +libcurl4:armhf +libcurl4-openssl-dev:armhf +libdaemon0:armhf +libdatrie1:armhf +libdav1d3:armhf +libdb5.3:armhf +libdbus-1-3:armhf +libdbus-glib-1-2:armhf +libdc1394-22:armhf +libdca0:armhf +libdconf1:armhf +libde265-0:armhf +libdebconfclient0:armhf +libdevel-callchecker-perl +libdevmapper1.02.1:armhf +libdjvulibre-text +libdjvulibre21:armhf +libdns-export1104 +libdns1104:armhf +libdouble-conversion1:armhf +libdpkg-perl +libdrm-amdgpu1:armhf +libdrm-common +libdrm-nouveau2:armhf +libdrm-radeon1:armhf +libdrm2:armhf +libdv4:armhf +libdvbpsi10:armhf +libdvdnav4:armhf +libdvdread4:armhf +libdw1:armhf +libdynaloader-functions-perl +libebml4v5:armhf +libedit2:armhf +libegl-dev:armhf +libegl-mesa0:armhf +libegl1:armhf +libelf1:armhf +libenchant1c2a:armhf +libencode-locale-perl +libepoxy0:armhf +liberror-perl +libestr0:armhf +libevdev2:armhf +libevent-2.1-6:armhf +libexif12:armhf +libexpat1:armhf +libexpat1-dev:armhf +libext2fs2:armhf +libfaad2:armhf +libfakeroot:armhf +libfastjson4:armhf +libfcgi-perl +libfdisk1:armhf +libffi6:armhf +libfftw3-double3:armhf +libfftw3-single3:armhf +libfile-fcntllock-perl +libfile-fnmatch-perl +libfl2:armhf +libflac8:armhf +libflite1:armhf +libfltk1.3:armhf +libfluidsynth1:armhf +libfm-data +libfm-extra4:armhf +libfm-gtk-data +libfm-gtk4:armhf +libfm-modules:armhf +libfm4:armhf +libfontconfig1:armhf +libfontenc1:armhf +libfreetype6:armhf +libfreetype6-dev:armhf +libfribidi0:armhf +libfstrm0:armhf +libftdi1-2:armhf +libfuse2:armhf +libgbm1:armhf +libgcc-8-dev:armhf +libgcc1:armhf +libgck-1-0:armhf +libgcr-base-3-1:armhf +libgcrypt20:armhf +libgcrypt20-dev +libgd3:armhf +libgdata-common +libgdata22:armhf +libgdbm-compat4:armhf +libgdbm6:armhf +libgdk-pixbuf2.0-0:armhf +libgdk-pixbuf2.0-common +libgeoip1:armhf +libgfapi0:armhf +libgfortran5:armhf +libgfrpc0:armhf +libgfxdr0:armhf +libgif7:armhf +libgirepository-1.0-1:armhf +libgit-repository-perl +libgit-repository-plugin-log-perl +libgit-version-compare-perl +libgit2-27:armhf +libgit2-dev:armhf +libgl-dev:armhf +libgl1:armhf +libgl1-mesa-dri:armhf +libglapi-mesa:armhf +libgles-dev:armhf +libgles1:armhf +libgles2:armhf +libgles2-mesa:armhf +libgles2-mesa-dev:armhf +libglib2.0-0:armhf +libglib2.0-bin +libglib2.0-data +libglusterfs0:armhf +libglvnd0:armhf +libglx-dev:armhf +libglx-mesa0:armhf +libglx0:armhf +libgme0:armhf +libgmp10:armhf +libgnome-menu-3-0:armhf +libgnutls30:armhf +libgoa-1.0-0b:armhf +libgoa-1.0-common +libgomp1:armhf +libgpg-error-dev +libgpg-error0:armhf +libgphoto2-6:armhf +libgphoto2-port12:armhf +libgpm2:armhf +libgraphite2-3:armhf +libgroupsock8:armhf +libgs9:armhf +libgs9-common +libgsm1:armhf +libgssapi-krb5-2:armhf +libgssdp-1.0-3:armhf +libgstreamer-gl1.0-0:armhf +libgstreamer-plugins-bad1.0-0:armhf +libgstreamer-plugins-base1.0-0:armhf +libgstreamer1.0-0:armhf +libgtk-3-0:armhf +libgtk-3-common +libgtk2.0-0:armhf +libgtk2.0-bin +libgtk2.0-common +libgtksourceview-3.0-1:armhf +libgtksourceview-3.0-common +libgudev-1.0-0:armhf +libgupnp-1.0-4:armhf +libgupnp-igd-1.0-4:armhf +libharfbuzz-icu0:armhf +libharfbuzz0b:armhf +libhogweed4:armhf +libhtml-parser-perl +libhtml-tagset-perl +libhttp-date-perl +libhttp-message-perl +libhttp-parser-dev +libhttp-parser2.8:armhf +libhunspell-1.7-0:armhf +libhyphen0:armhf +libi2c0:armhf +libibverbs1:armhf +libice6:armhf +libicu-dev:armhf +libicu63:armhf +libid3tag0:armhf +libident +libidn11:armhf +libidn2-0:armhf +libiec61883-0:armhf +libijs-0.35:armhf +libilmbase23:armhf +libimagequant0:armhf +libimlib2:armhf +libimobiledevice-utils +libimobiledevice6:armhf +libindicator3-7:armhf +libinput-bin +libinput10:armhf +libio-html-perl +libip4tc0:armhf +libip6tc0:armhf +libiptc0:armhf +libisc-export1100:armhf +libisc1100:armhf +libisccc161:armhf +libisccfg163:armhf +libisl19:armhf +libiw30:armhf +libixml10:armhf +libjack-jackd2-0:armhf +libjansson4:armhf +libjavascriptcoregtk-4.0-18:armhf +libjbig0:armhf +libjbig2dec0:armhf +libjim0.77:armhf +libjpeg62-turbo:armhf +libjs-jquery +libjs-sphinxdoc +libjs-underscore +libjson-c3:armhf +libjson-glib-1.0-0:armhf +libjson-glib-1.0-common +libjsoncpp1:armhf +libk5crypto3:armhf +libkate1:armhf +libkeybinder0 +libkeyutils1:armhf +libklibc:armhf +libkmod2:armhf +libkrb5-3:armhf +libkrb5support0:armhf +libksba8:armhf +liblapack3:armhf +liblcms2-2:armhf +libldap-2.4-2:armhf +libldap-common +libldb1:armhf +liblightdm-gobject-1-0:armhf +liblilv-0-0:armhf +liblirc-client0:armhf +liblivemedia64:armhf +libllvm7:armhf +libllvm9:armhf +liblmdb0:armhf +liblocale-gettext-perl +liblognorm5:armhf +libltdl-dev:armhf +libltdl7:armhf +liblua5.2-0:armhf +libluajit-5.1-2:armhf +libluajit-5.1-common +liblwp-mediatypes-perl +liblwres161:armhf +liblz4-1:armhf +liblzma5:armhf +libmad0:armhf +libmagic-mgc +libmagic1:armhf +libmatroska6v5:armhf +libmbedcrypto3:armhf +libmbedtls-dev:armhf +libmbedtls12:armhf +libmbedx509-0:armhf +libmbim-glib4:armhf +libmbim-proxy +libmenu-cache-bin +libmenu-cache3:armhf +libmikmod3:armhf +libmjpegutils-2.1-0 +libmm-glib0:armhf +libmms0:armhf +libmnl-dev +libmnl0:armhf +libmodplug1:armhf +libmodule-implementation-perl +libmodule-runtime-perl +libmount1:armhf +libmp3lame0:armhf +libmpc3:armhf +libmpcdec6:armhf +libmpdec2:armhf +libmpeg2-4:armhf +libmpeg2encpp-2.1-0 +libmpfr6:armhf +libmpg123-0:armhf +libmplex2-2.1-0 +libmtdev1:armhf +libmtp-common +libmtp-dev:armhf +libmtp-runtime +libmtp9:armhf +libmysofa0:armhf +libnamespace-clean-perl +libncurses6:armhf +libncursesw5:armhf +libncursesw6:armhf +libnetfilter-conntrack3:armhf +libnettle6:armhf +libnewt0.52:armhf +libnfnetlink0:armhf +libnfs12:armhf +libnfsidmap2:armhf +libnftnl11:armhf +libnghttp2-14:armhf +libnice10:armhf +libnl-3-200:armhf +libnl-genl-3-200:armhf +libnl-route-3-200:armhf +libnorm1:armhf +libnotify4:armhf +libnpth0:armhf +libnspr4:armhf +libnss-mdns:armhf +libnss3:armhf +libntfs-3g883 +libnuma1:armhf +liboauth0:armhf +libobrender32v5 +libobt2v5 +libofa0:armhf +libogg0:armhf +libopenal-data +libopenal1:armhf +libopenexr23:armhf +libopenjp2-7:armhf +libopenmpt-modplug1:armhf +libopenmpt0:armhf +libopus0:armhf +liborc-0.4-0:armhf +libossp-uuid16:armhf +libp11-kit0:armhf +libpackage-stash-perl +libpackage-stash-xs-perl +libpackagekit-glib2-18:armhf +libpam-chksshpwd:armhf +libpam-modules:armhf +libpam-modules-bin +libpam-runtime +libpam-systemd:armhf +libpam0g:armhf +libpango-1.0-0:armhf +libpangocairo-1.0-0:armhf +libpangoft2-1.0-0:armhf +libpangoxft-1.0-0:armhf +libpaper-utils +libpaper1:armhf +libparams-classify-perl +libparted-fs-resize0:armhf +libparted2:armhf +libpci3:armhf +libpciaccess0:armhf +libpcre2-16-0:armhf +libpcre2-8-0:armhf +libpcre2-posix0:armhf +libpcre3:armhf +libpcsclite1:armhf +libperl5.28:armhf +libpgm-5.2-0:armhf +libpigpio-dev +libpigpio1 +libpigpiod-if-dev +libpigpiod-if1 +libpigpiod-if2-1 +libpipeline1:armhf +libpixman-1-0:armhf +libplacebo7:armhf +libplist3:armhf +libplymouth4:armhf +libpng-dev:armhf +libpng-tools +libpng16-16:armhf +libpolkit-agent-1-0:armhf +libpolkit-backend-1-0:armhf +libpolkit-gobject-1-0:armhf +libpoppler-qt5-1:armhf +libpoppler82:armhf +libpopt0:armhf +libportmidi0:armhf +libpostproc55:armhf +libprocps7:armhf +libprotobuf-c1:armhf +libprotobuf-lite17:armhf +libproxy-tools +libproxy1v5:armhf +libpsl5:armhf +libpthread-stubs0-dev:armhf +libpulse0:armhf +libpython-all-dev:armhf +libpython-dev:armhf +libpython-stdlib:armhf +libpython2-dev:armhf +libpython2-stdlib:armhf +libpython2.7:armhf +libpython2.7-dev:armhf +libpython2.7-minimal:armhf +libpython2.7-stdlib:armhf +libpython3-dev:armhf +libpython3-stdlib:armhf +libpython3.7:armhf +libpython3.7-dev:armhf +libpython3.7-minimal:armhf +libpython3.7-stdlib:armhf +libqmi-glib5:armhf +libqmi-proxy +libqt5bluetooth5:armhf +libqt5bluetooth5-bin +libqt5concurrent5:armhf +libqt5core5a:armhf +libqt5dbus5:armhf +libqt5designer5:armhf +libqt5designercomponents5:armhf +libqt5gui5:armhf +libqt5help5:armhf +libqt5location5:armhf +libqt5location5-plugins:armhf +libqt5network5:armhf +libqt5nfc5:armhf +libqt5opengl5:armhf +libqt5opengl5-dev:armhf +libqt5positioning5:armhf +libqt5positioning5-plugins:armhf +libqt5positioningquick5:armhf +libqt5printsupport5:armhf +libqt5qml5:armhf +libqt5quick5:armhf +libqt5quickparticles5:armhf +libqt5quicktest5:armhf +libqt5quickwidgets5:armhf +libqt5script5:armhf +libqt5scripttools5:armhf +libqt5sensors5:armhf +libqt5sql5:armhf +libqt5sql5-sqlite:armhf +libqt5svg5:armhf +libqt5svg5-dev:armhf +libqt5test5:armhf +libqt5webchannel5:armhf +libqt5webkit5:armhf +libqt5webkit5-dev:armhf +libqt5widgets5:armhf +libqt5x11extras5:armhf +libqt5xml5:armhf +librados2:armhf +libraspberrypi-bin +libraspberrypi-dev +libraspberrypi-doc +libraspberrypi0 +libraw1394-11:armhf +librbd1:armhf +librdmacm1:armhf +libreadline6:armhf +libreadline7:armhf +libresid-builder0c2a +librest-0.7-0:armhf +librhash0:armhf +librsvg2-2:armhf +librsvg2-common:armhf +librtimulib-dev +librtimulib-utils +librtimulib7 +librtmp1:armhf +librubberband2:armhf +libsamplerate0:armhf +libsasl2-2:armhf +libsasl2-modules-db:armhf +libsbc1:armhf +libsdl-image1.2:armhf +libsdl-mixer1.2:armhf +libsdl-ttf2.0-0:armhf +libsdl1.2debian:armhf +libsdl2-2.0-0:armhf +libseccomp2:armhf +libsecret-1-0:armhf +libsecret-common +libselinux1:armhf +libsemanage-common +libsemanage1:armhf +libsensors-config +libsensors5:armhf +libsepol1:armhf +libserd-0-0:armhf +libshine3:armhf +libshout3:armhf +libsidplay2 +libsigc++-1.2-5c2 +libsigsegv2:armhf +libslang2:armhf +libsm6:armhf +libsmartcols1:armhf +libsmbclient:armhf +libsnappy1v5:armhf +libsndfile1:armhf +libsndio7.0:armhf +libsodium23:armhf +libsord-0-0:armhf +libsoundtouch1:armhf +libsoup-gnome2.4-1:armhf +libsoup2.4-1:armhf +libsoxr0:armhf +libspandsp2:armhf +libspatialaudio0:armhf +libspectre1:armhf +libspeex1:armhf +libspeexdsp1:armhf +libsqlite3-0:armhf +libsqlite3-dev:armhf +libsratom-0-0:armhf +libsrtp2-1:armhf +libss2:armhf +libssh-gcrypt-4:armhf +libssh2-1:armhf +libssh2-1-dev:armhf +libssl-dev:armhf +libssl1.1:armhf +libstartup-notification0:armhf +libstdc++-8-dev:armhf +libstdc++6:armhf +libstemmer0d:armhf +libsub-exporter-progressive-perl +libsub-identify-perl +libsub-name-perl +libswresample3:armhf +libswscale5:armhf +libsynctex2:armhf +libsystem-command-perl +libsystemd0:armhf +libtag1v5:armhf +libtag1v5-vanilla:armhf +libtalloc2:armhf +libtasn1-6:armhf +libtcl8.6:armhf +libtdb1:armhf +libtevent0:armhf +libtext-charwidth-perl +libtext-iconv-perl +libtext-wrapi18n-perl +libthai-data +libthai0:armhf +libtheora0:armhf +libtiff5:armhf +libtimedate-perl +libtinfo5:armhf +libtinfo6:armhf +libtirpc-common +libtirpc3:armhf +libtk8.6:armhf +libtool +libtry-tiny-perl +libtwolame0:armhf +libubsan1:armhf +libuchardet0:armhf +libudev0:armhf +libudev1:armhf +libudisks2-0:armhf +libunique-1.0-0 +libunistring2:armhf +libunwind8:armhf +libupnp13:armhf +liburi-perl +libusageenvironment3:armhf +libusb-0.1-4:armhf +libusb-1.0-0:armhf +libusb-1.0-0-dev:armhf +libusb-1.0-doc +libusbmuxd4:armhf +libuuid1:armhf +libuv1:armhf +libv4l-0:armhf +libv4l2rds0:armhf +libv4lconvert0:armhf +libva-drm2:armhf +libva-x11-2:armhf +libva2:armhf +libvariable-magic-perl +libvdpau-va-gl1:armhf +libvdpau1:armhf +libvidstab1.1:armhf +libvisual-0.4-0:armhf +libvlc-bin:armhf +libvlc5:armhf +libvlccore9:armhf +libvo-aacenc0:armhf +libvo-amrwbenc0:armhf +libvorbis0a:armhf +libvorbisenc2:armhf +libvorbisfile3:armhf +libvpx5:armhf +libvte-2.91-0:armhf +libvte-2.91-common +libvulkan-dev:armhf +libvulkan1:armhf +libwacom-common +libwacom2:armhf +libwavpack1:armhf +libwayland-client0:armhf +libwayland-cursor0:armhf +libwayland-egl1:armhf +libwayland-server0:armhf +libwbclient0:armhf +libwebkit2gtk-4.0-37:armhf +libwebp6:armhf +libwebpdemux2:armhf +libwebpmux3:armhf +libwebrtc-audio-processing1:armhf +libwildmidi2:armhf +libwnck-common +libwnck22:armhf +libwoff1:armhf +libwrap0:armhf +libx11-6:armhf +libx11-data +libx11-dev:armhf +libx11-xcb1:armhf +libx264-155:armhf +libx265-165:armhf +libxau-dev:armhf +libxau6:armhf +libxaw7:armhf +libxcb-dri2-0:armhf +libxcb-dri3-0:armhf +libxcb-glx0:armhf +libxcb-icccm4:armhf +libxcb-image0:armhf +libxcb-keysyms1:armhf +libxcb-present0:armhf +libxcb-randr0:armhf +libxcb-render-util0:armhf +libxcb-render0:armhf +libxcb-shape0:armhf +libxcb-shm0:armhf +libxcb-sync1:armhf +libxcb-util0:armhf +libxcb-xfixes0:armhf +libxcb-xinerama0:armhf +libxcb-xkb1:armhf +libxcb-xv0:armhf +libxcb1:armhf +libxcb1-dev:armhf +libxcomposite1:armhf +libxcursor1:armhf +libxdamage1:armhf +libxdmcp-dev:armhf +libxdmcp6:armhf +libxext-dev:armhf +libxext6:armhf +libxfixes3:armhf +libxfont2:armhf +libxft2:armhf +libxi6:armhf +libxinerama1:armhf +libxkbcommon-x11-0:armhf +libxkbcommon0:armhf +libxkbfile1:armhf +libxklavier16:armhf +libxml2:armhf +libxml2-dev:armhf +libxmu6:armhf +libxmuu1:armhf +libxpm4:armhf +libxrandr2:armhf +libxrender1:armhf +libxres1:armhf +libxshmfence1:armhf +libxslt1-dev:armhf +libxslt1.1:armhf +libxss1:armhf +libxt6:armhf +libxtables12:armhf +libxtst6:armhf +libxv1:armhf +libxvidcore4:armhf +libxxf86dga1:armhf +libxxf86vm1:armhf +libyaml-0-2:armhf +libzbar0:armhf +libzip-dev:armhf +libzip4:armhf +libzmq5:armhf +libzstd1:armhf +libzvbi-common +libzvbi0:armhf +lightdm +lightdm-gtk-greeter +linux-base +linux-libc-dev:armhf +locales +login +logrotate +lsb-base +lsb-release +lsof +lua5.1 +luajit +lxappearance +lxappearance-obconf +lxde +lxde-common +lxde-core +lxde-icon-theme +lxhotkey-core +lxhotkey-gtk +lxinput +lxmenu-data +lxpanel +lxpanel-data +lxplug-bluetooth +lxplug-cputemp +lxplug-ejecter +lxplug-magnifier +lxplug-network +lxplug-ptbatt +lxplug-volume +lxpolkit +lxrandr +lxsession +lxsession-data +lxsession-edit +lxsession-logout +lxtask +lxterminal +m4 +make +man-db +manpages +manpages-dev +mawk +menu-xdg +mesa-va-drivers:armhf +mesa-vdpau-drivers:armhf +mime-support +modemmanager +mount +mousepad +multiarch-support +mypy +nano +ncdu +ncurses-base +ncurses-bin +ncurses-term +net-tools +netbase +netcat-openbsd +netcat-traditional +nfs-common +ntfs-3g +obconf +omxplayer +openbox +openbox-lxde-session +openresolv +openssh-client +openssh-server +openssh-sftp-server +openssl +packagekit +parted +passwd +patch +paxctld +pciutils +pcmanfm +perl +perl-base +perl-modules-5.28 +pi-bluetooth +pi-greeter +pi-language-support +pi-package +pi-package-data +pi-package-session +piclone +pigpio +pigpio-tools +pigpiod +pigz +pinentry-curses +pipanel +pishutdown +piwiz +pixflat-icons +pkg-config +plymouth +plymouth-label +plymouth-themes +policykit-1 +poppler-data +pprompt +procps +psmisc +publicsuffix +pylint3 +pypy +pypy-lib:armhf +python +python-all +python-all-dev +python-apt-common +python-asn1crypto +python-automationhat +python-blinker +python-blinkt +python-buttonshim +python-cairo:armhf +python-cap1xxx +python-certifi +python-cffi-backend +python-chardet +python-click +python-colorama +python-colorzero +python-configparser +python-cookies +python-crypto +python-cryptography +python-dbus +python-dev +python-drumhat +python-entrypoints +python-enum34 +python-envirophat +python-explorerhat +python-flask +python-fourletterphat +python-funcsigs +python-gi +python-gobject-2 +python-gpiozero +python-gtk2 +python-idna +python-ipaddress +python-itsdangerous +python-jinja2 +python-jwt +python-keyring +python-keyrings.alt +python-markupsafe +python-microdotphat +python-minimal +python-mock +python-mote +python-motephat +python-numpy +python-oauthlib +python-olefile +python-openssl +python-pantilthat +python-pbr +python-phatbeat +python-pianohat +python-picamera +python-piglow +python-pigpio +python-pil:armhf +python-pip +python-pip-whl +python-pkg-resources +python-pygame +python-pyinotify +python-rainbowhat +python-requests +python-requests-oauthlib +python-responses +python-rpi.gpio +python-rtimulib +python-scrollphat +python-scrollphathd +python-secretstorage +python-sense-hat +python-serial +python-setuptools +python-simplejson +python-six +python-skywriter +python-smbus:armhf +python-sn3218 +python-spidev +python-talloc:armhf +python-tk +python-touchphat +python-twython +python-unicornhathd +python-urllib3 +python-werkzeug +python-wheel +python-xdg +python2 +python2-dev +python2-minimal +python2.7 +python2.7-dev +python2.7-minimal +python3 +python3-apt +python3-asn1crypto +python3-astroid +python3-asttokens +python3-automationhat +python3-blinker +python3-blinkt +python3-bs4 +python3-buttonshim +python3-cap1xxx +python3-certifi +python3-cffi-backend +python3-chardet +python3-click +python3-colorama +python3-colorzero +python3-cookies +python3-crypto +python3-cryptography +python3-dbus +python3-debconf +python3-dev +python3-distutils +python3-docutils +python3-drumhat +python3-entrypoints +python3-envirophat +python3-explorerhat +python3-flask +python3-fourletterphat +python3-gi +python3-gpiozero +python3-html5lib +python3-idna +python3-isort +python3-itsdangerous +python3-jedi +python3-jinja2 +python3-jwt +python3-keyring +python3-keyrings.alt +python3-lazy-object-proxy +python3-lib2to3 +python3-logilab-common +python3-lxml:armhf +python3-markupsafe +python3-mccabe +python3-microdotphat +python3-minimal +python3-mote +python3-motephat +python3-mypy +python3-mypy-extensions +python3-numpy +python3-oauthlib +python3-olefile +python3-openssl +python3-pantilthat +python3-parso +python3-pgzero +python3-phatbeat +python3-pianohat +python3-picamera +python3-piglow +python3-pigpio +python3-pil:armhf +python3-pip +python3-pkg-resources +python3-psutil +python3-pygame +python3-pygments +python3-pyinotify +python3-rainbowhat +python3-requests +python3-requests-oauthlib +python3-responses +python3-roman +python3-rpi.gpio +python3-rtimulib +python3-scrollphat +python3-scrollphathd +python3-secretstorage +python3-send2trash +python3-sense-hat +python3-serial +python3-setuptools +python3-simplejson +python3-six +python3-skywriter +python3-smbus:armhf +python3-sn3218 +python3-soupsieve +python3-spidev +python3-tk:armhf +python3-touchphat +python3-twython +python3-typed-ast +python3-unicornhathd +python3-urllib3 +python3-venv +python3-webencodings +python3-werkzeug +python3-wheel +python3-wrapt +python3-xdg +python3.7 +python3.7-dev +python3.7-minimal +python3.7-venv +qdoc-qt5 +qml-module-qtlocation:armhf +qml-module-qtpositioning:armhf +qml-module-qtquick2:armhf +qpdfview +qpdfview-djvu-plugin +qpdfview-ps-plugin +qpdfview-translations +qt5-assistant +qt5-default:armhf +qt5-gtk-platformtheme:armhf +qt5-qmake:armhf +qt5-qmake-bin +qt5-qmltooling-plugins:armhf +qt5-style-plugins:armhf +qt5ct +qtbase5-dev:armhf +qtbase5-dev-tools +qtchooser +qtconnectivity5-dev:armhf +qtdeclarative5-dev:armhf +qtdeclarative5-dev-tools +qtdeclarative5-private-dev:armhf +qtlocation5-dev +qtpositioning5-dev:armhf +qtscript5-dev:armhf +qttools5-dev:armhf +qttools5-dev-tools +qttranslations5-l10n +raspberrypi-artwork +raspberrypi-bootloader +raspberrypi-kernel +raspberrypi-net-mods +raspberrypi-sys-mods +raspberrypi-ui-mods +raspbian-archive-keyring +raspi-config +raspi-copies-and-fills +raspi-gpio +raspinfo +rc-gui +read-edid +readline-common +realvnc-vnc-server +rfkill +rng-tools +rp-bookshelf +rp-prefapps +rpcbind +rpd-plym-splash +rpd-wallpaper +rpi-chromium-mods +rpi-eeprom +rpi-update +rpi.gpio-common:armhf +rsync +rsyslog +samba-libs:armhf +scrot +sed +sense-hat +sensible-utils +sgml-base +shared-mime-info +sound-theme-freedesktop +ssh +ssh-import-id +ssl-cert +strace +sudo +systemd +systemd-sysv +sysvinit-utils +tar +tasksel +tasksel-data +thonny +timgm6mb-soundfont +tk8.6-blt2.5 +traceroute +tree +triggerhappy +tzdata +ucf +udev +udisks2 +unzip +usb-modeswitch +usb-modeswitch-data +usb.ids +usbmuxd +usbutils +util-linux +uuid +v4l-utils +va-driver-all:armhf +vdpau-driver-all:armhf +vim-common +vim-tiny +vl805fw +vlc +vlc-bin +vlc-data +vlc-l10n +vlc-plugin-base:armhf +vlc-plugin-notify:armhf +vlc-plugin-qt:armhf +vlc-plugin-samba:armhf +vlc-plugin-skins2:armhf +vlc-plugin-video-output:armhf +vlc-plugin-video-splitter:armhf +vlc-plugin-visualization:armhf +wamerican +wbritish +wget +whiptail +wireless-regdb +wireless-tools +wiringpi +wpasupplicant +x11-common +x11-utils +x11-xkb-utils +x11-xserver-utils +x11proto-core-dev +x11proto-dev +x11proto-xext-dev +xarchiver +xauth +xcompmgr +xdg-dbus-proxy +xdg-user-dirs +xdg-utils +xinit +xinput +xkb-data +xml-core +xorg-sgml-doctools +xsel +xserver-common +xserver-xorg +xserver-xorg-core +xserver-xorg-input-all +xserver-xorg-input-libinput +xserver-xorg-video-fbdev +xserver-xorg-video-fbturbo +xtrans-dev +xxd +xz-utils +zenity +zenity-common +zlib1g:armhf +zlib1g-dev:armhf diff --git a/scripts/downloader.pl b/scripts/downloader.pl index d41854658..b15528229 100644 --- a/scripts/downloader.pl +++ b/scripts/downloader.pl @@ -1,6 +1,21 @@ -#!/usr/bin/perl +#!/usr/bin/perl -w + +use strict; use CGI; +use Git::Repository; + +# File to store cloud credentials +my $config_file = "/opt/ssrf/ssrf.conf"; +# Where to store the git repository +my $git_dir = "/opt/ssrf/gitdir"; +# Downloader binary +my $downloader = "/home/pi/src/subsurface/build/subsurface-downloader"; + +my %conf; + +# Use unbuffered output +$| = 1; my $q = CGI->new; @@ -8,32 +23,129 @@ print $q->header('text/html'); print $q->img({src => 'https://subsurface-divelog.org/wp-content/uploads/2015/10/subsurface-icon1.png'}); print $q->h1("Subsurface"); +printf "Reading config file $config_file\n"; +open CONF, $config_file || die "Cannot read $config_file:$!"; +while (<CONF>) { + if (/^\s*(\w+)\s*=\s*(\w.*)$/) { + $conf{$1} = $2; + } +} +close CONF; + my %dcs; &load_supported_dcs; print $q->start_form(); -if ($q->param("Manufacturer")) { + +my $action = $q->param("action"); + +if ($action eq "config") { + + # Enter cloud credentials + + print "Subsurface cloud user name (typically your email address): ", $q->textfield(-name => 'username', -default => $conf{username}); + print "<br>Subsurface cloud password: ", $q->password_field(-name => "password"); + &next_action("writeconfig"); + +} elsif ($action eq "writeconfig") { + + $conf{username} = $q->param("username"); + $conf{username} =~ s/\s//g; + $conf{password} = $q->param("password"); + $conf{password} =~ s/\s//g; + &write_conf; + &next_action("start"); + +} elsif ($action eq "setmanufacturer") { + + # Now we know the manufacturer, ask for model + print $q->hidden(-name => "Manufacturer", -default => $q->param("Manufacturer")); - if ($q->param("Product")) { - print $q->hidden(-name => "Product", -default => $q->param("Product")); - opendir DIR, "/dev"; - my @devices = map {"/dev/$_"} (grep {!/^\./} (readdir DIR)); - closedir DIR; - print "Select mount point:"; - print $q->popup_menu("Mount point", \@devices); + print "Select ",$q->param("Manufacturer")," model:"; + print $q->popup_menu("Product", $dcs{$q->param("Manufacturer")}); + &next_action("setproduct") + +} elsif ($action eq "setproduct") { + + # Now we know the model as well, ask for mount point + + print $q->hidden(-name => "Manufacturer", -default => $q->param("Manufacturer")); + print $q->hidden(-name => "Product", -default => $q->param("Product")); + + opendir DIR, "/dev"; + my @devices = map {"/dev/$_"} (grep {!/^\./} (readdir DIR)); + closedir DIR; + print "Select mount point:"; + print $q->popup_menu(-name => "Mount point", -values => \@devices); + &next_action("startdownload"); + +} elsif ($action eq "startdownload") { + + # Do the actual download + + my $repo; + + # Does the repo exist? + + if (-d $git_dir) { + + # ... yes, pull latest version + + $repo = Git::Repository->new( work_tree => $git_dir); + print "Pulling latest version from cloud."; + print $q->pre($repo->run("pull")); } else { - print "Select ",$q->param("Manufacturer")," model:"; - print $q->popup_menu("Product", $dcs{$q->param("Manufacturer")}); + + # ... no, clone it + + my $en_username = $conf{username}; + + # We need to escape the @ in the username to be able to encode it in the URL. + # Note: If we fail, the password gets written to /var/log/apache/error.log, + # Maybe there is a better way to pass the password to git... + + $en_username =~ s/\@/%40/g; + my $git_url = 'https://' . $en_username . ':' . $conf{password} . '@cloud.subsurface-divelog.org//git/' . $conf{username}; + print "Cloning repository"; + print $q->pre(Git::Repository->run( clone => $git_url, $git_dir)); + $repo = Git::Repository->new( work_tree => $git_dir ); } + + # Assemble the command with all arguments + + my $command = "$downloader --dc-vendor=" . $q->param('Manufacturer') . + " --dc-product=" . $q->param('Product') . + " --device=" . $q->param("Mount point") . + ' ' . $git_dir . + '/[' . $conf{username} . ']'; + print $q->pre($command); + + # ... and run it + + print $q->pre(`$command`); + + # Push back to the cloud + + print "Checkout user branch"; + print $q->pre($repo->run("checkout", $conf{username})); + print "Push changes to cloud"; + print $q->pre($repo->run("push", "origin", $conf{username})); + &next_action("start"); } else { + + # This is the mode we start up in + print "Select dive computer manufacturer:"; print $q->popup_menu("Manufacturer", [sort keys %dcs]); + &next_action("setmanufacturer") } -print $q->submit(); +print $q->br(),$q->submit(-name => " OK "); print $q->end_form(); +print $q->br(), $q->a({-href => $q->url() . "?action=config"}, "Configure cloud credentials"); + sub load_supported_dcs { open IN, "/home/pi/src/subsurface/build/subsurface-downloader --list-dc|"; @@ -51,3 +163,22 @@ sub load_supported_dcs { close IN; } + +sub write_conf { + print "Writing config file\n"; + open CONFW, ">$config_file" || die "Cannot write $config_file:$!"; + foreach my $key (keys %conf) { + print CONFW "$key = $conf{$key}\n"; + } + close CONFW; + print "Done\n"; +} + +sub next_action { + my $next = shift; + $q->param(action => $next); + print $q->hidden( + -name => "action", + -value => $next); + return; +} |