fix: use /usr/system.json for auto-update checks
This commit is contained in:
parent
6a0e1d7596
commit
3e725a1624
3 changed files with 13 additions and 8 deletions
|
|
@ -42,11 +42,11 @@ def update_check_daemon():
|
|||
|
||||
check_interval = 3600
|
||||
|
||||
if isinstance(get_system_config().get("auto-update"), dict):
|
||||
if not get_system_config()["auto-update"]["enabled"]:
|
||||
if isinstance(get_installed_system_config().get("auto-update"), dict):
|
||||
if not get_installed_system_config()["auto-update"]["enabled"]:
|
||||
exit()
|
||||
if isinstance(get_system_config()["auto-update"].get("interval"), int):
|
||||
check_interval = get_system_config()["auto-update"]["interval"]
|
||||
if isinstance(get_installed_system_config()["auto-update"].get("interval"), int):
|
||||
check_interval = get_installed_system_config()["auto-update"]["interval"]
|
||||
|
||||
while True:
|
||||
try:
|
||||
|
|
@ -98,8 +98,8 @@ def update_cmd(force):
|
|||
print()
|
||||
output.info("checking if already up-to-date...")
|
||||
|
||||
if (not os.path.isdir("/.update_rootfs")) or force:
|
||||
if is_already_latest() and not force:
|
||||
if force or (not os.path.isdir("/.update_rootfs")):
|
||||
if (not force) and is_already_latest():
|
||||
output.info("your system is already up-to-date")
|
||||
sys.exit(0)
|
||||
else:
|
||||
|
|
|
|||
|
|
@ -115,7 +115,7 @@ def get_system_config():
|
|||
system_config = yaml.safe_load(system_yml_file.read())
|
||||
elif os.path.exists("/system.json"):
|
||||
with open("/system.json") as system_json_file:
|
||||
system_config = yaml.safe_load(system_json_file.read())
|
||||
system_config = json.load(system_json_file)
|
||||
else:
|
||||
output.error("no system config file found")
|
||||
exit(1)
|
||||
|
|
@ -123,6 +123,11 @@ def get_system_config():
|
|||
return resolve_config(system_config)
|
||||
|
||||
|
||||
def get_installed_system_config():
|
||||
with open("/usr/system.json") as usr_system_json_file:
|
||||
return json.load(usr_system_json_file)
|
||||
|
||||
|
||||
def is_already_latest() -> bool:
|
||||
"""Checks if system is already up-to-date.
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
Description=System updates
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/bin/system update-check
|
||||
ExecStart=/usr/bin/akshara update-check
|
||||
|
||||
[Install]
|
||||
WantedBy=default.target
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue