Own ports and packages repos for CRUX

I’ve been using CRUX as my main system for couple of months now. My PC has an nice CPU and lots of RAM, so compiling stuff on it is not a problem. This is not the case with my old ThinkPad x230, though… So, I want to turn the packages created on my PC, into a packages repository for the laptop, running the same distro.

The idea is analogous to what I describe in this previous post of mine for Slackware. Here, I do this on CRUX.

Home server

The steps I took are the same as in my previous post, but in CRUX, the configuration happens in /etc/apache, instead of /etc/httpd. I added apache to the SERVICES in /etc/rc.conf and started it.

HttpUp ports repository

My own, local, ports collection is called custom. I generated a repository from it, following the instructions for setting a HttpUp repo:

cd /usr/ports/custom
httpup-repgen

While there, let’s also make a nice page:

portspage . > index.html

I created a symlink to the collection:

cd /var/www/htdocs
ln -s /usr/ports/custom .

So, the repo can be accessed in my home network at:

http://XXX.XXX.X.XXX/custom

In order to sync to the repo from another computer (e.g. my ThinkPad x230), I made a HttpUp file:

#
# /etc/ports/custom.httpup: Custom port collection
#

ROOT_DIR=/usr/ports/custom
URL=http://XXX.XXX.X.XXX/custom

# End of file

Make prt-get aware of the custom ports collection:

prtdir /usr/ports/custom

Packages repository

Packages were build with the default C(XX)FLAGS and I made pkgmk store them in a single folder:

PKGMK_PACKAGE_DIR="/ports/packages"

Clean any old packages:

oldfiles | grep "packages" | xargs rm -rf

Generate the repo:

cd /ports/packages
pkg-repgen

Create symlinks to the packages collection:

cd /var/www/htdocs
ln -s /ports/packages .

So, in my home network, the address of the packages is:

http://XXX.XXX.X.XXX/packages

Install scripts

When generating the packages repository, install scripts are collected by pkg-repgen into a single file called PKGINST. They are stored as individual functions and, upon a package install, its corresponding function is called by the if statement in the end of the file:

if [ ! -z "$1" ]; then $1; fi

Here I encountered a problem, because pkg-get was not able to find the functions for packages containing a dash in their name. It seems dashes become transformed into underscores: for example, the function for adwaita-icon-theme is named like this:

adwaita_icon_theme_post_install() {
...
}

I am not sure if this is a bug, or I simply did not configure something properly. For now, I modified the last line, to make it substitute all dashes with underscores:

if [ ! -z "$1" ]; then ${1//-/_}; fi

Installing packages with pkg-get

Configure pkg-get to find the repo and to execute install scripts:

# My packages
pkgdir           /var/pkgget|http://XXX.XXX.X.XXX/packages

# runscripts: if "yes" pre-post install scripts are
# automatically executed. Handle with care.
runscripts     yes

Packages will be stored locally in /var/pkgget. It’s time to start by syncing:

pkg-get sync

Then check for updates and update the whole system:

pkg-get diff
pkg-get sysup

Check for missing libraries

The dependencies parsed to pkg-get are the ones listed on the “Depends on” line in the Pkgfile used to build the package. When compiling, programs may get linked against additional (optional) dependencies, that happen to be present at build time. These will not be automatically pulled when installing with pkg-get and the system will end up with programs linked to missing libraries. So I did a check with revdep on my laptop:

revdep

If a package was reported (e.g. qt5), I checked what libraries were missing:

revdep qt5 -vvv

Then I searched for the package containing a library that was missing:

prt-get fsearch libQt5Pdf.so.5.15.2

For this to work, the ports that were used to build the packages should also be present (that’s why I prepared custom.httpup), since the program checks their .footprint files. Finally, install the package that provides the library:

pkg-get depinst qtwebengine

That’s it!



Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s