From 7dbad0e44ab1930f5714a8b5188688562a298170 Mon Sep 17 00:00:00 2001 From: Samuli Piippo Date: Mon, 27 Mar 2023 08:26:24 +0000 Subject: qbsp: try to find docker Try few extra paths were docker might be in case those are not set in PATH. Change-Id: I5a27c2c4829e1caf8e860032555493866f1eba8f Reviewed-by: Mikko Gronoff (cherry picked from commit 349cea8182f9eedc7015612996c172fb5dc44d88) Reviewed-by: Qt Cherry-pick Bot --- meta-boot2qt/files/qbsp/toolchain_installscript.qs | 24 +++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/meta-boot2qt/files/qbsp/toolchain_installscript.qs b/meta-boot2qt/files/qbsp/toolchain_installscript.qs index 0e8d4618..69b357ae 100644 --- a/meta-boot2qt/files/qbsp/toolchain_installscript.qs +++ b/meta-boot2qt/files/qbsp/toolchain_installscript.qs @@ -52,6 +52,7 @@ Component.prototype.createOperations = function() container = true; var path = installer.value("TargetDir") + installPath; + var docker; if (!container) { if (systemInfo.kernelType !== "winnt") { var script = path + "/" + sdkFile; @@ -62,6 +63,23 @@ Component.prototype.createOperations = function() path = path.replace(/\\/g, "/"); } } else { + var dockerPaths = []; + if (systemInfo.kernelType == "winnt") + dockerPaths.push("C:/Program Files/Docker/Docker/resources/bin/docker"); + else if (systemInfo.kernelType == "darwin") + dockerPaths.push( + "/usr/local/bin/docker", + "/Applications/Docker.app/Contents/Resources/bin/docker", + "/opt/homebrew/bin/docker"); + dockerPaths.push("docker"); + for (i in dockerPaths) { + docker = dockerPaths[i]; + var ret = installer.execute(docker, ["--version"]); + if (ret.length != 0) { + break; + } + } + component.addOperation("AppendFile", path + "/Dockerfile", "\ FROM --platform=linux/@DOCKER_ARCH@ ubuntu:22.04\n\ @@ -71,15 +89,15 @@ COPY *.sh /\n\ RUN sh *.sh -d /opt/toolchain -y && rm *.sh\n"); component.addOperation("Execute", [ - "docker", + docker, "build", path, "-t", imageTag, - "errormessage=Installer was unable to run docker. " + + "errormessage=Installer was unable to run docker.\n" + "Make sure Docker is installed and running before continuing.\n\n" + "The toolchain Docker container can also be created manually by running command:\n" + "docker build " + path + " -t " + imageTag, "UNDOEXECUTE", - "docker", "image", "rm", "-f", imageTag]); + docker, "image", "rm", "-f", imageTag]); path = "/opt/toolchain"; dockerPrefix = "docker://" + imageTag; } -- cgit v1.2.3