Skip to content
This repository has been archived by the owner on Sep 19, 2020. It is now read-only.

Commit

Permalink
Fixed Update bug
Browse files Browse the repository at this point in the history
  • Loading branch information
oeed committed Jul 18, 2014
1 parent b73e19a commit 96c4799
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 13 deletions.
7 changes: 4 additions & 3 deletions System/API/Environment.lua
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,10 @@ OneOS = function(env, program, path)
Helpers = Helpers,
Settings = Settings,
Version = version,
Restart = Restart,
Reboot = Restart,
Shutdown = Shutdown,
Restart = function(f)Restart(f, false)end,
Reboot = function(f)Restart(f, false)end,
Shutdown = function(f)Shutdown(f, false, true)end,
KillSystem = function()os.reboot()end,
Clipboard = Clipboard,
FS = fs,
OSRun = os.run,
Expand Down
5 changes: 3 additions & 2 deletions System/Programs/Update OneOS.program/startup
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ function UpdaterRefresh()
if program:GetObject('ProgressBar').Value == program:GetObject('ProgressBar').Maximum and program:GetObject('ProgressBar').Value ~= 0 then
program:GetObject('UpdateLabel').Text = 'Download Complete!'
program:GetObject('StatusLabel').Text = 'Your computer will restart in 3 seconds...'
sleep(3)
OneOS.Restart(true)
elseif program:GetObject('ProgressBar').Value ~= 0 then
program:GetObject('UpdateLabel').Text = 'Downloading Files...'
program:GetObject('StatusLabel').Text = FormatBytes(totalBytes - downloadedBytes) .. ' ('..totalFiles - downloadedFiles..' files) Remaining...'
Expand Down Expand Up @@ -151,6 +149,9 @@ function StartUpdate()
local h = OneOS.FS.open('/System/.version', 'w')
h.write(latestReleaseTag)
h.close()
--sleep()
OneOS.Log.i('Done, rebooting now.')
OneOS.KillSystem()
end


Expand Down
19 changes: 11 additions & 8 deletions System/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ bedrock.EventHandler = function(self)
end
end

function Shutdown(force, restart)
function Shutdown(force, restart, animate)
Log.i(bedrock.View.Name)
if bedrock.View.Name == 'firstsetup' then
os.reboot()
Expand All @@ -94,7 +94,7 @@ function Shutdown(force, restart)
end

if success then
AnimateShutdown(restart)
AnimateShutdown(restart, animate)
else
Log.w('Shutdown/restart aborted')
Current.Desktop:SwitchTo()
Expand All @@ -103,18 +103,20 @@ function Shutdown(force, restart)

bedrock:DisplayAlertWindow("Programs Still Open", "You have unsaved work. Save your work and close the program or click 'Force "..shutdownLabelCaptital.."'.", {'Force '..shutdownLabelCaptital, 'Cancel'}, function(value)
if value ~= 'Cancel' then
AnimateShutdown(restart)
AnimateShutdown(restart, animate)
end
end)
end
end
local firstsetup = false
function AnimateShutdown(restart)

function AnimateShutdown(restart, animate)
Log.w('System safely stopping.')
if Settings:GetValues()['UseAnimations'] and not firstsetup then
if Settings:GetValues()['UseAnimations'] and animate then
Log.i('Animating')
Drawing.Clear(colours.white)
Drawing.DrawBuffer()
sleep(0)
Log.i('out')
local x = 0
local y = 0
local w = 0
Expand Down Expand Up @@ -143,6 +145,7 @@ function AnimateShutdown(restart)
Drawing.DrawBlankArea(x + 1, y, w, h, colours.grey)
Drawing.DrawBuffer()
sleep(0)
Log.i('Done animation')
end

term.setBackgroundColour(colours.black)
Expand All @@ -157,8 +160,8 @@ function AnimateShutdown(restart)
end
end

function Restart(force)
Shutdown(force, true)
function Restart(force, animate)
Shutdown(force, true, animate)
end

function StartDoorWireless()
Expand Down

0 comments on commit 96c4799

Please sign in to comment.