diff --git a/pkg/rancher-desktop/assets/dependencies.yaml b/pkg/rancher-desktop/assets/dependencies.yaml index 57780d27600..d5c7e64113e 100644 --- a/pkg/rancher-desktop/assets/dependencies.yaml +++ b/pkg/rancher-desktop/assets/dependencies.yaml @@ -1,5 +1,5 @@ lima: 0.21.0.rd2 -limaAndQemu: 1.31.3 +qemu: 0.0.0.20241009 socketVMNet: 1.1.5 alpineLimaISO: isoVersion: 0.2.39.rd4 diff --git a/scripts/dependencies/lima.ts b/scripts/dependencies/lima.ts index a9f4540e20a..89a78dd3a77 100644 --- a/scripts/dependencies/lima.ts +++ b/scripts/dependencies/lima.ts @@ -12,6 +12,7 @@ import { download, downloadTarGZ, getResource } from '../lib/download'; import { DownloadContext, Dependency, AlpineLimaISOVersion, findChecksum, getOctokit, GitHubDependency, getPublishedReleaseTagNames, GitHubRelease, } from 'scripts/lib/dependencies'; +import { simpleSpawn } from 'scripts/simple_process'; /** * rcompareVersions implementation for version strings that look like 0.1.2.rd3????. @@ -140,44 +141,26 @@ export class Lima implements Dependency, GitHubDependency { } } -export class LimaAndQemu implements Dependency, GitHubDependency { - name = 'limaAndQemu'; - githubOwner = 'rancher-sandbox'; - githubRepo = 'lima-and-qemu'; +export class Qemu implements Dependency, GitHubDependency { + name = 'qemu'; + githubOwner = 'mook-as'; + githubRepo = 'qemu-packaging'; async download(context: DownloadContext): Promise { const baseUrl = `https://github.com/${ this.githubOwner }/${ this.githubRepo }/releases/download`; - let platform: string = context.platform; + const arch = process.env.M1 ? 'aarch64' : 'x86_64'; - if (platform === 'darwin') { - platform = 'macos'; - if (process.env.M1) { - platform = `macos-aarch64`; - } - } - const url = `${ baseUrl }/v${ context.versions.limaAndQemu }/lima-and-qemu.${ platform }.tar.gz`; + const url = `${ baseUrl }/v${ context.versions.qemu }/qemu-${ arch }.tar.gz`; const expectedChecksum = (await getResource(`${ url }.sha512sum`)).split(/\s+/)[0]; const limaDir = path.join(context.resourcesDir, context.platform, 'lima'); - const tarPath = path.join(context.resourcesDir, context.platform, `lima-and-qemu.v${ context.versions.limaAndQemu }.tgz`); + const tarPath = path.join(context.resourcesDir, context.platform, `qemu.v${ context.versions.qemu }.tgz`); await download(url, tarPath, { expectedChecksum, checksumAlgorithm: 'sha512', access: fs.constants.W_OK, }); await fs.promises.mkdir(limaDir, { recursive: true }); - const child = childProcess.spawn('/usr/bin/tar', - ['-xf', tarPath, '--exclude', 'lima*', '--exclude', 'vde/bin', '--exclude', 'vde/lib', '--exclude', 'socket_vmnet'], - { cwd: limaDir, stdio: 'inherit' }); - - await new Promise((resolve, reject) => { - child.on('exit', (code, signal) => { - if (code === 0) { - resolve(); - } else { - reject(new Error(`Lima-and-QEMU extract failed with ${ code || signal }`)); - } - }); - }); + await simpleSpawn('/usr/bin/tar', ['-xf', tarPath], { cwd: limaDir }); } async getAvailableVersions(): Promise { diff --git a/scripts/lib/dependencies.ts b/scripts/lib/dependencies.ts index 0af8ce08e5e..9cfff1e9da0 100644 --- a/scripts/lib/dependencies.ts +++ b/scripts/lib/dependencies.ts @@ -37,7 +37,7 @@ export type AlpineLimaISOVersion = { export type DependencyVersions = { lima: string; - limaAndQemu: string; + qemu: string; socketVMNet: string; alpineLimaISO: AlpineLimaISOVersion; WSLDistro: string; diff --git a/scripts/postinstall.ts b/scripts/postinstall.ts index 48de7f50553..0c9d0faa785 100644 --- a/scripts/postinstall.ts +++ b/scripts/postinstall.ts @@ -3,7 +3,7 @@ import os from 'os'; import path from 'path'; import * as goUtils from 'scripts/dependencies/go-source'; -import { Lima, LimaAndQemu, SocketVMNet, AlpineLimaISO } from 'scripts/dependencies/lima'; +import { Lima, Qemu, SocketVMNet, AlpineLimaISO } from 'scripts/dependencies/lima'; import { MobyOpenAPISpec } from 'scripts/dependencies/moby-openapi'; import { SudoPrompt } from 'scripts/dependencies/sudo-prompt'; import { ExtensionProxyImage, WSLDistroImage } from 'scripts/dependencies/tar-archives'; @@ -43,7 +43,7 @@ const userTouchedDependencies = [ // Dependencies that are specific to unix hosts. const unixDependencies = [ new Lima(), - new LimaAndQemu(), + new Qemu(), new AlpineLimaISO(), ]; @@ -147,7 +147,7 @@ async function downloadDependencies(items: DependencyWithContext[]): Promise !done.has(v)); - await Promise.any([timeout, ...pending.map(v => promises[v])]); + await Promise.race([timeout, ...pending.map(v => promises[v])]); } abortSignal.onabort = null;