Skip to content

Commit 5aa7099

Browse files
committed
fix: update before checking args when requested
1 parent a9d7008 commit 5aa7099

File tree

7 files changed

+18
-18
lines changed

7 files changed

+18
-18
lines changed

dist/actions/setup-cpp.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/actions/setup-cpp.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/legacy/setup-cpp.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/legacy/setup-cpp.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/modern/setup-cpp.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/modern/setup-cpp.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/utils/setup/setupAptPack.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,12 @@ export async function setupAptPack(packages: AptPackage[], update = false): Prom
3535

3636
process.env.DEBIAN_FRONTEND = "noninteractive"
3737

38+
// Update the repos if needed
39+
if (update) {
40+
updateRepos(apt)
41+
didUpdate = true
42+
}
43+
3844
// Add the repos if needed
3945
await addRepositories(apt, packages)
4046

@@ -49,12 +55,6 @@ export async function setupAptPack(packages: AptPackage[], update = false): Prom
4955
return { binDir: "/usr/bin/" }
5056
}
5157

52-
// Update the repos if needed
53-
if (!didUpdate || update) {
54-
updateRepos(apt)
55-
didUpdate = true
56-
}
57-
5858
// Initialize apt if needed
5959
if (!didInit) {
6060
await initApt(apt)
@@ -181,7 +181,7 @@ async function installAddAptRepo() {
181181
if (await isPackageInstalled("software-properties-common")) {
182182
return
183183
}
184-
execRootSync("apt-get", ["install", "-y", "software-properties-common"])
184+
execRootSync("apt-get", ["install", "-y", "--fix-broken", "software-properties-common"])
185185
}
186186

187187
/** Install gnupg and certificates (usually missing from docker containers) */
@@ -192,12 +192,12 @@ async function initApt(apt: string) {
192192
didUpdate = true
193193
}
194194

195-
if (!(await isPackageInstalled("ca-certificates"))) {
196-
execRootSync(apt, ["install", "--fix-broken", "-y", "ca-certificates"])
197-
}
198-
if (!(await isPackageInstalled("gnupg"))) {
199-
execRootSync(apt, ["install", "--fix-broken", "-y", "gnupg"])
195+
const toInstall = ["ca-certificates", "gnupg", "apt-utils"].filter(async (pack) => !(await isPackageInstalled(pack)))
196+
197+
if (toInstall.length !== 0) {
198+
execRootSync(apt, ["install", "-y", "--fix-broken", ...toInstall])
200199
}
200+
201201
const promises: Promise<string | void>[] = [
202202
addAptKeyViaServer(["3B4FE6ACC0B21F32", "40976EAF437D05B5"], "setup-cpp-ubuntu-archive.gpg"),
203203
addAptKeyViaServer(["1E9377A2BA9EF27F"], "launchpad-toolchain.gpg"),

0 commit comments

Comments
 (0)