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 5624046
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
name: Example
steps:
- uses: actions/checkout@v4
- uses: termux-pacman/pacman-tool-repo@v2
- uses: termux-pacman/pacman-tool-repo@v2.1
- run: |
repo-add --help
repo-remove --help
Expand Down
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-tools");

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 5624046

Please sign in to comment.