summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--system/kmod/APKBUILD66
-rw-r--r--system/kmod/kmod-static-nodes.initd19
-rw-r--r--system/kmod/kmod.trigger8
-rw-r--r--system/kmod/strndupa.patch15
4 files changed, 108 insertions, 0 deletions
diff --git a/system/kmod/APKBUILD b/system/kmod/APKBUILD
new file mode 100644
index 000000000..b0aab15a3
--- /dev/null
+++ b/system/kmod/APKBUILD
@@ -0,0 +1,66 @@
+# Contributor: Natanael Copa <ncopa@alpinelinux.org>
+# Maintainer: A. Wilcox <awilfox@adelielinux.org>
+pkgname=kmod
+pkgver=24
+pkgrel=1
+pkgdesc="Linux kernel module management utilities"
+url="http://git.kernel.org/?p=utils/kernel/kmod/kmod.git;a=summary"
+arch="all"
+options="!check" # https://bugs.gentoo.org/408915#c3
+license="GPL-2.0+"
+depends=""
+depends_dev=""
+makedepends_build="libxslt"
+makedepends_host="$depends_dev zlib-dev xz-dev"
+makedepends="$makedepends_build $makedepends_host"
+install=""
+triggers="$pkgname.trigger=/lib/modules/*"
+subpackages="$pkgname-dev $pkgname-doc $pkgname-openrc
+ $pkgname-bash-completion:bashcomp:noarch"
+source="https://kernel.org/pub/linux/utils/kernel/kmod/kmod-$pkgver.tar.xz
+ strndupa.patch
+ kmod-static-nodes.initd
+ "
+
+build() {
+ cd "$builddir"
+ ./configure \
+ --build=$CBUILD \
+ --host=$CHOST \
+ --prefix=/usr \
+ --bindir=/bin \
+ --sysconfdir=/etc \
+ --with-rootlibdir=/lib \
+ --with-zlib \
+ --with-xz
+ make
+}
+
+package() {
+ cd "$builddir"
+ make DESTDIR="$pkgdir" install
+ local i
+ mkdir -p "$pkgdir"/sbin
+ for i in lsmod rmmod insmod modinfo modprobe depmod; do
+ ln -sf ../bin/kmod "$pkgdir"/sbin/$i
+ done
+ for i in lsmod modinfo; do
+ ln -s kmod "$pkgdir"/bin/$i
+ done
+ install -Dm755 "$srcdir"/kmod-static-nodes.initd \
+ "$pkgdir"/etc/init.d/kmod-static-nodes
+}
+
+bashcomp() {
+ pkgdesc="Bash completion for $pkgname"
+ depends=""
+ install_if="bash-completion $pkgname=$pkgver-r$pkgrel"
+
+ mkdir -p "$subpkgdir"/usr/share
+ mv "$pkgdir"/usr/share/bash-completion "$subpkgdir"/usr/share/
+}
+
+
+sha512sums="58c8da100418b6325de1595bceee4115cbdd7151d03a028c0b1f6d5d3e6611c667e27f3a0245d29781125581849fd1e854fa8d87b63c4b8fa3f196d0a97e1779 kmod-24.tar.xz
+f2ea3527bfba182c5e15557c224a5bba8c7e2ea3d21cf604e6eb2277226dcf983c3aeb9ac44a322c7f2b4942b35135da999d63a5b946b829d3f3b09c050a0f17 strndupa.patch
+7f0f89fe98167f71b7924f341ba701d001158225463c2f5e39f706a0224b1e952ee901b441f28cb15787563e83bb6e54eb752bf8669ae7c0ffbb11984542f354 kmod-static-nodes.initd"
diff --git a/system/kmod/kmod-static-nodes.initd b/system/kmod/kmod-static-nodes.initd
new file mode 100644
index 000000000..ef8912f60
--- /dev/null
+++ b/system/kmod/kmod-static-nodes.initd
@@ -0,0 +1,19 @@
+#!/sbin/openrc-run
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-apps/kmod/files/kmod-static-nodes-r1,v 1.1 2014/07/11 12:28:07 ssuominen Exp $
+
+description="Create list of required static device nodes for the current kernel"
+
+depend() {
+ after dev-mount
+ before tmpfiles.dev dev
+ keyword -lxc
+}
+
+start() {
+ ebegin "Creating list of required static device nodes for the current kernel"
+ checkpath -q -d /run/tmpfiles.d
+ kmod static-nodes --format=tmpfiles --output=/run/tmpfiles.d/kmod.conf
+ eend $?
+}
diff --git a/system/kmod/kmod.trigger b/system/kmod/kmod.trigger
new file mode 100644
index 000000000..1693ea1ea
--- /dev/null
+++ b/system/kmod/kmod.trigger
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+for i in "$@"; do
+ if [ -d "$i" ]; then
+ /sbin/depmod ${i#/lib/modules/}
+ fi
+done
+
diff --git a/system/kmod/strndupa.patch b/system/kmod/strndupa.patch
new file mode 100644
index 000000000..d4527140e
--- /dev/null
+++ b/system/kmod/strndupa.patch
@@ -0,0 +1,15 @@
+diff --git a/libkmod/libkmod-util.c b/libkmod/libkmod-util.c
+index df12433..142e767 100644
+--- a/shared/util.c
++++ b/shared/util.c
+@@ -334,7 +334,9 @@ int mkdir_p(const char *path, int len, mode_t mode)
+ {
+ char *start, *end;
+
+- start = strndupa(path, len);
++ start = alloca(len+1);
++ strncpy(start, path, len);
++ start[len] = '\0';
+ end = start + len;
+
+ /*