diff --git a/usr/lib/akshara/akshara b/usr/lib/akshara/akshara index 22bbc57..5846163 100755 --- a/usr/lib/akshara/akshara +++ b/usr/lib/akshara/akshara @@ -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: diff --git a/usr/lib/akshara/utils/helpers.py b/usr/lib/akshara/utils/helpers.py index 9650005..7a249b2 100644 --- a/usr/lib/akshara/utils/helpers.py +++ b/usr/lib/akshara/utils/helpers.py @@ -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. diff --git a/usr/lib/systemd/user/akshara-update-check.service b/usr/lib/systemd/user/akshara-update-check.service index b48496c..783613e 100644 --- a/usr/lib/systemd/user/akshara-update-check.service +++ b/usr/lib/systemd/user/akshara-update-check.service @@ -2,7 +2,7 @@ Description=System updates [Service] -ExecStart=/usr/bin/system update-check +ExecStart=/usr/bin/akshara update-check [Install] WantedBy=default.target