jpillora / installer

One-liner for installing binaries from Github releases
https://i.jpillora.com/installer
MIT License
214 stars 53 forks source link

feat: support multiple binaries from one link #40

Open cxjava opened 1 year ago

cxjava commented 1 year ago

Such as https://github.com/xtaci/kcptun, in this kcptun-linux-amd64-20231012.tar.gz release

Contains two binaries: server_darwin_amd64, client_darwin_amd64,

What I expected is : when I run this repository script, I can install those two binaries into the folder /usr/local/bin/.

jpillora commented 1 year ago

Ah interesting use case, doable, though it breaks a few assumptions. Like the as param, e.g. install ripgrep as rg - two/more binaries wouldn't work here. important here, because with your example, you might want them to be called kcptun-server and kcptun-client - that might be too hard to automatically do though...

Currently the logic treats the largest file (over 1MB) in the archive as the binary

If there's 2, and the tar has 100 files, how do you find the binaries? largest 2? all files over 1MB? do you use the file mode, anything thats marked executable? some people do chmod 777 everything

cxjava commented 1 year ago

Thank you for the response! Maybe this requirement is not so urgent.

onedr0p commented 10 months ago

I also have a use-case for this with https://github.com/siderolabs/talos/releases/tag/v1.6.2. I would like to only grab the talosctl artifact from these releases. Right now it only pulls talos which is not what I want.

Maybe there can be a filter arg like ?filter=talosctl&as=tctl that wrap a glob around it ?

Edit: this is not the same as what OP mentioned. I will open a new issue.

cxjava commented 1 month ago

I've implemented a Cloudflare Worker version that meets my requirements.

If you're interested, feel free to give it a try.

https://github.com/cxjava/installer

# mp means multi program
# mp fuzzy matching: client_linux_amd64, you can just input client
curl https://your-workers-domain.workers.dev/xtaci/kcptun!?mp=client,server | bash
mv /usr/local/bin/client /usr/local/bin/kcptun_client
mv /usr/local/bin/server /usr/local/bin/kcptun_server
/usr/local/bin/kcptun_client -v
/usr/local/bin/kcptun_server -v