mag

a binary package manager in one C file: apk and pacman repos, CRUX, Void and Exherbo ports
git clone https://github.com/tortr-rs/mag
Log | Files | Refs | README | LICENSE

commit 9924f7ab19e39573c18da0b30e22c5ab49d16a18
parent 55d0c080e8fcca86fb0d96ea55367409fb5ab1b3
Author: torter <koubbamohamedrayan@gmail.com>
Date:   Sat, 14 Nov 2026 20:01:41 +0000

mag: the download command is NetBSD's ftp, not curl

Diffstat:
MREADME.md | 2+-
Mmag.c | 6+++---
2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/README.md b/README.md @@ -31,7 +31,7 @@ already there is left alone (a changed one comes as `.new`). Every package keeps `MAG_ROOT` installs somewhere else than /, `MAG_REPO` is a list of repos split by colons (default `/usr/share/mag/repo:/usr/pkgsrc`), `MAG_FETCH` is the -download command (it needs https, which mag doesn't do itself: curl by default). tar and rm come from the +download command (it needs https, which mag does not do itself: `ftp -o`, NetBSD's ftp, by default). tar and rm come from the system, which here means rifle and a tar. `mag sync` downloads the pkgsrc tree (`MAG_SYNC_URL`, NetBSD's `pkgsrc.tar.xz` if unset) with the same download command and diff --git a/mag.c b/mag.c @@ -1247,7 +1247,7 @@ static int fetch(const struct recipe *r) const char *url = i < 0 ? r->url : r->alts.v[i]; char *av[7]; printf("==> fetching %s\n", url); - av[0] = "/bin/sh"; av[1] = "-c"; av[2] = "set -f; $0 \"$1\" \"$2\""; av[3] = (char *)(cmd ? cmd : "curl -fsSL -o"); + av[0] = "/bin/sh"; av[1] = "-c"; av[2] = "set -f; $0 \"$1\" \"$2\""; av[3] = (char *)(cmd ? cmd : "ftp -o"); av[4] = tmp; av[5] = (char *)url; av[6] = NULL; if (run(av, NULL)) { unlink(tmp); continue; } sum = dist_sum(r, tmp); @@ -1772,7 +1772,7 @@ static int cmd_sync(void) { const char *url = getenv("MAG_SYNC_URL"), *cmd = getenv("MAG_FETCH"); char *file = fmt("%s/var/cache/mag/pkgsrc.tar.xz", root), *part = fmt("%s.part", file), *tmp = fmt("%s/usr/pkgsrc.sync", root), *tree = fmt("%s/usr/pkgsrc", root), *from = fmt("%s/pkgsrc", tmp); - char *dl[] = { "/bin/sh", "-c", "set -f; $0 \"$1\" \"$2\"", (char *)(cmd ? cmd : "curl -fsSL -o"), part, (char *)(url ? url : "https://cdn.netbsd.org/pub/pkgsrc/current/pkgsrc.tar.xz"), NULL }; + char *dl[] = { "/bin/sh", "-c", "set -f; $0 \"$1\" \"$2\"", (char *)(cmd ? cmd : "ftp -o"), part, (char *)(url ? url : "https://cdn.netbsd.org/pub/pkgsrc/current/pkgsrc.tar.xz"), NULL }; char *un[] = { "tar", "-xf", file, "-C", tmp, NULL }; char *rm[] = { "rm", "-rf", tree, NULL }; char *dir = xstrdup(file); @@ -1899,7 +1899,7 @@ static void usage(void) "\n" "MAG_ROOT installs somewhere else than /, MAG_REPO is a list of repos split by colons (default\n" "/usr/share/mag/repo:/usr/pkgsrc), MAG_SYNC_URL is where sync gets the tree,\n" - "MAG_FETCH is the download command, which gets a file and an url (default curl -fsSL -o), MAG_PREFIX is $PREFIX for the steps, /usr, and MAG_JOBS is $JOBS, 4"); + "MAG_FETCH is the download command, which gets a file and an url (default ftp -o), MAG_PREFIX is $PREFIX for the steps, /usr, and MAG_JOBS is $JOBS, 4"); } int main(int argc, char **argv)