Skip to content

Commit fffa33d

Browse files
authored
fix: support ubuntu 24 (#620)
It support `install-dependencies: true` with Ubuntu 24.04. Ubuntu 24.04 has some changes on packages names to prevent the Year 2038 problem. It can break compatibilities with Ubuntu 22.04 such as reported in #618. https://discourse.ubuntu.com/t/ubuntu-24-04-lts-noble-numbat-release-notes/39890/1 Close #618
1 parent 1208fbf commit fffa33d

File tree

1 file changed

+26
-4
lines changed

1 file changed

+26
-4
lines changed

src/dependencies.ts

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,25 @@ const DEBIAN_BASED_DEPENDENT_PACKAGES = [
1919
"xdg-utils",
2020
];
2121

22+
const UBUNTU_24_DEPENDENT_PACKAGES = [
23+
"libasound2t64",
24+
"libatk-bridge2.0-0t64",
25+
"libatk1.0-0t64",
26+
"libcairo2",
27+
"libcups2t64",
28+
"libdbus-1-3",
29+
"libexpat1",
30+
"libgbm1",
31+
"libglib2.0-0t64",
32+
"libnss3",
33+
"libpango-1.0-0",
34+
"libxcomposite1",
35+
"libxdamage1",
36+
"libxfixes3",
37+
"libxkbcommon0",
38+
"libxrandr2",
39+
];
40+
2241
const FEDORA_BASED_DEPENDENT_PACKAGES = [
2342
"alsa-lib",
2443
"atk",
@@ -64,23 +83,26 @@ const installDependencies = async (
6483
}
6584

6685
const packages = await (async () => {
67-
const osReleaseId = await runtime.getOsReleaseId();
68-
switch (osReleaseId) {
86+
const { ID: id, VERSION_ID: versionId } = await runtime.loadOsRelease();
87+
switch (id) {
6988
case "rhel":
7089
case "centos":
7190
case "ol":
7291
case "fedora":
7392
return FEDORA_BASED_DEPENDENT_PACKAGES;
7493
case "debian":
75-
case "ubuntu":
7694
case "linuxmint":
7795
return DEBIAN_BASED_DEPENDENT_PACKAGES;
96+
case "ubuntu":
97+
return Number.parseInt(versionId.split(".")[0], 10) >= 24
98+
? UBUNTU_24_DEPENDENT_PACKAGES
99+
: DEBIAN_BASED_DEPENDENT_PACKAGES;
78100
case "opensuse":
79101
case "opensuse-leap":
80102
case "sles":
81103
return SUSE_BASED_DEPENDENT_PACKAGES;
82104
}
83-
throw new Error(`Unsupported OS: ${osReleaseId}`);
105+
throw new Error(`Unsupported OS: ${id}`);
84106
})();
85107
const sudo = !noSudo && process.getuid?.() !== 0;
86108

0 commit comments

Comments
 (0)