chore: update cube

This commit is contained in:
Guillaume ARM 2022-07-19 00:27:20 +02:00
parent 0ee1f9a360
commit eb1aa49212
2 changed files with 15 additions and 8 deletions

View File

@ -10,6 +10,7 @@ local IGNORED_PATHS = {
['/.cubeboot'] = true, ['/.cubeboot'] = true,
['/.git'] = true, ['/.git'] = true,
['/.gitignore'] = true, ['/.gitignore'] = true,
['/startup.lua'] = true,
} }
local function isValidPath(givenPath) local function isValidPath(givenPath)
@ -149,7 +150,7 @@ end
------------ ------------
-- reboot -- -- reboot --
------------ ------------
local function rebootCommand(machineId) local function rebootCommand(machineId, silentReboot)
if not machineId or machineId == '' then if not machineId or machineId == '' then
printUsageCommand('reboot'); printUsageCommand('reboot');
return; return;
@ -164,8 +165,10 @@ local function rebootCommand(machineId)
for k in ipairs(results) do for k in ipairs(results) do
local packet = packets[k]; local packet = packets[k];
if not silentReboot == true then
print('reboot machine \'' .. tostring(packet.sourceId) .. '\''); print('reboot machine \'' .. tostring(packet.sourceId) .. '\'');
end end
end
end end
-------------- --------------
@ -192,7 +195,12 @@ local function setBootCommand(machineId, shellCommand)
print('boot UPDATED'); print('boot UPDATED');
end end
rebootCommand(packet.sourceId); rebootCommand(packet.sourceId, true);
-- prevent CraftOS-PC crashes
if periphemu then
os.sleep(0.5)
end
end end
end end
@ -240,9 +248,9 @@ local function deployCommand()
end end
end end
print('|> ' .. tostring(fileTransfered) .. ' file(s) transfered on machine ' .. tostring(machineId)) print(tostring(fileTransfered) .. ' file(s) transfered on machine ' .. tostring(machineId))
rebootCommand(machineId); rebootCommand(machineId, true);
-- prevent CraftOS-PC crashes -- prevent CraftOS-PC crashes
if periphemu then if periphemu then

View File

@ -49,9 +49,8 @@ end)
net.listenRequest(CUBE_CHANNEL, "reboot", function(_, reply) net.listenRequest(CUBE_CHANNEL, "reboot", function(_, reply)
reply(true); reply(true);
net.events.setTimeout(function() os.sleep(0.2)
os.reboot(); os.reboot()
end, 0.1);
end) end)
-- set-boot event -- set-boot event