From 7f92286fb1e3947edb65c5578852a80bd79adeb7 Mon Sep 17 00:00:00 2001 From: "kepler155c@gmail.com" Date: Fri, 1 May 2020 23:09:46 -0600 Subject: [PATCH] more work on update notification --- sys/autorun/version.lua | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/sys/autorun/version.lua b/sys/autorun/version.lua index ef3d5a6..7c5e5b2 100644 --- a/sys/autorun/version.lua +++ b/sys/autorun/version.lua @@ -12,23 +12,22 @@ if fs.exists('.opus_version') then f.close() date = type(date) == 'string' and Util.split(date)[1] + local today = os.date('%j') + local config = Config.load('version', { + packages = date, + checked = today, + }) + + -- check if packages need an update + if date ~= config.packages then + config.packages = date + Config.update('version', config) + print('Updating packages') + shell.run('package updateall') + os.reboot() + end + if type(date) == 'string' and #date > 0 then - local today = os.date('%j') - local config = Config.load('version', { - opus = date, - packages = date, - checked = today, - }) - - -- check if packages need an update - if config.opus ~= config.packages then - config.packages = config.opus - Config.update('version', config) - print('Updating packages') - shell.run('package updateall') - os.reboot() - end - if config.checked ~= today then config.checked = today Config.update('version', config) @@ -38,7 +37,7 @@ if fs.exists('.opus_version') then if c then local lines = Util.split(c) local revdate = table.remove(lines, 1) - if config.opus ~= revdate and config.skip ~= revdate then + if date ~= revdate and config.skip ~= revdate then config.current = revdate config.details = table.concat(lines, '\n') Config.update('version', config)