Hackfetch Installs Itself Anywhere
Hackfetch crossed another milestone today: you no longer need Go installed to use it. Or Homebrew. Or anything, really.
The goal was simple: one command, any Linux, any Mac, no prerequisites.
curl -fsSL https://raw.githubusercontent.com/xerneas3318/hackfetch/main/install.sh | sh
Run that on Ubuntu, Fedora, Alpine, Arch, openSUSE, whatever you have, and a few seconds later hackfetch is on your PATH.
Getting the basic installer working was the easy part. Detect your OS, detect your CPU architecture, grab the matching binary from GitHub Releases, drop it in /usr/local/bin. Standard installer stuff.
The harder problem was the script itself failing on some Linuxes.
I’d written the first version in Bash, with set -euo pipefail at the top and $'\033[1m' style escape sequences sprinkled through. Worked great on my Mac. Worked great on Ubuntu. Then I checked which shell Alpine Linux ships by default. Not Bash. The whole script would die on line one for anyone on a minimal container.
So I rewrote it in POSIX sh, which is the one shell every Unix system actually has. No Bash-isms, no fancy quoting, no pipefail. Smaller, dumber, way more portable.
Speaking Seven Package Managers
The next problem: the script needs curl and tar to do its job. If you don’t have them, normally you’d just be stuck.
Instead, the installer now detects your system’s package manager and installs the missing prereqs for you:
- apt (Debian, Ubuntu)
- dnf (Fedora, RHEL)
- yum (CentOS, older RHEL)
- pacman (Arch)
- zypper (openSUSE)
- apk (Alpine)
- brew (macOS)
They all do the same thing. They all use different words for it. The installer knows all seven.
Comments 0
No comments yet. Be the first!
Sign in to join the conversation.