Skip to content

Commit

Permalink
index.js: install libarchive-tools
Browse files Browse the repository at this point in the history
  • Loading branch information
Maxython committed Jan 28, 2024
1 parent 54e6280 commit 62bcf22
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,31 @@
const exec = require('@actions/exec');
const core = require('@actions/core')

async function start() {
await exec.exec("sudo su -c \"echo 'deb http://archive.ubuntu.com/ubuntu/ lunar universe' > /etc/apt/sources.list.d/lunar.list\"");
await exec.exec("sudo su -c \"echo 'deb-src http://archive.ubuntu.com/ubuntu/ lunar universe' >> /etc/apt/sources.list.d/lunar.list\"");

async function installPkg(pkgname) {
let attempts = 0;

while (true) {
try {
await exec.exec("sudo apt update -y");
await exec.exec("sudo apt install pacman-package-manager -y");
await exec.exec("sudo apt install " + pkgname + " -y");
break;
} catch (error) {
if (attempts > 2) {
if (attempts > 3) {
core.setFailed("Something went wrong :/");
process.exit(1);
}
attempts += 1;
continue;
}
}
}

async function start() {
await installPkg("libarchive-tools2");

await exec.exec("sudo su -c \"echo 'deb http://archive.ubuntu.com/ubuntu/ lunar universe' > /etc/apt/sources.list.d/lunar.list\"");
await exec.exec("sudo su -c \"echo 'deb-src http://archive.ubuntu.com/ubuntu/ lunar universe' >> /etc/apt/sources.list.d/lunar.list\"");

await installPkg("pacman-package-manager");
}

start();

0 comments on commit 62bcf22

Please sign in to comment.