Add built-in updater, bump to 1.2.0
- predatord checks the Gitea releases every 6 hours, downloads the newest pacman package, verifies its SHA-256 from the release notes and installs it with `pacman -U` in a separate systemd unit - Update notice and install button on the System page, in the sidebar and in the panel widget; `predatorctl update [--check] [--yes]` - Optional API token for private repositories - packaging/release.py builds and publishes releases in the format the updater expects Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -61,6 +61,10 @@ def main(argv=None):
|
||||
sp = sub.add_parser("battery-limit", help="80 %% charge limit")
|
||||
sp.add_argument("value", choices=["on", "off"])
|
||||
|
||||
sp = sub.add_parser("update", help="check for and install updates")
|
||||
sp.add_argument("--check", action="store_true", help="only check, do not install")
|
||||
sp.add_argument("--yes", "-y", action="store_true", help="install without asking")
|
||||
|
||||
sp = sub.add_parser("open", help="open the main window")
|
||||
sp.add_argument("page", nargs="?", default="home")
|
||||
|
||||
@@ -139,6 +143,21 @@ def main(argv=None):
|
||||
if a.sync:
|
||||
args["sync_keyboard"] = a.sync == "on"
|
||||
c.call("set_lightbar", **args)
|
||||
elif a.cmd == "update":
|
||||
u = c.call("check_update")
|
||||
if not u["available"]:
|
||||
print("Predator Control %s is up to date." % u["current"])
|
||||
return 0
|
||||
print("Update available: %s -> %s\n%s" % (u["current"], u["latest"], u["url"]))
|
||||
if a.check:
|
||||
return 0
|
||||
if not u["can_install"]:
|
||||
print("Automatic install needs the pacman package. Update with: git pull && sudo ./install.sh")
|
||||
return 1
|
||||
if not a.yes and sys.stdin.isatty() and input("Install now? [Y/n] ").strip().lower() not in ("", "y", "yes"):
|
||||
return 0
|
||||
c.call("install_update")
|
||||
print("Installing %s in the background (journalctl -fu predator-control-update)." % u["asset"])
|
||||
elif a.cmd == "battery-limit":
|
||||
c.call("set_battery_limit", enabled=_bool(a.value))
|
||||
except DaemonError as e:
|
||||
|
||||
Reference in New Issue
Block a user