Last active
October 17, 2021 20:05
-
-
Save dlangille/924507ce545de8fbbe78b50b752997ce to your computer and use it in GitHub Desktop.
Hook for nullfs mounting an extra patches directory in the master jail - see https://dan.langille.org/2019/08/10/poudriere-hooks/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# /usr/local/etc/poudriere.d/hooks/jail.sh | |
status="$1" | |
# NOTE: mount is invoked before start: re https://github.com/freebsd/poudriere/wiki/hooks | |
if [ "$status" = "mount" ] && [ -d /usr/local/etc/poudriere.d/local-patches ]; then | |
mntpath="$2" | |
# The local-patches directory is created only if it does not already exist. | |
# If it does not already exist, it means we are doing this on the master jail | |
if [ ! -d "${mntpath}/local-patches" ]; then | |
/bin/mkdir "${mntpath}/local-patches" | |
fi | |
# mount our patches to that location | |
/sbin/mount -t nullfs -o ro /usr/local/etc/poudriere.d/local-patches "${mntpath}/local-patches" | |
fi | |
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The jail.sh hook can be used on conjunction with an entry in | |
/usr/local/etc/poudriere.d/make.conf (or similar) such as this | |
.if ${.CURDIR:M*/net-mgmt/nagios} | |
EXTRA_PATCHES+= /local-patches/webserver/nagios.patch | |
.endif |
Do you see any advantages?
I see an advantage with this hook, it is closer to having a unionfs-mounted overlay (instead of the current nullfs-mounted one). I have not tested exhaustively, but from my initial tests, you would need to have all the port files + patches, instead of just the diff from the ports tree (local patches).
I looked at overlay and could not figure out how to get it work.
Here is my sample repo: https://github.com/jlduran/test-poudriere-overlay. It basically uses the category/port directory from the overlay instead of the default one. If you're using git, this approach might be a bit excessive for my needs.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This approach was created 2 years ago, before I'd heard of poudriere overlays.
I looked at overlay and could not figure out how to get it work.
Do you see any advantages?