2020-01-20 00:14:17 -07:00
|
|
|
# .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.
|
2020-02-09 12:03:36 -07:00
|
|
|
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.
|
2020-01-20 00:14:17 -07:00
|
|
|
```sh
|
|
|
|
apt-get update && apt-get install -y galmon
|
|
|
|
cp /etc/default/galmon /etc/default/ubxtool-ttyACM0
|
|
|
|
systemctl enable --now ubxtool@ttyACM0
|
|
|
|
```
|
|
|
|
|
2020-02-09 12:03:36 -07:00
|
|
|
Alternate or multiple devices just repeats that, updating the device name:
|
2020-01-20 00:14:17 -07:00
|
|
|
```sh
|
|
|
|
cp /etc/default/galmon /etc/default/ubxtool-ttyACM3
|
|
|
|
systemctl enable --now ubxtool@ttyACM3
|
|
|
|
```
|
2020-02-09 12:03:36 -07:00
|
|
|
Both the ubxtool-ttyXYZn file and /dev/ttyXYZn device must exist for the unit file conditions to pass.
|
2020-01-20 00:14:17 -07:00
|
|
|
|
|
|
|
### Automatic Updates
|
|
|
|
|
|
|
|
Armbian and Raspbian have apt-daily timers enabled by default.
|
2020-01-24 23:24:13 -07:00
|
|
|
However, most configurations for unattended installs require customization.
|
2020-01-20 00:14:17 -07:00
|
|
|
|
2020-01-24 23:24:13 -07:00
|
|
|
A simple timer is included that will apply any galmon upgrades every three days:
|
|
|
|
```sh
|
|
|
|
systemctl enable --now galmon-upgrade.timer
|
|
|
|
```
|
2020-01-20 00:14:17 -07:00
|
|
|
|
|
|
|
You can perform an immediate update by hand:
|
|
|
|
```sh
|
2020-02-09 12:03:36 -07:00
|
|
|
apt-get update && apt-get -y install galmon && systemctl restart ubxtool@*
|
2020-01-20 00:14:17 -07:00
|
|
|
```
|
|
|
|
|
|
|
|
## Reference Information
|
|
|
|
|
2020-01-20 01:46:57 -07:00
|
|
|
You can stop reading here if your interest was limited to installing a compiled package.
|
2020-01-20 00:14:17 -07:00
|
|
|
|
|
|
|
### 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.
|
2020-01-20 01:46:57 -07:00
|
|
|
Refer to the manual's [tutorial](https://www.debian.org/doc/manuals/debmake-doc/ch04.en.html).
|
2020-01-20 00:14:17 -07:00
|
|
|
|
|
|
|
### 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
|
|
|
|
```
|
|
|
|
|
2020-01-25 11:43:06 -07:00
|
|
|
### Future maintenance considerations
|
2020-01-20 00:14:17 -07:00
|
|
|
|
|
|
|
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.
|
|
|
|
|
2020-01-25 11:43:06 -07:00
|
|
|
### Real World Build Results in January 2020
|
2020-01-20 00:14:17 -07:00
|
|
|
|
2020-01-25 11:43:06 -07:00
|
|
|
Avoid compiling on arm6 computers, it is slow. The arm6 used in cheap Raspberry Pi models is an expensive model to support
|
2020-01-20 00:14:17 -07:00
|
|
|
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
|
2020-01-25 11:43:06 -07:00
|
|
|
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.
|
2020-01-20 00:14:17 -07:00
|
|
|
|
|
|
|
These are fast multi-core computers but we turn off parallel compiles because of limited RAM.
|
2020-01-25 11:43:06 -07:00
|
|
|
Limiting optimizations to -O0 cuts the compile time in half approximately.
|
2020-01-20 00:14:17 -07:00
|
|
|
|
2020-01-25 11:43:06 -07:00
|
|
|
### Why do this?
|
2020-01-20 00:14:17 -07:00
|
|
|
|
|
|
|
Convenience, uniformity, and scalability:
|
|
|
|
Hand-compiling software is fun, but vendor package management solutions
|
|
|
|
exist to give us reliable unattended installations for free.
|
|
|
|
|
2020-01-25 11:43:06 -07:00
|
|
|
### Signing key
|
2020-01-20 00:14:17 -07:00
|
|
|
|
|
|
|
GPG Public Key [86E7F51C04FBAAB0](debian/86E7F51C04FBAAB0.asc)
|