My dumbest trick yet

This is one of those things that I will probably be looking for again in the future, no matter how lame it seems right now.

I like to keep local copies of the source code for the software I have on Crux systems, just because if something breaks and I am not online, then it helps to get things going again. It’s also useful if network speeds are slow or if there’s a problem getting a particular source package with the proper checksum.

On the other hand, that tends to take up a lot of space, particularly if there’s a large library or compile-time dependency involved. ocaml, for example, is a gargantuan beast that’s only really necessary to compile wyrd. Once it’s been built, I don’t need ocaml ever again.

So to save space I sometimes have to remove source packages (which can be neatly done with prt-utils’ prtwash -a -s command), but it makes me itchy.

So I decided today to get all the source packages back from the applications I’d installed and then cleared out, as a precautionary measure. pkgmk has a -do flag, which just gets the package but doesn’t do anything with it.

But I don’t think you can give pkgmk the name of a program to build; it has to be executed from the port directory, where it reads the Pkgfile and goes to work.

Now prt-get has a path command, which spits out the full path of a package, and that means I can cd into a path‘d directory and issue the pkgmk -do command.

If I can get a proper list of all the packages on the system, that is. prt-get to the rescue again, with the wonderfully sparse listinst command. Ergo:

for i in `prt-get listinst` ; do cd `prt-get path $i` ; pkgmk -do ; done

Not much in the way of error checking. Definitely not idiot-proof. And it could, I suppose, stand to save a little bandwidth if the package is already on hand and passes an md5sum check.

But those are embellishments. Flair! Bloat! ๐Ÿ‘ฟ

Anyway, that’s probably the dumbest thing I’ve come up with for a while. Watch: This’ll be the most frequent page I hit over the next year or so. This and the page for setting locales. … ๐Ÿ™„

Leave a comment