From 178a4de228e647daf7cd2e33212049eb8589dafc Mon Sep 17 00:00:00 2001 From: Max Howell Date: Wed, 8 Jan 2025 11:56:35 -0500 Subject: [PATCH] Install pkgm alongside pkgx MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Not a complete implementation since we need to check if there’s a newer pkgm separate to pkgx. * Default action to install pkgx^1 by default since we need a major version bump to switch to ^2 --- action.ts | 2 +- action.yml | 4 ++-- installer.sh | 6 +++++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/action.ts b/action.ts index 454ffb3b..ed5a6de1 100644 --- a/action.ts +++ b/action.ts @@ -45,7 +45,7 @@ async function go() { data: prefix.join(".data"), cache: prefix.join(".cache"), pantries: [], - UserAgent: 'pkgx.setup/0.1.0', //TODO version + UserAgent: 'pkgx.setup/0.2.0', //TODO version options: { compression: 'gz' } }) const { map, flatten } = useShellEnv() diff --git a/action.yml b/action.yml index 246613d2..05306f86 100644 --- a/action.yml +++ b/action.yml @@ -18,8 +18,8 @@ inputs: version: description: > The version of `pkgx` to install. - Defaults to the @latest. - required: false + Defaults to ^1. + required: ^1 runs: using: node20 main: dist/out/index.js diff --git a/installer.sh b/installer.sh index ec2a51a6..8f563301 100755 --- a/installer.sh +++ b/installer.sh @@ -56,7 +56,7 @@ _install_pkgx() { progress="--progress-bar" fi - tmpdir=$(mktemp -d) + tmpdir="$(mktemp -d)" if [ $# -eq 0 ]; then if [ -f /usr/local/bin/pkgx ]; then @@ -69,10 +69,14 @@ _install_pkgx() { pipe="$tmpdir/pipe" mkfifo "$pipe" + curl --silent --fail --proto '=https' -o "$tmpdir/pkgm" \ + https://pkgxdev.github.io/pkgm/pkgm.ts + curl $progress --fail --proto '=https' "https://pkgx.sh/$(uname)/$(uname -m)".tgz > "$pipe" & $SUDO sh -c " mkdir -p /usr/local/bin tar xz --directory /usr/local/bin < '$pipe' + install -m 755 "$tmpdir/pkgm" /usr/local/bin " & wait