modules: add support for FreeBSD

This is based on a patch submitted by
Joe Maloney <pkgdemonteam@gmail.com>.

This fixes #91.
This commit is contained in:
William Hubbs 2016-07-17 14:53:12 -05:00
parent 695be59083
commit 314ae3dc78
5 changed files with 33 additions and 9 deletions

View File

@ -13,7 +13,7 @@ endif
MK= ../mk
include ${MK}/os.mk
CONF-FreeBSD= ipfw moused powerd rarpd savecore syscons
CONF-FreeBSD= ipfw modules moused powerd rarpd savecore syscons
CONF-Linux= consolefont devfs dmesg hwclock keymaps killprocs modules mtab \
net-online

View File

@ -1,18 +1,22 @@
# You can define a list modules for a specific kernel version,
# a released kernel version, a main kernel version or just a list.
# Linux users can define a list of modules for a specific kernel version,
# a released kernel version, a main kernel version or all kernel versions.
# The most specific versioned variable will take precedence.
# FreeBSD users can only use the modules="foo bar" setting.
#modules_2_6_23_gentoo_r5="ieee1394 ohci1394"
#modules_2_6_23="tun ieee1394"
#modules_2_6="tun"
#modules_2="ipv6"
#modules="ohci1394"
# You can give modules a different name when they load - the new name
# Linux users can give modules a different name when they load - the new name
# will also be used to pick arguments below.
# This is not supported on FreeBSD.
#modules="dummy:dummy1"
# Give the modules some arguments if needed, per version if necessary.
# Linux users can give the modules some arguments if needed, per version
# if necessary.
# Again, the most specific versioned variable will take precedence.
# This is not supported on FreeBSD.
#module_ieee1394_args="debug"
#module_ieee1394_args_2_6_23_gentoo_r5="debug2"
#module_ieee1394_args_2_6_23="debug3"

View File

@ -15,8 +15,8 @@ MK= ../mk
include ${MK}/os.mk
# Generic BSD scripts
SRCS-FreeBSD= hostid.in moused.in newsyslog.in pf.in rarpd.in rc-enabled.in \
rpcbind.in savecore.in syslogd.in
SRCS-FreeBSD= hostid.in modules.in moused.in newsyslog.in pf.in rarpd.in \
rc-enabled.in rpcbind.in savecore.in syslogd.in
# These are FreeBSD specific
SRCS-FreeBSD+= adjkerntz.in devd.in dumpon.in encswap.in ipfw.in \
mixer.in nscd.in powerd.in syscons.in

View File

@ -17,7 +17,18 @@ depend()
keyword -openvz -prefix -systemd-nspawn -vserver -lxc
}
start()
FreeBSD_modules()
{
local cnt=0 x
for x in $modules; do
ebegin "Loading module $x"
kldload "$x"
eend $? "Failed to load $x" && : $(( cnt += 1 ))
done
einfo "Autoloaded $cnt module(s)"
}
Linux_modules()
{
# Should not fail if kernel do not have module
# support compiled in ...
@ -68,3 +79,12 @@ start()
done
einfo "Autoloaded $cnt module(s)"
}
start()
{
case "$RC_UNAME" in
FreeBSD|Linux) ${RC_UNAME}_modules ;;
*) ;;
esac
return 0
}

View File

@ -32,7 +32,7 @@ SYSINIT-${OS}=
BOOT-BSD= hostid newsyslog savecore syslogd swap-blk
# Generic BSD stuff
BOOT-FreeBSD+= hostid newsyslog savecore syslogd
BOOT-FreeBSD+= hostid modules newsyslog savecore syslogd
# FreeBSD specific stuff
BOOT-FreeBSD+= adjkerntz dumpon syscons