git add PACKAGE-DEBIAN.md debian

pull/91/head
Patrick Tudor 2020-01-19 23:14:17 -08:00
parent f0ac720719
commit 639cf86f24
No known key found for this signature in database
GPG Key ID: 2C12D022F591B853
17 changed files with 330 additions and 0 deletions

View File

@ -54,6 +54,12 @@ install: $(PROGRAMS)
mkdir -p $(DESTDIR)$(prefix)/share/package/galmon
cp -a html $(DESTDIR)$(prefix)/share/package/galmon/
install-debian:
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
cp -i /etc/default/galmon /etc/default/ubxtool-ttyACM0
decrypt: decrypt.o bits.o ext/fmt-5.2.1/src/format.o
$(CXX) -std=gnu++17 $^ -o $@

105
PACKAGE-DEBIAN.md 100644
View File

@ -0,0 +1,105 @@
# .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.
```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:
```sh
cp /etc/default/galmon /etc/default/ubxtool-ttyACM3
systemctl enable --now ubxtool@ttyACM3
```
### Automatic Updates
Armbian and Raspbian have apt-daily timers enabled by default.
Sources should update randomly twice daily but actual package updates
will be applied randomly during a one-hour window depending on computer timezone.
You can perform an immediate update by hand:
```sh
apt-get update && apt-get -y upgrade galmon && systemctl restart ubxtool@*
```
## Reference Information
You can stop reading here if your insterest 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 arm6 computers. 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.
These are fast multi-core computers but we turn off parallel compiles because of limited RAM.
## 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)

9
debian/README.Debian vendored 100644
View File

@ -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 <debian@ptudor.net> Sun, 19 Jan 2020 22:52:16 +0000

5
debian/changelog vendored 100644
View File

@ -0,0 +1,5 @@
galmon (0.20191231-1) stable; urgency=low
* Initial release.
-- Patrick Tudor <debian@ptudor.net> Tue, 31 Dec 2019 00:00:00 +0000

1
debian/compat vendored 100644
View File

@ -0,0 +1 @@
11

23
debian/control vendored 100644
View File

@ -0,0 +1,23 @@
Source: galmon
Section: net
Priority: optional
Maintainer: Patrick Tudor <debian@ptudor.net>
Build-Depends: debhelper (>=11~)
Standards-Version: 4.1.4
Homepage: https://github.com/ahupowerdns/galmon/
Package: galmon
Architecture: any
Multi-Arch: foreign
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"

45
debian/copyright vendored 100644
View File

@ -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.

28
debian/galmon.default vendored 100644
View File

@ -0,0 +1,28 @@
# Copyright 2020 AHU Holding BV - bert@hubertnet.nl - https://berthub.eu/
# This package is free software: /usr/share/common-licenses/GPL-3
#
# INSTRUCTIONS:
# 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
#
#
# 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 DEVICE 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="--wait --owner 'OWNER' --remark 'REMARK' --gps --galileo --station 65000 --destination ::1"
#DAEMON_OPTS="--wait --owner 'OWNER' --remark 'REMARK' --gps --galileo --beidou --sbas --station 65000 --destination ::1"
#DAEMON_OPTS="--wait --owner 'OWNER' --remark 'REMARK' --gps --galileo --glonass --sbas --station 65000 --destination ::1"
#
# uBlox ZED F9T and F9P modules support all four major constellations but not SBAS.
#
#DAEMON_OPTS="--wait --owner 'OWNER' --remark 'REMARK' --gps --galileo --beidou --glonass --station 65000 --destination ::1"

50
debian/galmon.postinst vendored 100755
View File

@ -0,0 +1,50 @@
#!/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) Enabled the service"
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"
}
setup_user
print_help_text
restart_ubxtool_daemon
#DEBHELPER#

3
debian/galmon.substvars vendored 100644
View File

@ -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=

20
debian/galmon.ubxtool@.service vendored 100644
View File

@ -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

1
debian/patches/series vendored 100644
View File

@ -0,0 +1 @@
# You must remove unused comment lines for the released package.

17
debian/profile-debuild.sh vendored 100644
View File

@ -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

13
debian/rules vendored 100755
View File

@ -0,0 +1,13 @@
#!/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_dh_installsystemd:
dh_installsystemd --no-enable --no-start --name=ubxtool@ ubxtool@.service

1
debian/source/format vendored 100644
View File

@ -0,0 +1 @@
3.0 (quilt)

2
debian/source/local-options vendored 100644
View File

@ -0,0 +1,2 @@
#abort-on-upstream-changes
#unapply-patches

1
debian/watch vendored 100644
View File

@ -0,0 +1 @@
version=3