ausocean / av

Other
0 stars 0 forks source link

init: move makefile functionality to upgrader #37

Open scruzin opened 4 months ago

scruzin commented 4 months ago

At present, it is necessary to manually run make in av/init to install AusOcean software and required services.

It is proposed to have the upgrader do this instead in order to eliminate the need to log into new devices.

A new init bool syntax in pkg.json would identify components that need only be installed once and/or commands that only need to be run once.

For example, to install and enable the rv.service:

    {
    "name": "rv.service",
    "shared": true,
    "init": true,
    "cmd": "cp -f $name /etc/systemd/system; systemctl enable $name"
    }
ao-david commented 4 months ago

Perhaps adding a path that looks like dl/<device type>/init/<version>/pkg.json Could also allow these components to only be update rarely when we make a change rather being included in every package, this way as well, a device only needs to visit the init directory once.

trekhopton commented 4 months ago

How would the upgrader know if it has performed the command once already, and not do the command every time on startup?

scruzin commented 4 months ago

The upgrader keeps a record of the last package it installed under /opt/ausocean/data.

That being said, if the checksum is unchanged it won't do it again.

scruzin commented 4 months ago

Perhaps adding a path that looks like dl/<device type>/init/<version>/pkg.json Could also allow these components to only be update rarely when we make a change rather being included in every package, this way as well, a device only needs to visit the init directory once.

Yes, I thought about having a separate package just for init, but I think having a single package is preferable. I'll give it some more thought, though.

scruzin commented 4 months ago

BTW, the cmd functionality for executing shell commands from the upgrader is already supported.