mirror of https://github.com/aminya/setup-cpp
fix: fix the powershell installation on Ubuntu
This commit is contained in:
parent
b8aa27fad9
commit
af7abb173a
|
@ -1,5 +1,5 @@
|
||||||
import { addPath } from "../utils/env/addEnv"
|
import { addPath } from "../utils/env/addEnv"
|
||||||
import { addAptKeyViaDownload, setupAptPack } from "../utils/setup/setupAptPack"
|
import { setupAptPack } from "../utils/setup/setupAptPack"
|
||||||
import { setupPacmanPack } from "../utils/setup/setupPacmanPack"
|
import { setupPacmanPack } from "../utils/setup/setupPacmanPack"
|
||||||
import { setupBrewPack } from "../utils/setup/setupBrewPack"
|
import { setupBrewPack } from "../utils/setup/setupBrewPack"
|
||||||
import { setupChocoPack } from "../utils/setup/setupChocoPack"
|
import { setupChocoPack } from "../utils/setup/setupChocoPack"
|
||||||
|
@ -8,6 +8,7 @@ import { hasDnf } from "../utils/env/hasDnf"
|
||||||
import { setupDnfPack } from "../utils/setup/setupDnfPack"
|
import { setupDnfPack } from "../utils/setup/setupDnfPack"
|
||||||
import { isUbuntu } from "../utils/env/isUbuntu"
|
import { isUbuntu } from "../utils/env/isUbuntu"
|
||||||
import { execRootSync } from "root-tools"
|
import { execRootSync } from "root-tools"
|
||||||
|
import { ubuntuVersion } from "../utils/env/ubuntu_version"
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
export async function setupPowershell(version: string | undefined, _setupDir: string, _arch: string) {
|
export async function setupPowershell(version: string | undefined, _setupDir: string, _arch: string) {
|
||||||
|
@ -32,14 +33,26 @@ export async function setupPowershell(version: string | undefined, _setupDir: st
|
||||||
])
|
])
|
||||||
return setupDnfPack("powershell", version)
|
return setupDnfPack("powershell", version)
|
||||||
} else if (isUbuntu()) {
|
} else if (isUbuntu()) {
|
||||||
const keyFileName = await addAptKeyViaDownload(
|
await setupAptPack("curl")
|
||||||
"microsoft.asc",
|
const ubuntuVerSplitted = (await ubuntuVersion())!
|
||||||
"https://packages.microsoft.com/keys/microsoft.asc"
|
const ubuntuVersionString = `${ubuntuVerSplitted[0]}.${ubuntuVerSplitted[1]}`
|
||||||
)
|
|
||||||
execRootSync("/bin/bash", [
|
execRootSync("/bin/bash", [
|
||||||
"-c",
|
"-c",
|
||||||
`echo "deb [arch=amd64 signed-by=${keyFileName}] https://packages.microsoft.com/repos/microsoft-debian-bullseye-prod bullseye main" > /etc/apt/sources.list.d/microsoft.list`,
|
`curl -LJO "https://packages.microsoft.com/config/ubuntu/${ubuntuVersionString}/packages-microsoft-prod.deb"`,
|
||||||
])
|
])
|
||||||
|
execRootSync("dpkg", ["-i", "packages-microsoft-prod.deb"])
|
||||||
|
|
||||||
|
// TODO Debian
|
||||||
|
// const keyFileName = await addAptKeyViaDownload(
|
||||||
|
// "microsoft.asc",
|
||||||
|
// "https://packages.microsoft.com/keys/microsoft.asc"
|
||||||
|
// )
|
||||||
|
// execRootSync("/bin/bash", [
|
||||||
|
// "-c",
|
||||||
|
// `echo "deb [arch=amd64 signed-by=${keyFileName}] https://packages.microsoft.com/repos/microsoft-debian-bullseye-prod bullseye main" > /etc/apt/sources.list.d/microsoft.list`,
|
||||||
|
// ])
|
||||||
|
|
||||||
return setupAptPack("powershell", version, [], true)
|
return setupAptPack("powershell", version, [], true)
|
||||||
}
|
}
|
||||||
throw new Error(`Unsupported linux distribution`)
|
throw new Error(`Unsupported linux distribution`)
|
||||||
|
|
Loading…
Reference in New Issue