399 lines
10 KiB
JSON
399 lines
10 KiB
JSON
{
|
|
"module": "power",
|
|
"version": "1",
|
|
"moved": true,
|
|
"templates": "templates",
|
|
"capabilities": [
|
|
"package-manager",
|
|
"service-manager"
|
|
],
|
|
"claims": [
|
|
{
|
|
"name": "node-power",
|
|
"scope": "node"
|
|
}
|
|
],
|
|
"emits": [
|
|
"booted",
|
|
"sleeping",
|
|
"woke",
|
|
"shutting-down",
|
|
"on-mains",
|
|
"on-battery",
|
|
"battery-low"
|
|
],
|
|
"state": [
|
|
{
|
|
"name": "draw",
|
|
"ttl-seconds": 30,
|
|
"per-machine": true
|
|
}
|
|
],
|
|
"tools": [
|
|
"power_state",
|
|
"power_hooks",
|
|
"power_history",
|
|
"power_run",
|
|
"power_check"
|
|
],
|
|
"config": {
|
|
"handle-power-key": {
|
|
"type": "string",
|
|
"description": "What logind does when the power key is pressed: one of logind's actions, such as suspend, ignore or poweroff (logind.conf(5)); the operator's choice for this machine, with no default.",
|
|
"enum": [
|
|
"ignore",
|
|
"poweroff",
|
|
"reboot",
|
|
"halt",
|
|
"kexec",
|
|
"suspend",
|
|
"hibernate",
|
|
"hybrid-sleep",
|
|
"suspend-then-hibernate",
|
|
"lock",
|
|
"factory-reset",
|
|
"sleep"
|
|
],
|
|
"trusted": true,
|
|
"required": true
|
|
},
|
|
"handle-lid-switch": {
|
|
"type": "string",
|
|
"description": "What logind does when the lid is closed on battery: one of logind's actions, such as suspend, ignore or poweroff (logind.conf(5)); the operator's choice for this machine, with no default.",
|
|
"enum": [
|
|
"ignore",
|
|
"poweroff",
|
|
"reboot",
|
|
"halt",
|
|
"kexec",
|
|
"suspend",
|
|
"hibernate",
|
|
"hybrid-sleep",
|
|
"suspend-then-hibernate",
|
|
"lock",
|
|
"factory-reset",
|
|
"sleep"
|
|
],
|
|
"trusted": true,
|
|
"required": true
|
|
},
|
|
"handle-lid-switch-external-power": {
|
|
"type": "string",
|
|
"description": "What logind does when the lid is closed on external power: one of logind's actions, such as suspend, ignore or poweroff (logind.conf(5)); the operator's choice for this machine, with no default.",
|
|
"enum": [
|
|
"ignore",
|
|
"poweroff",
|
|
"reboot",
|
|
"halt",
|
|
"kexec",
|
|
"suspend",
|
|
"hibernate",
|
|
"hybrid-sleep",
|
|
"suspend-then-hibernate",
|
|
"lock",
|
|
"factory-reset",
|
|
"sleep"
|
|
],
|
|
"trusted": true,
|
|
"required": true
|
|
},
|
|
"handle-lid-switch-docked": {
|
|
"type": "string",
|
|
"description": "What logind does when the lid is closed while docked or with another screen attached: one of logind's actions, such as suspend, ignore or poweroff (logind.conf(5)); the operator's choice for this machine, with no default.",
|
|
"enum": [
|
|
"ignore",
|
|
"poweroff",
|
|
"reboot",
|
|
"halt",
|
|
"kexec",
|
|
"suspend",
|
|
"hibernate",
|
|
"hybrid-sleep",
|
|
"suspend-then-hibernate",
|
|
"lock",
|
|
"factory-reset",
|
|
"sleep"
|
|
],
|
|
"trusted": true,
|
|
"required": true
|
|
}
|
|
},
|
|
"resources": [
|
|
{
|
|
"id": "polkit",
|
|
"type": "package",
|
|
"package": "polkit"
|
|
},
|
|
{
|
|
"id": "scripts",
|
|
"type": "archive",
|
|
"path": "/usr/local/lib/mesh-power",
|
|
"artifact": "scripts"
|
|
},
|
|
{
|
|
"id": "config-dir",
|
|
"type": "directory",
|
|
"path": "/etc/mesh-power",
|
|
"mode": "0755"
|
|
},
|
|
{
|
|
"id": "moments-dir",
|
|
"type": "directory",
|
|
"path": "/etc/mesh-power/moments",
|
|
"mode": "0755"
|
|
},
|
|
{
|
|
"id": "moment-after-boot",
|
|
"type": "file",
|
|
"path": "/etc/mesh-power/moments/after-boot",
|
|
"mode": "0644",
|
|
"template": "templates/mesh-power/moments/after-boot"
|
|
},
|
|
{
|
|
"id": "moment-before-sleep",
|
|
"type": "file",
|
|
"path": "/etc/mesh-power/moments/before-sleep",
|
|
"mode": "0644",
|
|
"template": "templates/mesh-power/moments/before-sleep"
|
|
},
|
|
{
|
|
"id": "moment-after-wake",
|
|
"type": "file",
|
|
"path": "/etc/mesh-power/moments/after-wake",
|
|
"mode": "0644",
|
|
"template": "templates/mesh-power/moments/after-wake"
|
|
},
|
|
{
|
|
"id": "moment-before-shutdown",
|
|
"type": "file",
|
|
"path": "/etc/mesh-power/moments/before-shutdown",
|
|
"mode": "0644",
|
|
"template": "templates/mesh-power/moments/before-shutdown"
|
|
},
|
|
{
|
|
"id": "moment-on-mains",
|
|
"type": "file",
|
|
"path": "/etc/mesh-power/moments/on-mains",
|
|
"mode": "0644",
|
|
"template": "templates/mesh-power/moments/on-mains"
|
|
},
|
|
{
|
|
"id": "moment-on-battery",
|
|
"type": "file",
|
|
"path": "/etc/mesh-power/moments/on-battery",
|
|
"mode": "0644",
|
|
"template": "templates/mesh-power/moments/on-battery"
|
|
},
|
|
{
|
|
"id": "logind-drop-ins",
|
|
"type": "directory",
|
|
"path": "/etc/systemd/logind.conf.d",
|
|
"mode": "0755"
|
|
},
|
|
{
|
|
"id": "logind-power",
|
|
"type": "file",
|
|
"path": "/etc/systemd/logind.conf.d/power.conf",
|
|
"mode": "0644",
|
|
"template": "templates/systemd/logind.conf.d/power.conf"
|
|
},
|
|
{
|
|
"id": "logind",
|
|
"type": "service",
|
|
"unit": "systemd-logind.service",
|
|
"reload-on": [
|
|
"logind-power"
|
|
]
|
|
},
|
|
{
|
|
"id": "after-boot-unit",
|
|
"type": "file",
|
|
"path": "/etc/systemd/system/mesh-power-after-boot.service",
|
|
"mode": "0644",
|
|
"template": "templates/systemd/system/mesh-power-after-boot.service"
|
|
},
|
|
{
|
|
"id": "before-shutdown-unit",
|
|
"type": "file",
|
|
"path": "/etc/systemd/system/mesh-power-before-shutdown.service",
|
|
"mode": "0644",
|
|
"template": "templates/systemd/system/mesh-power-before-shutdown.service"
|
|
},
|
|
{
|
|
"id": "before-sleep-unit",
|
|
"type": "file",
|
|
"path": "/etc/systemd/system/mesh-power-before-sleep.service",
|
|
"mode": "0644",
|
|
"template": "templates/systemd/system/mesh-power-before-sleep.service"
|
|
},
|
|
{
|
|
"id": "after-wake-unit",
|
|
"type": "file",
|
|
"path": "/etc/systemd/system/mesh-power-after-wake.service",
|
|
"mode": "0644",
|
|
"template": "templates/systemd/system/mesh-power-after-wake.service"
|
|
},
|
|
{
|
|
"id": "supply-unit",
|
|
"type": "file",
|
|
"path": "/etc/systemd/system/mesh-power-supply.service",
|
|
"mode": "0644",
|
|
"template": "templates/systemd/system/mesh-power-supply.service"
|
|
},
|
|
{
|
|
"id": "sleep-drop-ins",
|
|
"type": "directory",
|
|
"path": "/etc/systemd/system/sleep.target.d",
|
|
"mode": "0755"
|
|
},
|
|
{
|
|
"id": "sleep-wants",
|
|
"type": "file",
|
|
"path": "/etc/systemd/system/sleep.target.d/mesh-power.conf",
|
|
"mode": "0644",
|
|
"template": "templates/systemd/system/sleep.target.d/mesh-power.conf"
|
|
},
|
|
{
|
|
"id": "suspend-drop-ins",
|
|
"type": "directory",
|
|
"path": "/etc/systemd/system/suspend.target.d",
|
|
"mode": "0755"
|
|
},
|
|
{
|
|
"id": "suspend-wants",
|
|
"type": "file",
|
|
"path": "/etc/systemd/system/suspend.target.d/mesh-power.conf",
|
|
"mode": "0644",
|
|
"template": "templates/systemd/system/suspend.target.d/mesh-power.conf"
|
|
},
|
|
{
|
|
"id": "hibernate-drop-ins",
|
|
"type": "directory",
|
|
"path": "/etc/systemd/system/hibernate.target.d",
|
|
"mode": "0755"
|
|
},
|
|
{
|
|
"id": "hibernate-wants",
|
|
"type": "file",
|
|
"path": "/etc/systemd/system/hibernate.target.d/mesh-power.conf",
|
|
"mode": "0644",
|
|
"template": "templates/systemd/system/hibernate.target.d/mesh-power.conf"
|
|
},
|
|
{
|
|
"id": "hybrid-sleep-drop-ins",
|
|
"type": "directory",
|
|
"path": "/etc/systemd/system/hybrid-sleep.target.d",
|
|
"mode": "0755"
|
|
},
|
|
{
|
|
"id": "hybrid-sleep-wants",
|
|
"type": "file",
|
|
"path": "/etc/systemd/system/hybrid-sleep.target.d/mesh-power.conf",
|
|
"mode": "0644",
|
|
"template": "templates/systemd/system/hybrid-sleep.target.d/mesh-power.conf"
|
|
},
|
|
{
|
|
"id": "suspend-then-hibernate-drop-ins",
|
|
"type": "directory",
|
|
"path": "/etc/systemd/system/suspend-then-hibernate.target.d",
|
|
"mode": "0755"
|
|
},
|
|
{
|
|
"id": "suspend-then-hibernate-wants",
|
|
"type": "file",
|
|
"path": "/etc/systemd/system/suspend-then-hibernate.target.d/mesh-power.conf",
|
|
"mode": "0644",
|
|
"template": "templates/systemd/system/suspend-then-hibernate.target.d/mesh-power.conf"
|
|
},
|
|
{
|
|
"id": "udev-rule",
|
|
"type": "file",
|
|
"path": "/etc/udev/rules.d/90-mesh-power.rules",
|
|
"mode": "0644",
|
|
"template": "templates/udev/rules.d/90-mesh-power.rules"
|
|
},
|
|
{
|
|
"id": "after-boot",
|
|
"type": "service",
|
|
"unit": "mesh-power-after-boot.service",
|
|
"state": "running",
|
|
"boot": "enabled"
|
|
},
|
|
{
|
|
"id": "before-shutdown",
|
|
"type": "service",
|
|
"unit": "mesh-power-before-shutdown.service",
|
|
"state": "running",
|
|
"boot": "enabled"
|
|
},
|
|
{
|
|
"id": "draw-dir",
|
|
"type": "directory",
|
|
"path": "/run/mesh-power",
|
|
"mode": "0755"
|
|
},
|
|
{
|
|
"id": "draw",
|
|
"type": "process",
|
|
"name": "mesh-power-draw",
|
|
"artifact": "tools-go",
|
|
"run": [
|
|
"./power",
|
|
"draw"
|
|
],
|
|
"health": {
|
|
"kind": "unit"
|
|
}
|
|
}
|
|
],
|
|
"build": {
|
|
"artifacts": [
|
|
{
|
|
"name": "tools-go",
|
|
"kind": "bundle",
|
|
"language": "go",
|
|
"system": "arch",
|
|
"from": "cmd/power",
|
|
"binary": "power",
|
|
"loads": [
|
|
"power"
|
|
]
|
|
},
|
|
{
|
|
"name": "scripts",
|
|
"kind": "archive",
|
|
"from": "files"
|
|
},
|
|
{
|
|
"name": "templates",
|
|
"kind": "archive",
|
|
"from": "templates"
|
|
}
|
|
]
|
|
},
|
|
"items": [
|
|
{
|
|
"collection": "contribution:node-bar:block",
|
|
"name": "battery",
|
|
"if-capability": "battery",
|
|
"attributes": {
|
|
"bar": "bottom",
|
|
"place": "status",
|
|
"order": "40"
|
|
},
|
|
"template": "templates/bar-battery"
|
|
},
|
|
{
|
|
"collection": "contribution:node-bar:block",
|
|
"name": "power-draw",
|
|
"if-capability": "power-meter",
|
|
"attributes": {
|
|
"bar": "bottom",
|
|
"place": "status",
|
|
"order": "45"
|
|
},
|
|
"template": "templates/bar-power-draw"
|
|
}
|
|
]
|
|
}
|