summaryrefslogtreecommitdiff
path: root/libre/dkms-libre
diff options
context:
space:
mode:
authorAndré Fabian Silva Delgado <emulatorman@lavabit.com>2013-06-28 20:50:15 -0300
committerAndré Fabian Silva Delgado <emulatorman@lavabit.com>2013-06-28 20:50:15 -0300
commit956c02263360b2c8aacf2cf3ae5ecd5f6fdb71c4 (patch)
treec72ae1b074c7d8c9c8e4ec6ac7f2322c9bfbbe2b /libre/dkms-libre
parent22c0cfe241978c9f2ce46b90bf439b8dcfb05b2a (diff)
dkms-libre: add new package to libre repo
Diffstat (limited to 'libre/dkms-libre')
-rw-r--r--libre/dkms-libre/01-broken-uninstall.patch22
-rw-r--r--libre/dkms-libre/02-no-kernel-hook.patch13
-rw-r--r--libre/dkms-libre/PKGBUILD66
-rw-r--r--libre/dkms-libre/dkms.default9
-rw-r--r--libre/dkms-libre/dkms.hook12
-rw-r--r--libre/dkms-libre/dkms.install13
-rw-r--r--libre/dkms-libre/dkms.service11
-rw-r--r--libre/dkms-libre/dkms.systemd61
8 files changed, 207 insertions, 0 deletions
diff --git a/libre/dkms-libre/01-broken-uninstall.patch b/libre/dkms-libre/01-broken-uninstall.patch
new file mode 100644
index 000000000..a859efabe
--- /dev/null
+++ b/libre/dkms-libre/01-broken-uninstall.patch
@@ -0,0 +1,22 @@
+diff --git a/dkms b/dkms
+index abb01a4..265b69a 100644
+--- a/dkms
++++ b/dkms
+@@ -162,11 +162,14 @@ set_kernel_source_dir()
+
+ # A little test function for DKMS commands that only work on one kernel.
+ have_one_kernel() {
+- (( ${#kernelver[@]} > 1 )) && \
+- die 4 $"The action $1 does not support multiple kernel version" \
+- $"parameters on the command line."
+- [[ $all ]] && die 5 $"The action $1 does not support the --all" \
+- $"parameter."
++ if (( ${#kernelver[@]} != 1 )); then
++ die 4 $"The action $1 does not support multiple kernel version" \
++ $"parameters on the command line."
++ fi
++ if [[ $all ]]; then
++ die 5 $"The action $1 does not support the --all" \
++ $"parameter."
++ fi
+ }
diff --git a/libre/dkms-libre/02-no-kernel-hook.patch b/libre/dkms-libre/02-no-kernel-hook.patch
new file mode 100644
index 000000000..f01f22002
--- /dev/null
+++ b/libre/dkms-libre/02-no-kernel-hook.patch
@@ -0,0 +1,13 @@
+# Author: Sébastien Luttringer <seblu@seblu.net>
+--- a/Makefile 2011-12-07 19:23:51.000000000 +0100
++++ b/Makefile 2013-05-13 00:48:19.620000000 +0200
+@@ -46,9 +46,6 @@
+ gzip -c -9 dkms.8 > $(MAN)/dkms.8.gz
+ chmod 0644 $(MAN)/dkms.8.gz
+ touch --reference=dkms.8 $(MAN)/dkms.8.gz
+- mkdir -p -m 0755 $(KCONF)/prerm.d $(KCONF)/postinst.d
+- install -p -m 0755 kernel_prerm.d_dkms $(KCONF)/prerm.d/dkms
+- install -p -m 0755 kernel_postinst.d_dkms $(KCONF)/postinst.d/dkms
+
+ DOCFILES=sample.spec sample.conf AUTHORS COPYING README.dkms sample-suse-9-mkkmp.spec sample-suse-10-mkkmp.spec
+
diff --git a/libre/dkms-libre/PKGBUILD b/libre/dkms-libre/PKGBUILD
new file mode 100644
index 000000000..99caab5fa
--- /dev/null
+++ b/libre/dkms-libre/PKGBUILD
@@ -0,0 +1,66 @@
+# $Id: PKGBUILD 90494 2013-05-12 22:57:28Z seblu $
+# Maintainer: Sébastien Luttringer
+# Contributor: Balwinder S "bsd" Dheeman (bdheeman AT gmail.com)
+# Maintainer (Parabola): André Silva <emulatorman@lavabit.com>
+
+_pkgname=dkms
+pkgname=dkms-libre
+pkgver=2.2.0.3
+pkgrel=14
+pkgdesc='Dynamic Kernel Modules System, with linux-libre-headers and linux-libre-lts-headers recommendation'
+arch=('any')
+url='http://linux.dell.com/dkms/'
+license=('GPL2')
+depends=('bash' 'kmod' 'gcc' 'make' 'patch')
+optdepends=('linux-libre-headers: build modules against linux-libre kernel'
+ 'linux-libre-lts-headers: build modules against linux-libre-lts kernel')
+replaces=$_pkgname
+conflicts=$_pkgname
+provides=$_pkgname=$pkgver
+backup=('etc/dkms/framework.conf' 'etc/default/dkms')
+install=$_pkgname.install
+source=("http://linux.dell.com/$_pkgname/permalink/$_pkgname-$pkgver.tar.gz"
+ "$_pkgname.default"
+ "$_pkgname.service"
+ "$_pkgname.systemd"
+ '01-broken-uninstall.patch'
+ '02-no-kernel-hook.patch')
+md5sums=('11a8aaade2ebec2803653837c7593030'
+ '33be2fbf1bcc1b3fb2f38d9e7eaa809d'
+ '02e9744e3fdc3d2f68e46966fb32e260'
+ '267632312aa52a190ec0db0758920dd3'
+ '2dfd8656dc79afd229c1481a90fb645b'
+ '82d520c39c99c34977e48b313a189c6c')
+
+prepare() {
+ # patch
+ patches=("$srcdir"/*.patch)
+ cd $_pkgname-$pkgver
+ for p in "${patches[@]}"; do
+ msg2 "Apply patch: ${p##*/}"
+ patch -p1 -i "$p"
+ done
+ # /usr move
+ msg2 '/usr move patching'
+ for i in dkms{,_framework.conf,.bash-completion,.8,_common.postinst}; do
+ sed -ri 's,/lib/modules,/usr/lib/modules,g' "$i"
+ done
+ # fix hardcoded paths
+ sed -i "s|/sbin/depmod|depmod|" dkms
+}
+
+package() {
+ # systemd
+ install -D -m 644 $_pkgname.service "$pkgdir/usr/lib/systemd/system/$_pkgname.service"
+ install -D -m 755 $_pkgname.systemd "$pkgdir/usr/lib/systemd/scripts/$_pkgname"
+ install -D -m 644 $_pkgname.default "$pkgdir/etc/default/$_pkgname"
+ # upstream installer
+ cd $_pkgname-$pkgver
+ make \
+ DESTDIR="$pkgdir" \
+ SBIN="$pkgdir/usr/bin" \
+ BASHDIR="$pkgdir/usr/share/bash-completion/completions" \
+ install
+}
+
+# vim:set ts=2 sw=2 et:
diff --git a/libre/dkms-libre/dkms.default b/libre/dkms-libre/dkms.default
new file mode 100644
index 000000000..d430855bb
--- /dev/null
+++ b/libre/dkms-libre/dkms.default
@@ -0,0 +1,9 @@
+# vim:set ts=2 sw=2 ft=sh noet:
+
+# With LOAD set to yes, modules listed as installed will be loaded with
+# systemctl start dkms.service. Default is yes.
+LOAD=yes
+
+# With UNLOAD set to yes, modules listed as installed will be unloaded with
+# systemctl stop dkms.service. Default is no.
+UNLOAD=no
diff --git a/libre/dkms-libre/dkms.hook b/libre/dkms-libre/dkms.hook
new file mode 100644
index 000000000..3d656e32d
--- /dev/null
+++ b/libre/dkms-libre/dkms.hook
@@ -0,0 +1,12 @@
+#!/bin/bash
+
+dkms_autoinstall() {
+ export TMPDIR=/dev/shm
+ status 'Starting DKMS autoinstall' dkms autoinstall
+ unset TMPDIR
+}
+
+add_hook single_udevlaunched dkms_autoinstall
+add_hook sysinit_udevlaunched dkms_autoinstall
+
+# vim:set ts=2 sw=2 ft=sh et:
diff --git a/libre/dkms-libre/dkms.install b/libre/dkms-libre/dkms.install
new file mode 100644
index 000000000..4dd18dd19
--- /dev/null
+++ b/libre/dkms-libre/dkms.install
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+# arg 1: the new package version
+# arg 2: the old package version
+post_upgrade() {
+ if [ "$(vercmp $2 2.2.0.3-12)" -le 0 ]; then
+ cat << EOF
+===> dkms startup config file moved to /etc/default/dkms
+EOF
+ fi
+}
+
+# vim:set ts=2 sw=2 ft=sh et:
diff --git a/libre/dkms-libre/dkms.service b/libre/dkms-libre/dkms.service
new file mode 100644
index 000000000..0e679a949
--- /dev/null
+++ b/libre/dkms-libre/dkms.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=Dynamic Kernel Modules System
+
+[Service]
+Type=oneshot
+RemainAfterExit=yes
+ExecStart=/usr/lib/systemd/scripts/dkms start
+ExecStop=/usr/lib/systemd/scripts/dkms stop
+
+[Install]
+WantedBy=multi-user.target
diff --git a/libre/dkms-libre/dkms.systemd b/libre/dkms-libre/dkms.systemd
new file mode 100644
index 000000000..03e6bfe97
--- /dev/null
+++ b/libre/dkms-libre/dkms.systemd
@@ -0,0 +1,61 @@
+#!/bin/bash
+
+. /etc/default/dkms
+
+# list dkms modules for the current running kernel
+list_dkms_modules() {
+ shopt -s nullglob
+ declare -a DKMS_MOULES
+ # dkms status needs uname -r to list correctly intalled version for current kernel
+ local modules_path=($(dkms status -k "$(uname -r)"|sed -rn 's#(.*), (.*), (.*), (.*): installed#\1/\2/\3/\4#p'))
+ for p in "${modules_path[@]}"; do
+ for m in /var/lib/dkms/"$p"/module/*.ko{,gz}; do
+ m=${m##*/}
+ m=${m%.gz}
+ m=${m%.ko}
+ DKMS_MODULES+=("$m")
+ done
+ done
+}
+
+# load installed kernel modules for the current kernel version
+load_dkms_modules() {
+ local ret=0
+ list_dkms_modules
+ for m in "${DKMS_MODULES[@]}"; do
+ modprobe "$m"
+ ret+=$?
+ done
+ return $ret
+}
+
+# unload installed kernel modules for the current kernel version
+unload_dkms_modules() {
+ list_dkms_modules
+ # ask for removal
+ for m in "${DKMS_MODULES[@]}"; do
+ modprobe --remove --quiet "$m"
+ done
+ # check modules are unloaded
+ # sometimes modprobe -r fail but modules are removed
+ for m in "${DKMS_MODULES[@]}"; do
+ [[ -e /sys/modules/$m ]] && return 1
+ done
+ return 0
+}
+
+case "$1" in
+ start)
+ dkms autoinstall -k "$(uname -r)"
+ [[ $LOAD =~ [Yy][Ee][Ss] ]] && load_dkms_modules
+ ;;
+ stop)
+ [[ $UNLOAD =~ [Yy][Ee][Ss] ]] && unload_dkms_modules
+ ;;
+ *)
+ echo "usage: $0 {start|stop}" >&2
+ ;;
+esac
+
+:
+# vim:set ts=2 sw=2 ft=sh et: