Verified Commit 3bc6a0c2 authored by Karel Koci's avatar Karel Koci 🤘 Committed by Karel Koci
Browse files

supervisor: rename userlists to pkglists

This is much more appropriate name and this way we are able to integrate
all Turris specific configuration to same section called turris.
parent 0489976e
...@@ -44,8 +44,8 @@ NOTIFY_MESSAGE_EN = "Your approval is required to apply pending updates." + \ ...@@ -44,8 +44,8 @@ NOTIFY_MESSAGE_EN = "Your approval is required to apply pending updates." + \
# File containing l10n symbols as a list of supported ones # File containing l10n symbols as a list of supported ones
L10N_FILE = "/usr/share/updater/l10n_supported" L10N_FILE = "/usr/share/updater/l10n_supported"
# File containing list of known userlists in json # File containing list of known pkglists in json
USERLISTS_FILE = "/usr/share/updater/definitions.json" PKGLISTS_FILE = "/usr/share/updater/pkglists.json"
# Hooks file containing commands to be run after updater execution finished. # Hooks file containing commands to be run after updater execution finished.
POSTRUN_HOOK_FILE = "/tmp/updater-postrun-hook" POSTRUN_HOOK_FILE = "/tmp/updater-postrun-hook"
...@@ -60,7 +60,7 @@ def __run_command(command): ...@@ -60,7 +60,7 @@ def __run_command(command):
def register(command): def register(command):
"""Add given command (format is expected to be same as if you call """Add given command (format is expected to be same as if you call
subprocess.run) to be executed when updater exits. Note that this hook is subprocess.run) to be executed when updater exits. Note that this hook is
executed no matter if updater passer or failed or even if it just requested executed no matter if updater passed or failed or even if it just requested
user's approval. In all of those cases when updater exits this hook is user's approval. In all of those cases when updater exits this hook is
executed. executed.
......
...@@ -30,25 +30,25 @@ from .const import USERLISTS_FILE ...@@ -30,25 +30,25 @@ from .const import USERLISTS_FILE
from .exceptions import ExceptionUpdaterNoSuchList from .exceptions import ExceptionUpdaterNoSuchList
def userlists(lang=None): def pkglists(lang=None):
"""Returns dict of userlists. """Returns dict of pkglists.
Argument lang is expected to be a string containing language code. This Argument lang is expected to be a string containing language code. This
code is then used for gettext translations of titles and descriptions of code is then used for gettext translations of titles and descriptions of
messages. messages.
Return userlists are in dictionary where key is name of userlist and value Return pkglists are in dictionary where key is name of pkglist and value is
is another dictionary with following content: another dictionary with following content:
"enabled": This is boolean value containing info if userlist is enabled. "enabled": This is boolean value containing info if pkglist is enabled.
"hidden": This is boolean value specifying if userlist is user visible. "hidden": This is boolean value specifying if pkglist is pkg visible.
"title": This is title text describing userlist (human readable name). This "title": This is title text describing pkglist (human readable name). This
field can be None if "hidden" field is set to True. field can be None if "hidden" field is set to True.
"message": This is human readable description of given userlist. This can "message": This is human readable description of given pkglist. This can be
be None if "hidden" is set to True. None if "hidden" is set to True.
""" """
result = dict() result = dict()
trans = gettext.translation( trans = gettext.translation(
'userlists', 'pkglists',
languages=[lang] if lang is not None else None, languages=[lang] if lang is not None else None,
fallback=True) fallback=True)
...@@ -78,7 +78,7 @@ def userlists(lang=None): ...@@ -78,7 +78,7 @@ def userlists(lang=None):
return result return result
def update_userlists(lists): def update_pkglists(lists):
""" """
List is expected to be a array of strings (list ids) that should be List is expected to be a array of strings (list ids) that should be
enabled. Anything omitted will be disabled. enabled. Anything omitted will be disabled.
...@@ -98,3 +98,13 @@ def update_userlists(lists): ...@@ -98,3 +98,13 @@ def update_userlists(lists):
with Uci() as uci: with Uci() as uci:
uci.set('updater', 'turris', 'turris') uci.set('updater', 'turris', 'turris')
uci.set('updater', 'turris', 'pkglists', tuple(lists)) uci.set('updater', 'turris', 'pkglists', tuple(lists))
def userlists(lang=None):
"""Backward compatibility API. Please use pkglists instead."""
return pkglists(lang)
def update_userlists(lists):
"""Backward compatibility API. Please use update_pkglists instead."""
update_pkglists(lists)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment