diff --git a/src/docker/install.ts b/src/docker/install.ts index 0e274d22..9a4fe0ef 100644 --- a/src/docker/install.ts +++ b/src/docker/install.ts @@ -93,7 +93,7 @@ export class Install { return this._toolDir || Context.tmpDir(); } - async downloadStaticArchive(component: 'docker' | 'docker-rootless-extras', src: InstallSourceArchive, extractFolder?: string): Promise { + async downloadStaticArchive(component: 'docker' | 'docker-rootless-extras', src: InstallSourceArchive): Promise { const release: GitHubRelease = await Install.getRelease(src.version); this._version = release.tag_name.replace(/^v+|v+$/g, ''); core.debug(`docker.Install.download version: ${this._version}`); @@ -104,15 +104,16 @@ export class Install { const downloadPath = await tc.downloadTool(downloadURL); core.debug(`docker.Install.download downloadPath: ${downloadPath}`); + let extractFolder; if (os.platform() == 'win32') { extractFolder = await tc.extractZip(downloadPath, extractFolder); } else { extractFolder = await tc.extractTar(downloadPath, extractFolder); } - if (Util.isDirectory(path.join(extractFolder, 'docker'))) { - extractFolder = path.join(extractFolder, 'docker'); + if (Util.isDirectory(path.join(extractFolder, component))) { + extractFolder = path.join(extractFolder, component); } - core.info(`docker.Install.download extractFolder: ${extractFolder}`); + core.debug(`docker.Install.download extractFolder: ${extractFolder}`); return extractFolder; } @@ -168,7 +169,8 @@ export class Install { extractFolder = await this.downloadStaticArchive('docker', this.source); if (this.rootless) { core.info(`Downloading Docker rootless extras ${version} from ${this.source.channel} at download.docker.com`); - extractFolder = await this.downloadStaticArchive('docker-rootless-extras', this.source, extractFolder); + const extrasFolder = await this.downloadStaticArchive('docker-rootless-extras', this.source); + fs.copyFileSync(path.join(extrasFolder, 'dockerd-rootless.sh'), extractFolder); } break; }