Skip to content

Commit

Permalink
copy dockerd-rootless.sh
Browse files Browse the repository at this point in the history
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
  • Loading branch information
vvoland committed Nov 6, 2024
1 parent 62e55fb commit b1a64ac
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/docker/install.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export class Install {
return this._toolDir || Context.tmpDir();
}

async downloadStaticArchive(component: 'docker' | 'docker-rootless-extras', src: InstallSourceArchive, extractFolder?: string): Promise<string> {
async downloadStaticArchive(component: 'docker' | 'docker-rootless-extras', src: InstallSourceArchive): Promise<string> {
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}`);
Expand All @@ -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;
}

Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit b1a64ac

Please sign in to comment.