Logo - Japanese Zodiac Sign

OpenBSD-current

If running OpenBSD-current you may find some scripts here coming handy.

de en

Running OpenBSD-current

If running OpenBSD-current one has to track source changes and more important changes to the ports tree. This may become more difficult the more third party software is installed on your OpenBSD system.

Automatically update ports from source

Tracking current by source will require some attention to the installed 3rd party software. Here is not yet perfect solution for automating this.

This is a script to automatically update installed ports via source from the ports tree. It uses the out-of-date script, provided by the ports tree in the infrastructure/build directory to pick all outdated ports. This means that all cases of outdated ports should be covered like

  • library version changes in the base system
  • dependend ports updated
  • new version of ports
The script has a view drawbacks:
  1. There are some ports that ship a broken libtool implementation. That libtool will pull in libs from already installed software, because the search path is not ordered correctly. glib2, gnash and cairo are among those ports I am currently aware of, but I guess that the list will grow in the future.

    There is a workaround for the glib2 and cairo port that works for now: Add

    LIBTOOL=${PORTSDIR}/infrastructure/build/libtool
    

    to the ports Makefile and the port will build correctly. The fix won't work for gnash, so some packages need to be uninstalled and build by hand.

  2. Currently there is no handling of pseudo flavors. A prominent example would be qt3, you can omit installing and building the databases mysql, sqlite3 and postgresql using a pseudo flavor. There is currently no way for the script to check if one of those was used while originally building the port.

  3. It is not yet finished. There are major parts missing like command line handling and handling of some of the problems described above automatically. I have installed a limited set of packages, so some corner cases may require a different handling or an altered regex for parsing the output from the out-of-date script. Feel free to report those things to me.

  4. Some ports are updated and get another dependency list. These dependencys may not be installed yet, so they are silently build by the updated port.

I put all this in a README file together with the script and some patches I am currently using on my ports tree. These can be accessed via anonymous cvs (Fingerprint: 2e:78:ac:03:2d:47:58:9a:9b:2e:77:d5:2e:16:79:f8) with the password 'anoncvs':

cvs -d anoncvs@markus-hennecke.de:/var/cvs co autoupdate

It is possible to browse the source via cvstrac.

I think that a single file download is no longer appropriate, so if you like to use the script, please use the anoncvs checkout.

Keeping track of library changes

Eventually there comes the time when you wish to delete old shared libraries from the harddisk. A new version is in the base system and you wonder if you can safely delete the lib? Sometimes ports, especially such ports that change not frequently, are still linked to the old libs. With the following shell script it is possible to list all executable files under a given path (for example /usr/local/bin in case of ports) that are linked to a specific library.

Script: show_linked_files.sh
#! /bin/sh

LIB=$1
SPATH=$2

for EXECUTABLE in `find "${SPATH}" -perm '-111' -exec file {} \; \
		| grep ELF.*dynamically\ linked | cut -d ':' -f 1`; do
	ldd "${EXECUTABLE}" | fgrep "${LIB}" >/dev/null;
	if [ $? -eq 0 ]; then
		echo ${EXECUTABLE}
	fi
done

If you have the new libc.so.42.0 installed and wish to know which executables installed via ports are still using the libc.so.41.0 you could invoke the script like this:

show_linked_files.sh libc.so.41 /usr/local/bin

There is an easier way to do this if you actually have installed the ports tree. In ${PORTSDIR}/infrastructure/build/ is an excellent script called out-of-date with a shiny output and much more information (see above for a useful script utilizing this).