mirror of
https://github.com/kepler155c/opus
synced 2025-01-16 02:15:42 +00:00
more work on update notification
This commit is contained in:
parent
4a46d67304
commit
7f92286fb1
@ -12,23 +12,22 @@ if fs.exists('.opus_version') then
|
|||||||
f.close()
|
f.close()
|
||||||
date = type(date) == 'string' and Util.split(date)[1]
|
date = type(date) == 'string' and Util.split(date)[1]
|
||||||
|
|
||||||
if type(date) == 'string' and #date > 0 then
|
|
||||||
local today = os.date('%j')
|
local today = os.date('%j')
|
||||||
local config = Config.load('version', {
|
local config = Config.load('version', {
|
||||||
opus = date,
|
|
||||||
packages = date,
|
packages = date,
|
||||||
checked = today,
|
checked = today,
|
||||||
})
|
})
|
||||||
|
|
||||||
-- check if packages need an update
|
-- check if packages need an update
|
||||||
if config.opus ~= config.packages then
|
if date ~= config.packages then
|
||||||
config.packages = config.opus
|
config.packages = date
|
||||||
Config.update('version', config)
|
Config.update('version', config)
|
||||||
print('Updating packages')
|
print('Updating packages')
|
||||||
shell.run('package updateall')
|
shell.run('package updateall')
|
||||||
os.reboot()
|
os.reboot()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if type(date) == 'string' and #date > 0 then
|
||||||
if config.checked ~= today then
|
if config.checked ~= today then
|
||||||
config.checked = today
|
config.checked = today
|
||||||
Config.update('version', config)
|
Config.update('version', config)
|
||||||
@ -38,7 +37,7 @@ if fs.exists('.opus_version') then
|
|||||||
if c then
|
if c then
|
||||||
local lines = Util.split(c)
|
local lines = Util.split(c)
|
||||||
local revdate = table.remove(lines, 1)
|
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.current = revdate
|
||||||
config.details = table.concat(lines, '\n')
|
config.details = table.concat(lines, '\n')
|
||||||
Config.update('version', config)
|
Config.update('version', config)
|
||||||
|
Loading…
Reference in New Issue
Block a user