System OTA for Linux Gateways
System OTA is a robust, unattended update system for Linux Gateways, suitable for home automation gateways and other devices where reliability is paramount.
OSTC Forum
This component is being designed and discussed on the OSTC Forum https://forum.ostc-eu.org/t/over-the-air-updates-ota/28/
Development
This is a standard go project. Use go get git.ostc-eu.org/OSTC/OHOS/components/sysota
to get it. Once in the resulting
directory under $GOPATH
, typically
~/go/src/git.ostc-eu.org/OSTC/OHOS/components/sysota
run go test ./...
to
run unit tests. There are no integration tests yet.
To try the service out in practice you may want to do this though:
make configure
./configure --prefix=/usr
make
sudo make install
sudo systemctl enable sysotad.service
As you iterate you may need to refresh in-memory definition of systemd unit files:
sudo systemctl daemon-reload
To remove what you've installed run the uninstall target:
sudo make uninstall
Remember that uninstall
is stateless, if you want to rename a file, first
uninstall
, then rename and finally install
again.
Testing
The project has a combination of unit tests, available through the standard go interface, and integration tests implemented with spread.
To execute unit tests run:
go test ./...
To execute integration tests you will need a working installation of spread
and lxd
or qemu
. Currently LXD is preferred, as it is faster and easier to
configure correctly. GitLab CI uses qemu
as LXD cannot be used from a docker
container. For more information on how to prepare a test environment with
qemu
, refer to the spread-image-hirsute
job defined in .gitlab-ci.yml
.
A compatible build of spread is available from the Ubuntu PPA
ppa:zyga/oh-tools
. It can be also compiled from sources at
https://git.ostc-eu.org/OSTC/tools/oh-spread/.
LXD is available as a snap package. Install it with sudo snap install lxd
and
then initialize it with sudo lxd init --auto
.
To execute integration tests run:
spread -v lxd:
You may want to pass some options to spread, namely -reuse -resend
to speed
up subsequent runs by keeping the ephemeral container with all the build
dependencies and cache around.
Packaging
While there is no official packaging yet, the build system does support the
standard configure --prefix=/usr && make && sudo make install
combo.
You may want to enable the sysotad.service
systemd unit after installation.