diff --git a/Makefile b/Makefile index 0f4ca41..c238526 100644 --- a/Makefile +++ b/Makefile @@ -8,6 +8,13 @@ CXXFLAGS:= -std=gnu++17 -Wall -O2 -ggdb -MMD -MP -fno-omit-frame-pointer -Iext/C # CXXFLAGS += -Wno-delete-non-virtual-dtor +# If unset, create a variable for the path or binary to use as "install" for debuild. +INSTALL ?= install +# If unset, create a variable with the path used by "make install" +prefix ?= /usr/local/ubxtool +# If unset, create a variable for a path underneath $prefix that stores html files +htdocs ?= /share/package + ifneq (,$(wildcard ubxsec.c)) EXTRADEP = ubxsec.o else ifneq (,$(wildcard ubxsec.o)) @@ -40,6 +47,30 @@ clean: rm -f *~ *.o *.d ext/*/*.o ext/*/*.d $(PROGRAMS) navmon.pb.h navmon.pb.cc $(patsubst %.cc,%.o,$(wildcard ext/sgp4/libsgp4/*.cc)) $(H2OPP) $(SIMPLESOCKETS) rm -f ext/fmt-6.1.2/src/format.[do] ext/sgp4/libsgp4/*.d ext/powerblog/ext/simplesocket/*.d +help2man: + $(INSTALL) -m 755 -d $(DESTDIR)$(prefix)/share/man/man1 + HELP2MAN_DESCRIPTION=Open-source GNSS Monitoring Project + $(foreach binaryfile,$(PROGRAMS),help2man -N -n "$(HELP2MAN_DESCRIPTION)" ./$(binaryfile) | gzip > $(DESTDIR)$(prefix)/share/man/man1/$(binaryfile).1.gz;) + @echo until these binaries support --help and --version remove the broken output + rm -f $(DESTDIR)$(prefix)/share/man/man1/testrunner.1.gz + +install: $(PROGRAMS) help2man + $(INSTALL) -m 755 -d $(DESTDIR)$(prefix)/bin + $(foreach binaryfile,$(PROGRAMS),$(INSTALL) -s -m 755 -D ./$(binaryfile) $(DESTDIR)$(prefix)/bin/$(binaryfile);) + @echo "using cp instead of install because recursive directories of ascii" + mkdir -p $(DESTDIR)$(prefix)$(htdocs)/galmon + cp -a html $(DESTDIR)$(prefix)$(htdocs)/galmon/ + +download-debian-package: + apt-key adv --fetch-keys https://ota.bike/public-package-signing-keys/86E7F51C04FBAAB0.asc + echo "deb https://ota.bike/debian/ buster main" > /etc/apt/sources.list.d/galmon.list + apt-get update && apt-get install -y galmon + +download-raspbian-package: + apt-key adv --fetch-keys https://ota.bike/public-package-signing-keys/86E7F51C04FBAAB0.asc + echo "deb https://ota.bike/raspbian/ buster main" > /etc/apt/sources.list.d/galmon.list + apt-get update && apt-get install -y galmon + decrypt: decrypt.o bits.o ext/fmt-6.1.2/src/format.o $(CXX) -std=gnu++17 $^ -o $@ diff --git a/PACKAGE-DEBIAN.md b/PACKAGE-DEBIAN.md new file mode 100644 index 0000000..2239fcd --- /dev/null +++ b/PACKAGE-DEBIAN.md @@ -0,0 +1,112 @@ +# .deb Package Overview + +2020-01-20: Initial Commit + +## Important Information + +This section is a step-by-step tutorial. + +### Basic Installation + +Pick either debian (almost everything) or raspbian (special armv6 build for older models) and create the source file. +```sh +echo "deb https://ota.bike/raspbian/ buster main" > /etc/apt/sources.list.d/galmon.list +echo "deb https://ota.bike/debian/ buster main" > /etc/apt/sources.list.d/galmon.list +``` + +Install the file used to ensure the software is verified. +```sh +apt-key adv --fetch-keys https://ota.bike/public-package-signing-keys/86E7F51C04FBAAB0.asc +``` + +Update your package list and install galmon. Then create a configuration file and start the daemon. +If you have a typical device using the onboard USB at /dev/ttyACM0, drop the directory element +and refer to ttyACM0 in both the default variable file and the unit name. +```sh +apt-get update && apt-get install -y galmon +cp /etc/default/galmon /etc/default/ubxtool-ttyACM0 +systemctl enable --now ubxtool@ttyACM0 +``` + +Alternate or multiple devices just repeats that, updating the device name: +```sh +cp /etc/default/galmon /etc/default/ubxtool-ttyACM3 +systemctl enable --now ubxtool@ttyACM3 +``` +Both the ubxtool-ttyXYZn file and /dev/ttyXYZn device must exist for the unit file conditions to pass. + +### Automatic Updates + +Armbian and Raspbian have apt-daily timers enabled by default. +However, most configurations for unattended installs require customization. + +A simple timer is included that will apply any galmon upgrades every three days: +```sh +systemctl enable --now galmon-upgrade.timer +``` + +You can perform an immediate update by hand: +```sh +apt-get update && apt-get -y install galmon && systemctl restart ubxtool@* +``` + +## Reference Information + +You can stop reading here if your interest was limited to installing a compiled package. + +### One time steps for bootstrapping package build on a fresh git repo + +Run debmake in the source directory. It tries to autocreate 90% of everything you need in the debian folder. +Key files: copyright, changelog, control, and anything else that looks interesting to cat. Once they exist, we're done. +Refer to the manual's [tutorial](https://www.debian.org/doc/manuals/debmake-doc/ch04.en.html). + +### One time steps for creating package-specific files and scripts + +Inside the debian directory are files that begin with galmon, the name of the package as defined in the control file. +- galmon.postinst: this script is run after installation to verify a system account exists. +- galmon.default: this file is installed as /etc/default/galmon +- galmon.ubxtool@.service: this unit file uses %i as a reference to the device for computers with multiple inputs. + +### How to build the package locally + +In short you need to set some variables, refer to profile-debuild.sh in the debian/ directory. +After that, use debuild to install the package. Signing of the end result may fail and creating +GPG key pairs is beyond the scope of this document but just make sure you match the email in the changelog. +```sh +apt-get install -y build-essential devscripts lintian diffutils patch patchutils +git clone $flags galmon.git ; cd galmon +./make-githash.h +# create and source variables in /etc/profile.d/debuild.sh +debuild +dpkg -i ../*.deb +``` + +### Future maintenance considerations + +The githash.h files cannot change after the debuild process has started. +For now, the Makefile used by debuild does not run that script and +the files must be created before starting the debuild process. + +### Real World Build Results in January 2020 + +Avoid compiling on arm6 computers, it is slow. The arm6 used in cheap Raspberry Pi models is an expensive model to support +relative to the much faster arm7 and arm8 computers available. Compiling approaches 90 minutes at O3. + +The arm7 and arm8 both compile in 20 to 30 minutes at -j1 -O3 but the 64 bit arm8 has approximately +double the RAM requirements during compilation. To avoid swapping, increasing compile time 150%, +use hardware with at least 1GB of RAM. The NanoPi Neo2 and NanoPi ZeroPi models with 512MB of RAM +are perfect clients, but the OrangePi PCs with 1GB of RAM and the Allwinner H3 or H5 are +better suited for smooth building. For comparison, a VM on a low-end AMD Ryzen 3 2200G builds the package at -j1 in about two minutes. + +These are fast multi-core computers but we turn off parallel compiles because of limited RAM. +Limiting optimizations to -O0 cuts the compile time in half approximately. + +### Why do this? + +Convenience, uniformity, and scalability: +Hand-compiling software is fun, but vendor package management solutions +exist to give us reliable unattended installations for free. + +### Signing key + +GPG Public Key [86E7F51C04FBAAB0](debian/86E7F51C04FBAAB0.asc) diff --git a/debian/86E7F51C04FBAAB0.asc b/debian/86E7F51C04FBAAB0.asc new file mode 100644 index 0000000..6e989b3 --- /dev/null +++ b/debian/86E7F51C04FBAAB0.asc @@ -0,0 +1,87 @@ +-----BEGIN PGP PUBLIC KEY BLOCK----- + +mQINBF4kzeMBEAClLiZy741lfdoZHvlCbU1k4o9CglhVAPnSqTo7tH0AkdXmp/sG +Sxk20miLlNNaxTYhHLyWIMhLoR3ogAJSoUsbMo4cpC5owdai06Q2nINTGiD1Vwak +MmSStQl/aG01G1u9Ei/FVSr/K6Nd8u+dvUoU6tFSoXtXXaRB5pkyLOaZXq6UTwhw +tI5f+uH2d8kgkoGNWl/jevn7K5AqCWmklfzYFCeogXemcNMdisrm2RzYzay70Qo+ +3qKHzQUN5S6Ne2yYKYN1UacGg+38+zhoSNGy8fB2XfCf8mbW2NnnZBdPEmpu1yos +uvjj/oauZlLgkx/ZzK4PzmWqpe+aEiV7Z8lPO3Y2U/cwkU56aMIFQq2DU4FgQUdn +6J+tLeMPh0sbIfYeOfF5IdFi85PdD4w7C8hmxu7aHl/B/GCnOFYAsSChpf4bpgWB +G1Pne56evHeSNYXQCdE4rjyYGqB/F+EWn/NYcOdKSkOxxE5bL/aU/uqPss5E54nt +z+qsN9ynGNWsnkPQECulM3svS3/nffnmgFSuDZyON4Y8/LFIkPizBiqOtrVEAKdK +CqKz+A2fgSamM5IbJbCSkXWMcU6W0Sz0DzSpMbVf5kKER7WeDoeWr6yUHqAkPyHz +bx/YLWwrAjuuN00/MuIl8XXHWBHsfRqIrqLSBbie5mbOv2MloBEdrvZqvwARAQAB +tDRHYWxtb24gRGViaWFuIFByaW1hcnkgU2lnbmluZyBLZXkgPGRlYmlhbkBnYWxt +b24uZXU+iQJUBBMBCAA+FiEEbe3qslh61wzGNEF6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QPFOE6IjG6Acpkh+LEdIYrY4hZmlaQqE3rXcye94rr +F8ga+2XPNAwVH9zngrk1gZrTZmPkNkTG94kTfFwuAEmFWd6Dyf4IBoMacdpUyLTV +99zduIWc4SOdzEawU0JdD50dkSlHDJsoNamhHe60MELbLOQjN43n3KqKHjIpgZcd +2k2OFa/4uOXYoj3KmWxTKCV+BIcMuQfaaLJLHd1Uar59DExIatvw0aVWuj2M70tu +J7VNNdmxD1RF3zsMFsPTQWY= +=fqVo +-----END PGP PUBLIC KEY BLOCK----- diff --git a/debian/README.Debian b/debian/README.Debian new file mode 100644 index 0000000..1e39077 --- /dev/null +++ b/debian/README.Debian @@ -0,0 +1,9 @@ +galmon for Debian + +This directory contains files created by debmake and +required by debuild to create Debian packages. + +For further instruction, review the Guide for Debian Maintainers +by Osamu Aoki: https:/www.debian.org/doc/manuals/debmake-doc/ + + -- Patrick Tudor Sun, 19 Jan 2020 22:52:16 +0000 diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..ae8406c --- /dev/null +++ b/debian/changelog @@ -0,0 +1,5 @@ +galmon (0.20191231-1) stable; urgency=low + + * Initial release. + + -- Patrick Tudor Tue, 31 Dec 2019 00:00:00 +0000 diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..b4de394 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +11 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..820b320 --- /dev/null +++ b/debian/control @@ -0,0 +1,24 @@ +Source: galmon +Section: net +Priority: optional +Maintainer: Patrick Tudor +Build-Depends: debhelper (>=11~) +Standards-Version: 4.3.0 +Homepage: https://github.com/ahupowerdns/galmon/ + +Package: galmon +Architecture: any +Multi-Arch: foreign +Conflicts: gpsd-clients +Depends: ${misc:Depends}, ${shlibs:Depends} +Description: galmon GNSS Monitoring Project software + 88 + 88 + 88 + ,adPPYb,d8 ,adPPYYba, 88 88,dPYba,,adPYba, ,adPPYba, 8b,dPPYba, + a8" `Y88 "" `Y8 88 88P' "88" "8a a8" "8a 88P' `"8a + 8b 88 ,adPPPPP88 88 88 88 88 8b d8 88 88 + "8a, ,d88 88, ,88 88 88 88 88 "8a, ,a8" 88 88 + `"YbbdP"Y8 `"8bbdP"Y8 88 88 88 88 `"YbbdP"' 88 88 + aa, ,88 + "Y8bbdP" diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..a5f110a --- /dev/null +++ b/debian/copyright @@ -0,0 +1,45 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: galmon +Source: https://github.com/ahupowerdns/galmon + +Files: * +Copyright: AHU Holding BV - bert@hubertnet.nl - https://berthub.eu/ +License: GPL-3 + This package is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + . + This package is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + . + You should have received a copy of the GNU General Public License + along with this package; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + . + On Debian systems, the complete text of the GNU General + Public License can be found in `/usr/share/common-licenses/GPL-3'. + +Files: minicurl.cc + minicurl.hh +Copyright: 2018-2019 powerdns.com bv +License: Expat + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + . + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + . + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. diff --git a/debian/galmon.default b/debian/galmon.default new file mode 100644 index 0000000..82ae9b1 --- /dev/null +++ b/debian/galmon.default @@ -0,0 +1,32 @@ +# Copyright 2020 AHU Holding BV - bert@hubertnet.nl - https://berthub.eu/ +# https://galmon.eu - https://github.com/ahupowerdns/galmon +# This package is free software: /usr/share/common-licenses/GPL-3 +# +# INSTRUCTIONS: +# (Pre-condition: "dmesg | tail" reports your GPS device appears on /dev/ttyACM0.) +# Copy this file from /etc/default/galmon to /etc/default/ubxtool-ttyACM0 +# Please choose your constellations, update the owner and remark, and set your station and destination (ipv6 supported) +# After customization, start the daemon: +# systemctl enable --now ubxtool@ttyACM0 && journalctl -fu ubxtool +# If you want, enable automatic upgrades at boot and every three days following: +# systemctl enable --now galmon-upgrade.timer +# If you have several devices, enable multiple services with their unique device names. +# +# FOR HELP: +# Review the Operator.md file: https://github.com/ahupowerdns/galmon/blob/master/Operator.md +# Download an IRC client like Textual (Mac) or HexChat (Windows). Join #galileo on the OFTC servers. +# Thank you for contributing, it is nice to see data from your location on the map. +# +# +# DO NOT SET THE "PORT" OPTION HERE. +# The device is set by an argument to service, see above. +# +# uBlox M8-series and Aliexpress Specials support ( (gps AND galileo) AND ( beidou OR glonass) ) with optional SBAS. +# +DAEMON_OPTS="--owner 'OWNER' --remark 'REMARK' --gps --galileo --sbas --station 65000 --destination ::1" +#DAEMON_OPTS="--owner 'OWNER' --remark 'REMARK' --gps --galileo --beidou --sbas --station 65000 --destination ::1" +#DAEMON_OPTS="--owner 'OWNER' --remark 'REMARK' --gps --galileo --glonass --sbas --station 65000 --destination ::1" +# +# uBlox ZED F9T and F9P modules support all four major constellations simultaneously but not SBAS. +# +#DAEMON_OPTS="--owner 'OWNER' --remark 'REMARK' --gps --galileo --beidou --glonass --station 65000 --destination ::1" diff --git a/debian/galmon.docs b/debian/galmon.docs new file mode 100644 index 0000000..b78a1aa --- /dev/null +++ b/debian/galmon.docs @@ -0,0 +1,6 @@ +Building.md +influxdb.md +Operator.md +PACKAGE-DEBIAN.md +README.md + diff --git a/debian/galmon.galmon-upgrade.service b/debian/galmon.galmon-upgrade.service new file mode 100644 index 0000000..3c80a14 --- /dev/null +++ b/debian/galmon.galmon-upgrade.service @@ -0,0 +1,15 @@ +[Unit] +Description=Upgrade Galmon Software +After=network.target nss-lookup.target +StartLimitIntervalSec=0 +# require that the configuration exists +ConditionPathExists=/etc/default/galmon + +[Service] +Type=simple +Restart=no +ExecStartPre=+apt-get update +ExecStart=+apt-get install -y galmon + +[Install] +WantedBy=multi-user.target diff --git a/debian/galmon.galmon-upgrade.timer b/debian/galmon.galmon-upgrade.timer new file mode 100644 index 0000000..d09da10 --- /dev/null +++ b/debian/galmon.galmon-upgrade.timer @@ -0,0 +1,10 @@ +[Unit] +Description=Update galmon +Documentation=https://github.com/ahupowerdns/galmon + +[Timer] +OnBootSec=3min +OnUnitActiveSec=3d + +[Install] +WantedBy=timers.target diff --git a/debian/galmon.navnexus.service b/debian/galmon.navnexus.service new file mode 100644 index 0000000..8058f3f --- /dev/null +++ b/debian/galmon.navnexus.service @@ -0,0 +1,20 @@ +[Unit] +Description=galmon navnexus (serve recorded data on port 29601) +After=network.target nss-lookup.target +StartLimitIntervalSec=0 +# require that the pre-installed configuration file exists +ConditionPathExists=/etc/default/navstar + +[Service] +# Customize $DAEMON_OPTS_NAVNEXUS in /etc/default/navstar +EnvironmentFile=-/etc/default/navstar +Type=simple +Restart=always +RestartSec=4 +User=ubxtool +Group=ubxtool +RuntimeDirectory=navnexus +ExecStart=/usr/bin/navnexus $DAEMON_OPTS_NAVNEXUS + +[Install] +WantedBy=multi-user.target diff --git a/debian/galmon.navrecv.service b/debian/galmon.navrecv.service new file mode 100644 index 0000000..12c06b5 --- /dev/null +++ b/debian/galmon.navrecv.service @@ -0,0 +1,20 @@ +[Unit] +Description=galmon navrecv (receive data on port 29603) +After=network.target nss-lookup.target +StartLimitIntervalSec=0 +# require that the pre-installed configuration file exists +ConditionPathExists=/etc/default/navstar + +[Service] +# Customize $DAEMON_OPTS_NAVRECV in /etc/default/navstar +EnvironmentFile=-/etc/default/navstar +Type=simple +Restart=always +RestartSec=1 +User=ubxtool +Group=ubxtool +RuntimeDirectory=navrecv +ExecStart=/usr/bin/navrecv $DAEMON_OPTS_NAVRECV + +[Install] +WantedBy=multi-user.target diff --git a/debian/galmon.navstar.default b/debian/galmon.navstar.default new file mode 100644 index 0000000..d593292 --- /dev/null +++ b/debian/galmon.navstar.default @@ -0,0 +1,9 @@ +# Copyright 2020 AHU Holding BV - bert@hubertnet.nl - https://berthub.eu/ +# https://galmon.eu - https://github.com/ahupowerdns/galmon +# This package is free software: /usr/share/common-licenses/GPL-3 +# +# Here are daemon options used by the navrecv and navnexus services +DAEMON_OPTS_NAVNEXUS="--storage /var/lib/galmon/storage --bind ::1" +DAEMON_OPTS_NAVRECV="--bind ::1 --storage /var/lib/galmon/storage" +# +DAEMON_OPTS_NAVPARSE="--bind [::1]:10000 --html /usr/share/package/galmon/html --influxdb galileo" diff --git a/debian/galmon.postinst b/debian/galmon.postinst new file mode 100755 index 0000000..f11d2d5 --- /dev/null +++ b/debian/galmon.postinst @@ -0,0 +1,52 @@ +#!/bin/sh +# ptudor 20200120 +set -e + +#. /usr/share/debconf/confmodule + +setup_user() { + +if getent group ubxtool > /dev/null ; then + echo "galmon: ubxtool group exists, skipping" +else + echo "galmon: creating ubxtool system group" + addgroup --system ubxtool +fi + +if getent passwd ubxtool > /dev/null ; then + echo "galmon: ubxtool user exists, skipping" +else + echo "galmon: creating ubxtool system user" + adduser --system ubxtool && adduser ubxtool ubxtool + echo "galmon: adding ubxtool user to dialout group" + adduser ubxtool dialout +fi +} + +restart_ubxtool_daemon() { +# I feel like this belongs in rules with dh_installsystemd but do not understand how to add the wildcard. +if systemctl is-active 'ubxtool@*' > /dev/null ; then + echo "galmon: restarting ubxtool." + systemctl daemon-reload && systemctl restart 'ubxtool@*' +else + echo "galmon: ubxtool services are not currently enabled, not restarting." +fi +} + +print_help_text() { + echo "Galmon installation finished. If this is your first time, please:" + echo " 1) Create a ubxtool configuration 2) Enable the service" + echo " 3) Enable the timer for automatic upgrades if you want" + echo "Replace ttyACM0 below with your device listed in /dev" + echo "Example: cp /etc/default/galmon /etc/default/ubxtool-ttyACM0" + echo "Example: vi /etc/default/ubxtool-ttyACM0" + echo "Example: systemctl enable --now ubxtool@ttyACM0" + echo "Example: systemctl enable --now galmon-upgrade.timer" +} + +setup_user +print_help_text +restart_ubxtool_daemon + +#DEBHELPER# + diff --git a/debian/galmon.substvars b/debian/galmon.substvars new file mode 100644 index 0000000..93cbc70 --- /dev/null +++ b/debian/galmon.substvars @@ -0,0 +1,3 @@ +shlibs:Depends=libc6 (>= 2.28), libcurl4 (>= 7.16.2), libgcc1 (>= 1:3.5), libh2o-evloop0.13, libncurses6 (>= 6), libprotobuf17, libssl1.1 (>= 1.1.0), libstdc++6 (>= 6), libtinfo6 (>= 6), zlib1g (>= 1:1.1.4) +misc:Depends= +misc:Pre-Depends= diff --git a/debian/galmon.ubxtool@.service b/debian/galmon.ubxtool@.service new file mode 100644 index 0000000..dc2ec35 --- /dev/null +++ b/debian/galmon.ubxtool@.service @@ -0,0 +1,20 @@ +[Unit] +Description=galmon ubxtool on /dev/%I +After=network.target nss-lookup.target +StartLimitIntervalSec=0 +# require that both the device and configuration exist +ConditionPathExists=/dev/%i +ConditionPathExists=/etc/default/ubxtool-%i + +[Service] +EnvironmentFile=-/etc/default/ubxtool-%i +Type=simple +Restart=always +RestartSec=4 +User=ubxtool +Group=ubxtool +RuntimeDirectory=ubxtool +ExecStart=/usr/bin/ubxtool --port /dev/%i $DAEMON_OPTS + +[Install] +WantedBy=multi-user.target diff --git a/debian/patches/series b/debian/patches/series new file mode 100644 index 0000000..4a97dfa --- /dev/null +++ b/debian/patches/series @@ -0,0 +1 @@ +# You must remove unused comment lines for the released package. diff --git a/debian/profile-debuild.sh b/debian/profile-debuild.sh new file mode 100644 index 0000000..fb27ffd --- /dev/null +++ b/debian/profile-debuild.sh @@ -0,0 +1,17 @@ +# This file of environment variables is sourced via /etc/profile.d/debuild.sh +# +# It sets the email and name of the maintainer first. +# Next we disable parallel builds for ram conservation, normally enabled. +# Finally we add hardening to the build. + +DEBEMAIL="debian@ptudor.net" +DEBFULLNAME="Patrick Tudor" + +# "nocheck" here because testrunner runs out of ram on most current arm hardware -pht +# manual: dh_auto_test: If the DEB_BUILD_OPTIONS environment variable contains nocheck, no tests will be performed. +DEB_BUILD_OPTIONS='parallel=1 nocheck' + +# https://wiki.debian.org/Hardening +DEB_BUILD_MAINT_OPTIONS='hardening=+all' + +export DEBEMAIL DEBFULLNAME DEB_BUILD_OPTIONS DEB_BUILD_MAINT_OPTIONS diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..bbd88e5 --- /dev/null +++ b/debian/rules @@ -0,0 +1,22 @@ +#!/usr/bin/make -f +export DEB_BUILD_MAINT_OPTIONS = hardening=+all +export DEB_CFLAGS_MAINT_APPEND = -Wall -pedantic +export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed + +%: + dh $@ + +override_dh_auto_install: + dh_auto_install -- prefix=/usr + +# override to install /etc/default/navstar alongside /etc/default/galmon +override_dh_installinit: + dh_installinit --name=navstar + dh_installinit + +override_dh_installsystemd: + dh_installsystemd --no-enable --no-start --name=galmon-upgrade galmon-upgrade.service + dh_installsystemd --no-enable --no-start --name=galmon-upgrade galmon-upgrade.timer + dh_installsystemd --no-enable --no-start --name=navnexus navnexus.service + dh_installsystemd --no-enable --no-start --name=navrecv navrecv.service + dh_installsystemd --no-enable --no-start --name=ubxtool@ ubxtool@.service diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 0000000..163aaf8 --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +3.0 (quilt) diff --git a/debian/source/local-options b/debian/source/local-options new file mode 100644 index 0000000..00131ee --- /dev/null +++ b/debian/source/local-options @@ -0,0 +1,2 @@ +#abort-on-upstream-changes +#unapply-patches diff --git a/debian/watch b/debian/watch new file mode 100644 index 0000000..9e7c0da --- /dev/null +++ b/debian/watch @@ -0,0 +1 @@ +version=3