fix(installer): run postinstall before servers
This commit is contained in:
parent
196152921b
commit
fd36bded49
@ -1,4 +1,4 @@
|
||||
local _VERSION = '6.0.0';
|
||||
local _VERSION = '6.0.1';
|
||||
|
||||
local REPO_BASE = 'https://git.trapcloud.fr/guillaumearm/cc-libs/raw/branch/master/';
|
||||
local LOCAL_STATE_DIR = '/trapos';
|
||||
@ -224,11 +224,10 @@ end
|
||||
-- Full install: sync the registry and install the TrapOS meta-package.
|
||||
shell.execute('ccpm', 'update');
|
||||
shell.execute('ccpm', 'install', 'trapos');
|
||||
shell.execute('trapos-postinstall');
|
||||
|
||||
if fs.exists('/startup/servers.lua') then
|
||||
shell.execute('/startup/servers.lua');
|
||||
end
|
||||
|
||||
shell.execute('trapos-postinstall');
|
||||
|
||||
shell.setDir(previousDir);
|
||||
|
||||
@ -119,6 +119,17 @@ local function findExecute(calls, program, firstArg)
|
||||
return false;
|
||||
end
|
||||
|
||||
local function findExecuteIndex(calls, program, firstArg)
|
||||
for i, call in ipairs(calls.executes) do
|
||||
if call.program == program then
|
||||
if firstArg == nil or call.args[1] == firstArg then
|
||||
return i;
|
||||
end
|
||||
end
|
||||
end
|
||||
return nil;
|
||||
end
|
||||
|
||||
testlib.test('programs path resolves the ccpm command', function()
|
||||
local previous = shell.path();
|
||||
shell.setPath('/rom/programs:/programs');
|
||||
@ -150,6 +161,18 @@ testlib.test('default install runs update, install trapos and postinstall', func
|
||||
testlib.assertTrue(findExecute(calls, 'trapos-postinstall'));
|
||||
end);
|
||||
|
||||
testlib.test('default install runs postinstall before startup servers', function()
|
||||
local root = '/install-trapos-test/order';
|
||||
local calls = runInstall(root, {});
|
||||
local postinstallIndex = findExecuteIndex(calls, 'trapos-postinstall');
|
||||
local startupIndex = findExecuteIndex(calls, '/startup/servers.lua');
|
||||
|
||||
testlib.assertTrue(postinstallIndex ~= nil, 'postinstall was not run');
|
||||
if startupIndex ~= nil then
|
||||
testlib.assertTrue(postinstallIndex < startupIndex, 'postinstall must run before startup servers');
|
||||
end
|
||||
end);
|
||||
|
||||
testlib.test('--cpm-only stops after the ccpm bootstrap', function()
|
||||
local root = '/install-trapos-test/cpm-only';
|
||||
local calls = runInstall(root, { '--cpm-only' });
|
||||
|
||||
Loading…
Reference in New Issue
Block a user