My Authors
Read all threads
Hey, want to see a crazy trick?
+ Compile package from port on #FreeBSD 12.1
+ Convert to old-style FreeBSD package
+ Install on FreeBSD 9.2
Only works with packages containing no binaries, of course; security/acme.sh for example
So let's get into it. Because that probably sounds like dark magic (well, it is, and I'm going to show you how to wield it).

This probably sounds like Debian/Ubuntu's "alien" utility but for FreeBSD. Well, it kind of is.

Thread.
Over the years, FreeBSD has had 2 major package formats (speaking strictly about the payloads; the tarballs themselves; not the ports system or Makefiles that create them) and 3 different compression formats.

In the beginning, there was pkg_add, pkg_delete, pkg_info, etc.
The pkg_* utilities were collective called pkg_tools and they operated on tarballs compressed with either gzip (.tgz) or bzip2 (.tbz). Inside the archive would be the following flat-files for metadata: +COMMENT +CONTENTS +DESC +DISPLAY and +{POST-,}{DE,}INSTALL
@_bapt_ led the charge and we now have a single tool named "pkg" that does it all (even more consolidated than Linux regulars like apt and yum). We feed it xz-compressed archives (.txz) that containing only +MANIFEST and +COMPACT_MANIFEST files for metadata
But, what if you wanted to convert that .txz package archive -- designed for a system using pkg running FreeBSD 9.2 or newer -- to be usable on a system running FreeBSD 9.2 or older and still using the legacy package system (namely "pkg_tools")? Crazy? Yes. Possible? Also Yes!
What may come as a surprise, is that it is also easy. I have a framework that allows easy conversion between the 3 main FreeBSD package formats (.tgz, .tbz, .txz) for whatever you need. However, few know about it and even fewer have used it ... so we will walk through it
I wanted to install this freshports.org/security/acme.…
On FreeBSD 9.2

Problem: the HEAD of the ports tree no longer works on FreeBSD 9.2
Solution: create the package on FreeBSD 12.1 using the ports tree and then convert the package to a FreeBSD 9.x legacy .tbz archive
ASIDE: This has a chance at working because the port contains zero compiled-binaries that would lead to OS library dependencies.
Step 1. Create the desired package using the ports tree

a. cd security/acme.sh
b. make package
c. ls work/pkg/
Step 2. Copy the FreeBSD 12 package to your FreeBSD 9 system

FreeBSD 9 is perfectly capable of converting the package. If you had a really old system like FreeBSD 4, you might want to do the following conversion steps on FreeBSD 12 and then copy the legacy package to FreeBSD 4
Step 3. Conversion

a. Clone this repo (it's where the conversion tools live)
github.com/FrauBSD/pkgcen…
Step 3. Conversion (cont.)

b. cd freebsd/RELENG_12_0
c. ../unpack.sh -o ~/acme.sh-2.8.3.txz
Step 3. Conversion (cont.)

d. make -f Makefile.old
Step 3. Conversion (cont.)

And if you need to create a tarball compatible with FreeBSD older than 8

e. make -f ../../../skel/Makefile.old

NOTE: Makefile, .ng, and .old in the skeleton directory can be used and/or copied as-needed
Step 4. Install the newly created legacy package on FreeBSD 9

a. sudo pkg_add acme.sh-2.8.3.tbz
That's it. That's all there is to it. You can inspect the legacy package with various incantations such as "pkg_info -qox acme.sh" or "pkg_info -qlx acme." or whatever you fancy.

You will notice that the conversion process properly converted dependencies and more
APPENDIX:
You may be wondering how I got "pkg_add -r" to pull the legacy socat from the FreeBSD FTP Archive, allowing my FreeBSD 9 system to still install packages remotely.

The trick is modifying your /etc/login.conf as shown and running "cap_mkdb /etc/login.conf"
Missing some Tweet in this thread? You can try to force a refresh.

Keep Current with FreeBSD Frau

Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

Twitter may remove this content at anytime, convert it as a PDF, save and print for later use!

Try unrolling a thread yourself!

how to unroll video

1) Follow Thread Reader App on Twitter so you can easily mention us!

2) Go to a Twitter thread (series of Tweets by the same owner) and mention us with a keyword "unroll" @threadreaderapp unroll

You can practice here first or read more on our help page!

Follow Us on Twitter!

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3.00/month or $30.00/year) and get exclusive features!

Become Premium

Too expensive? Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal Become our Patreon

Thank you for your support!