-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
49 lines (41 loc) · 1.2 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// Running a script that sets everything up
const exec = require('@actions/exec');
const core = require('@actions/core');
function error(message) {
core.setFailed(message);
process.exit(1);
}
async function installPkg(pkgname) {
let attempts = 0;
while (true) {
try {
await exec.exec("sudo apt update -y");
await exec.exec("sudo apt install " + pkgname + " -y");
break;
} catch (error) {
if (attempts > 3) {
error("Something went wrong :/");
}
attempts += 1;
continue;
}
}
}
async function start() {
let myOutput = '';
await exec.exec("grep", ["^DISTRIB_RELEASE=", "/etc/lsb-release"], {
listeners: {
stdout: (data) => {
myOutput += data.toString();
}
}
});
if (myOutput.split("=").at(-1).split(".").at(0) != "24") {
error("old version of ubuntu, must be version 24 of ubuntu");
}
await installPkg("libarchive-tools");
await exec.exec("sudo su -c \"echo 'deb http://archive.ubuntu.com/ubuntu/ oracular universe' > /etc/apt/sources.list.d/oracular.list\"");
await exec.exec("sudo su -c \"echo 'deb-src http://archive.ubuntu.com/ubuntu/ oracular universe' >> /etc/apt/sources.list.d/oracular.list\"");
await installPkg("pacman-package-manager");
}
start();