moby: eg25-control: fixup perms & add service that DLs new agps data when stale
This commit is contained in:
parent
1546304b4e
commit
2291c89dbc
|
@ -16,19 +16,29 @@ in
|
|||
users.users.eg25-control = {
|
||||
group = "eg25-control";
|
||||
isSystemUser = true;
|
||||
home = "/var/lib/eg25-control";
|
||||
extraGroups = [
|
||||
"networkmanager" # required to authenticate with mmcli
|
||||
];
|
||||
};
|
||||
# TODO: persist eg25-control cache/new dirs
|
||||
sane.persist.sys.plaintext = [
|
||||
{ user = "eg25-control"; group = "eg25-control"; path = "/var/lib/eg25-control"; }
|
||||
];
|
||||
|
||||
systemd.services.eg25-control-powered = {
|
||||
description = "power to the Qualcomm eg25 modem used by PinePhone";
|
||||
serviceConfig = {
|
||||
User = "eg25-control";
|
||||
Type = "simple";
|
||||
Type = "oneshot";
|
||||
RemainAfterExit = true;
|
||||
ExecStart = "${cfg.package}/bin/eg25-control --power-on --verbose";
|
||||
ExecStop = "${cfg.package}/bin/eg25-control --power-off --verbose";
|
||||
Restart = "on-failure";
|
||||
RestartSec = "60s";
|
||||
|
||||
# XXX /sys/class/modem-power/modem-power/device/powered is writable only by root
|
||||
# User = "eg25-control";
|
||||
# WorkingDirectory = "/var/lib/eg25-control";
|
||||
# StateDirectory = "eg25-control";
|
||||
};
|
||||
after = [ "ModemManager.service" ];
|
||||
wants = [ "ModemManager.service" ];
|
||||
|
@ -40,17 +50,42 @@ in
|
|||
# - want to upload almanac even when GPS *isn't* enabled, if we have internet connection.
|
||||
description = "background GPS tracking";
|
||||
serviceConfig = {
|
||||
User = "eg25-control";
|
||||
Type = "simple";
|
||||
RemainAfterExit = true;
|
||||
ExecStart = "${cfg.package}/bin/eg25-control --enable-gps --dump-debug-info --verbose";
|
||||
ExecStop = "${cfg.package}/bin/eg25-control --disable-gps --dump-debug-info --verbose";
|
||||
Restart = "on-failure";
|
||||
RestartSec = "60s";
|
||||
|
||||
User = "eg25-control";
|
||||
WorkingDirectory = "/var/lib/eg25-control";
|
||||
StateDirectory = "eg25-control";
|
||||
};
|
||||
after = [ "eg25-control-powered.service" ];
|
||||
requires = [ "eg25-control-powered.service" ];
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
};
|
||||
|
||||
systemd.services.eg25-control-freshen-agps = {
|
||||
description = "keep assisted-GPS data fresh";
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
ExecStart = "${cfg.package}/bin/eg25-control --ensure-agps-cache --verbose";
|
||||
|
||||
User = "eg25-control";
|
||||
WorkingDirectory = "/var/lib/eg25-control";
|
||||
StateDirectory = "eg25-control";
|
||||
};
|
||||
after = [ "network-online.target" "nss-lookup.target" ];
|
||||
requires = [ "network-online.target" ];
|
||||
};
|
||||
|
||||
systemd.timers.eg25-control-freshen-agps = {
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
timerConfig = {
|
||||
OnCalender = "hourly"; # this is a bit more than necessary, but idk systemd calendar syntax
|
||||
OnStartupSec = "3min";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user