From 95cc91a8e2f55db5432e88a3c49cc11df836aed1 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Sun, 21 May 2017 12:27:40 +0100 Subject: sys-kernel/dkms : new version v2.3, fix upstream provided systemd.service, add openrc support, don't mess with config files --- sys-kernel/dkms/Manifest | 1 + sys-kernel/dkms/dkms-2.3.ebuild | 26 ++++ .../dkms/files/dkms-2.3-dont-touch-configs.patch | 26 ++++ .../dkms/files/dkms-2.3-gentoo-functions.patch | 82 ++++++++++ .../dkms/files/dkms-2.3-redcore-makefile.patch | 173 +++++++++++++++++++++ .../dkms/files/dkms-2.3-systemd-service-fix.patch | 23 +++ sys-kernel/dkms/files/dkms.initd | 18 +++ 7 files changed, 349 insertions(+) create mode 100644 sys-kernel/dkms/dkms-2.3.ebuild create mode 100644 sys-kernel/dkms/files/dkms-2.3-dont-touch-configs.patch create mode 100644 sys-kernel/dkms/files/dkms-2.3-gentoo-functions.patch create mode 100644 sys-kernel/dkms/files/dkms-2.3-redcore-makefile.patch create mode 100644 sys-kernel/dkms/files/dkms-2.3-systemd-service-fix.patch create mode 100644 sys-kernel/dkms/files/dkms.initd (limited to 'sys-kernel/dkms') diff --git a/sys-kernel/dkms/Manifest b/sys-kernel/dkms/Manifest index 40251db0..57ad9d21 100644 --- a/sys-kernel/dkms/Manifest +++ b/sys-kernel/dkms/Manifest @@ -1 +1,2 @@ DIST dkms-2.2.0.3.tar.gz 86053 SHA256 352a080351410e29ae8cda7a794ba1e607b87ca913d0410d56209f08875378fc SHA512 15df3e160ae54b98009692324c52b06d358665f9f4250970210fa7ba03d1458ea3fdf62b5e4c9bf5a97324ed5ab82adacea33715ca20c946ffc5aa2b1700cb5f WHIRLPOOL 26dc2ab87bc1d3d02c93c381dcb46b37999248a9adf51aeb7a9fdff4fa1c87191dce6e22ded76bbb93354791523e7ba0699cc0dc06c4663f3ee7f0580cad0725 +DIST dkms-2.3.tar.gz 103123 SHA256 e25c4d399a6abf99550c04b4ede71c0781bd6b5ed5ab32ac4ec95f6181bd31c8 SHA512 70afc947575c9c70c8740bb8db976d160568b079d061f04efeeafa8b0abe0ebf4e9be378e9bf08749e0cb85086eeaa348637d3447a24d50c8097862fde7bc9bd WHIRLPOOL 42e6c52b0353c976e95af7cd18df89c4a6b9825742ac67ffa469be6f0cd6a1a46da2798d2c2bd659635c9b096cda39b94d27e63b548430c01dba57da4f666836 diff --git a/sys-kernel/dkms/dkms-2.3.ebuild b/sys-kernel/dkms/dkms-2.3.ebuild new file mode 100644 index 00000000..938da7ad --- /dev/null +++ b/sys-kernel/dkms/dkms-2.3.ebuild @@ -0,0 +1,26 @@ +# Distributed under the terms of the GNU General Public License v2 + +EAPI="5" + +inherit eutils bash-completion-r1 + +DESCRIPTION="Dynamic Kernel Module Support" +SRC_URI="https://github.com/dell/dkms/archive/2.3.tar.gz -> ${P}.tar.gz" +HOMEPAGE="https://github.com/dell/dkms" +LICENSE="GPL-2" +DEPEND="" +RDEPEND="sys-apps/gentoo-functions" +KEYWORDS="amd64" +SLOT="0" + +src_prepare() { + epatch ${FILESDIR}/${P}-dont-touch-configs.patch + epatch ${FILESDIR}/${P}-gentoo-functions.patch + epatch ${FILESDIR}/${P}-systemd-service-fix.patch + epatch ${FILESDIR}/${P}-redcore-makefile.patch +} + +src_install() { + emake DESTDIR=${D} install + newinitd "${FILESDIR}"/dkms.initd dkms +} diff --git a/sys-kernel/dkms/files/dkms-2.3-dont-touch-configs.patch b/sys-kernel/dkms/files/dkms-2.3-dont-touch-configs.patch new file mode 100644 index 00000000..e1034708 --- /dev/null +++ b/sys-kernel/dkms/files/dkms-2.3-dont-touch-configs.patch @@ -0,0 +1,26 @@ +diff -Nur a/dkms b/dkms +--- a/dkms 2016-08-31 18:23:47.000000000 +0100 ++++ b/dkms 2017-05-21 11:42:03.571445932 +0100 +@@ -824,22 +824,6 @@ + sa_sck_o[${#sa_sck_o[*]}]="s/\(INITRD_MODULES.*\)$obsolete_module\b\(.*\)/\1${dest_module_name[$index]}\2/" + done + done +- +- # Do all the changes at once, record the diffs for posterity +- for file in "$@"; do +- [[ $file && -w $file ]] || continue +- if [[ $file = /etc/sysconfig/kernel ]]; then +- sed "${sa_sck_o[*]}" "$file" > "$temp_dir_name/${file##*/}.new" +- else +- sed "${sa_mc_o[*]}" "$file" > "$temp_dir_name/${file##*/}.new" +- fi +- if ! mod_diff=$(diff -u "$temp_dir_name/${file##*/}.new" "$file"); then +- echo $"$file updated to replace obsoleted module references:" +- echo "$mod_diff" +- cp -fp "$temp_dir_name/${file##*/}.new" "$file" +- rm -f "$temp_dir_name/${file##*/}.new" +- fi +- done + } + + moduleconfig_add() diff --git a/sys-kernel/dkms/files/dkms-2.3-gentoo-functions.patch b/sys-kernel/dkms/files/dkms-2.3-gentoo-functions.patch new file mode 100644 index 00000000..42b74640 --- /dev/null +++ b/sys-kernel/dkms/files/dkms-2.3-gentoo-functions.patch @@ -0,0 +1,82 @@ +diff -Nur a/dkms_autoinstaller b/dkms_autoinstaller +--- a/dkms_autoinstaller 2016-08-31 18:23:47.000000000 +0100 ++++ b/dkms_autoinstaller 2017-05-21 11:49:24.833475555 +0100 +@@ -1,60 +1,29 @@ + #!/bin/sh +-# +-# dkms_autoinstaller - A service to automatically install DKMS modules for new kernels. +-# +-# chkconfig: 345 04 04 +-# description: Compiles and install kernel modules automatically for new \ +-# kernels at boot. +- +-### BEGIN INIT INFO +-# Provides: dkms_autoinstaller dkms +-# Default-Start: 3 4 5 +-# Default-Stop: 0 1 2 6 +-# Required-Start: $local_fs +-# Short-Description: DKMS kernel modules installer service ++# Short-Description: Automatically install DKMS modules for new kernels + # Description: A service to automatically install DKMS modules for new kernels. +-### END INIT INFO + ++test -f /usr/sbin/dkms || exit 0 + +-if [ -f /lib/lsb/init-functions ]; then +- . /lib/lsb/init-functions +-elif [ -f /etc/rc.d/init.d/functions ]; then +- . /etc/rc.d/init.d/functions ++if [ -f /lib/gentoo/functions.sh ]; then ++ . /lib/gentoo/functions.sh + fi + +-#We only have these functions on debian/ubuntu +-# so on other distros just stub them out +-if [ ! -f /etc/debian_version ]; then +- alias log_daemon_msg=/bin/echo +- log_end_msg() { if [ "$1" = "0" ]; then echo " Done. "; else echo " Failed. "; fi } +- alias log_action_begin_msg=log_daemon_msg +- alias log_action_end_msg=log_end_msg ++if [ -n "$2" ]; then ++ kernel="$2" ++else ++ kernel=`uname -r` + fi + +-exec="/usr/sbin/dkms" +-prog=${exec##*/} +- +-test -f $exec || exit 0 +- +-[ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog +- ++# See how we were called. + case "$1" in +- start) +- if [ -n "$2" ]; then +- kernel="$2" +- else +- kernel=`uname -r` +- fi +- log_daemon_msg "$prog: running auto installation service for kernel $kernel" +- dkms autoinstall --kernelver $kernel +- log_end_msg $? ++ start) ++ dkms autoinstall --force --kernelver $kernel ++ ;; ++ status) ++ dkms status + ;; +- stop|restart|force-reload|status|reload) +- # There is no stop action, this and the 04 priority during stop is +- # added to make RHEL chkconfig happy. +- # Ignore others on debian/ubuntu too +- ;; +- *) +- echo $"Usage: $0 {start}" +- exit 2 ++ *) ++ echo "Usage: $0 {start}" + esac ++ ++exit 0 diff --git a/sys-kernel/dkms/files/dkms-2.3-redcore-makefile.patch b/sys-kernel/dkms/files/dkms-2.3-redcore-makefile.patch new file mode 100644 index 00000000..ad4ab2d5 --- /dev/null +++ b/sys-kernel/dkms/files/dkms-2.3-redcore-makefile.patch @@ -0,0 +1,173 @@ +diff -Nur a/Makefile b/Makefile +--- a/Makefile 2016-08-31 18:23:47.000000000 +0100 ++++ b/Makefile 2017-05-21 12:06:18.990543640 +0100 +@@ -9,140 +9,45 @@ + DIST := unstable + SHELL=bash + +-SBIN = $(DESTDIR)/usr/sbin +-ETC = $(DESTDIR)/etc/dkms +-VAR = $(DESTDIR)/var/lib/dkms +-MAN = $(DESTDIR)/usr/share/man/man8 +-INITD = $(DESTDIR)/etc/rc.d/init.d +-LIBDIR = $(DESTDIR)/usr/lib/dkms +-BASHDIR = $(DESTDIR)/etc/bash_completion.d +-KCONF = $(DESTDIR)/etc/kernel +-SHAREDIR = $(DESTDIR)/usr/share +-DOCDIR = $(SHAREDIR)/doc/dkms +-SYSTEMD = $(DESTDIR)/usr/lib/systemd/system ++SUBDIRS = ++DESTDIR= ++SBIN ?= /usr/sbin ++ETC ?= /etc/dkms ++VAR ?= /var/lib/dkms ++MAN ?= /usr/share/man/man8 ++LIBDIR ?= /usr/lib/dkms ++BASHDIR ?= /etc/bash_completion.d ++KCONF ?= /etc/kernel ++SYSTEMD_UNITDIR ?= /usr/lib/systemd/system + + #Define the top-level build directory + BUILDDIR := $(shell pwd) + TOPDIR := $(shell pwd) + +-.PHONY = tarball + +-all: clean tarball rpm debs ++all: ++ for d in $(SUBDIRS); do $(MAKE) -C $$d; done + + clean: +- -rm -rf *~ dist/ dkms-freshmeat.txt ++ for d in $(SUBDIRS); do $(MAKE) -C $$d clean; done + + install: +- mkdir -m 0755 -p $(VAR) $(SBIN) $(MAN) $(ETC) $(BASHDIR) $(SHAREDIR) $(LIBDIR) ++ for d in $(SUBDIRS); do $(MAKE) -C $$d install; done ++ ++ mkdir -m 0755 -p $(DESTDIR)/$(VAR) $(DESTDIR)/$(SBIN) $(DESTDIR)/$(MAN) $(DESTDIR)/$(ETC) $(DESTDIR)/$(BASHDIR) $(DESTDIR)/$(LIBDIR) $(DESTDIR)/$(SYSTEMD_UNITDIR) + sed -e "s/\[INSERT_VERSION_HERE\]/$(RELEASE_VERSION)/" dkms > dkms.versioned + mv -f dkms.versioned dkms +- install -p -m 0755 dkms_common.postinst $(LIBDIR)/common.postinst +- install -p -m 0755 dkms $(SBIN) +- install -p -m 0755 dkms_autoinstaller $(LIBDIR) +- install -p -m 0644 dkms_framework.conf $(ETC)/framework.conf +- install -p -m 0644 dkms_dbversion $(VAR) +- install -p -m 0644 dkms.bash-completion $(BASHDIR)/dkms +- # install compressed manpage with proper timestamp and permissions +- 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 +- +-doc-perms: +- # ensure doc file permissions ok +- chmod 0644 $(DOCFILES) +- +-install-redhat-sysv: install doc-perms +- mkdir -m 0755 -p $(INITD) +- install -p -m 0755 dkms_mkkerneldoth $(LIBDIR)/mkkerneldoth +- install -p -m 0755 dkms_find-provides $(LIBDIR)/find-provides +- install -p -m 0755 lsb_release $(LIBDIR)/lsb_release +- install -p -m 0644 template-dkms-mkrpm.spec $(ETC) +- install -p -m 0644 template-dkms-redhat-kmod.spec $(ETC) +- install -p -m 0755 dkms_autoinstaller $(INITD) +- +-install-redhat-systemd: install doc-perms +- mkdir -m 0755 -p $(SYSTEMD) +- install -p -m 0755 dkms_mkkerneldoth $(LIBDIR)/mkkerneldoth +- install -p -m 0755 dkms_find-provides $(LIBDIR)/find-provides +- install -p -m 0755 lsb_release $(LIBDIR)/lsb_release +- install -p -m 0644 template-dkms-mkrpm.spec $(ETC) +- install -p -m 0644 template-dkms-redhat-kmod.spec $(ETC) +- install -p -m 0644 dkms.service $(SYSTEMD) +- +-install-doc: +- mkdir -m 0755 -p $(DOCDIR) +- install -p -m 0644 $(DOCFILES) $(DOCDIR) +- +-install-debian: install install-doc +- mkdir -p -m 0755 $(SHAREDIR)/apport/package-hooks +- install -p -m 0755 dkms_apport.py $(SHAREDIR)/apport/package-hooks/dkms_packages.py +- mkdir -p -m 0755 $(KCONF)/header_postinst.d +- install -p -m 0755 kernel_postinst.d_dkms $(KCONF)/header_postinst.d/dkms +- mkdir -p -m 0755 $(ETC)/template-dkms-mkdeb/debian +- ln -s template-dkms-mkdeb $(ETC)/template-dkms-mkdsc +- install -p -m 0664 template-dkms-mkdeb/Makefile $(ETC)/template-dkms-mkdeb/ +- install -p -m 0664 template-dkms-mkdeb/debian/* $(ETC)/template-dkms-mkdeb/debian/ +- chmod +x $(ETC)/template-dkms-mkdeb/debian/postinst +- chmod +x $(ETC)/template-dkms-mkdeb/debian/prerm +- chmod +x $(ETC)/template-dkms-mkdeb/debian/rules +- rm $(DOCDIR)/COPYING* +- rm $(DOCDIR)/sample* +- +-deb_destdir=$(BUILDDIR)/dist +-TARBALL=$(deb_destdir)/$(RELEASE_STRING).tar.gz +-tarball: $(TARBALL) +- +-$(TARBALL): +- mkdir -p $(deb_destdir) +- tmp_dir=`mktemp -d --tmpdir dkms.XXXXXXXX` ; \ +- cp -a ../$(RELEASE_NAME) $${tmp_dir}/$(RELEASE_STRING) ; \ +- sed -e "s/\[INSERT_VERSION_HERE\]/$(RELEASE_VERSION)/" dkms > $${tmp_dir}/$(RELEASE_STRING)/dkms ; \ +- sed -e "s/\[INSERT_VERSION_HERE\]/$(RELEASE_VERSION)/" dkms.spec > $${tmp_dir}/$(RELEASE_STRING)/dkms.spec ; \ +- find $${tmp_dir}/$(RELEASE_STRING) -depth -name .git -type d -exec rm -rf \{\} \; ; \ +- find $${tmp_dir}/$(RELEASE_STRING) -depth -name dist -type d -exec rm -rf \{\} \; ; \ +- find $${tmp_dir}/$(RELEASE_STRING) -depth -name \*~ -type f -exec rm -f \{\} \; ; \ +- find $${tmp_dir}/$(RELEASE_STRING) -depth -name dkms\*.rpm -type f -exec rm -f \{\} \; ; \ +- find $${tmp_dir}/$(RELEASE_STRING) -depth -name dkms\*.tar.gz -type f -exec rm -f \{\} \; ; \ +- find $${tmp_dir}/$(RELEASE_STRING) -depth -name dkms-freshmeat.txt -type f -exec rm -f \{\} \; ; \ +- rm -rf $${tmp_dir}/$(RELEASE_STRING)/debian ; \ +- sync ; sync ; sync ; \ +- tar cvzf $(TARBALL) -C $${tmp_dir} $(RELEASE_STRING); \ +- rm -rf $${tmp_dir} ; +- +- +-rpm: $(TARBALL) dkms.spec +- tmp_dir=`mktemp -d --tmpdir dkms.XXXXXXXX` ; \ +- mkdir -p $${tmp_dir}/{BUILD,RPMS,SRPMS,SPECS,SOURCES} ; \ +- cp $(TARBALL) $${tmp_dir}/SOURCES ; \ +- sed "s/\[INSERT_VERSION_HERE\]/$(RELEASE_VERSION)/" dkms.spec > $${tmp_dir}/SPECS/dkms.spec ; \ +- pushd $${tmp_dir} > /dev/null 2>&1; \ +- rpmbuild -ba --define "_topdir $${tmp_dir}" SPECS/dkms.spec ; \ +- popd > /dev/null 2>&1; \ +- cp $${tmp_dir}/RPMS/noarch/* $${tmp_dir}/SRPMS/* dist ; \ +- rm -rf $${tmp_dir} +- +-debmagic: $(TARBALL) +- mkdir -p dist/ +- ln -s $(TARBALL) $(DEB_TMP_BUILDDIR)/$(RELEASE_NAME)_$(RELEASE_VERSION).orig.tar.gz +- tar -C $(DEB_TMP_BUILDDIR) -xzf $(TARBALL) +- cp -ar debian $(DEB_TMP_BUILDDIR)/$(RELEASE_STRING)/debian +- chmod +x $(DEB_TMP_BUILDDIR)/$(RELEASE_STRING)/debian/rules +- cd $(DEB_TMP_BUILDDIR)/$(RELEASE_STRING) ; \ +- dch -v $(RELEASE_VERSION)-0 "New upstream version, $(RELEASE_VERSION)"; \ +- dpkg-buildpackage -D -b -rfakeroot ; \ +- dpkg-buildpackage -D -S -sa -rfakeroot ; \ +- mv ../$(RELEASE_NAME)_* $(TOPDIR)/dist/ ; \ +- cd - +- +-debs: +- tmp_dir=`mktemp -d --tmpdir dkms.XXXXXXXX` ; \ +- make debmagic DEB_TMP_BUILDDIR=$${tmp_dir} DIST=$(DIST); \ +- rm -rf $${tmp_dir} ++ install -p -m 0755 dkms_common.postinst $(DESTDIR)/$(LIBDIR)/common.postinst ++ install -p -m 0755 dkms $(DESTDIR)/$(SBIN) ++ install -p -m 0755 dkms_autoinstaller $(DESTDIR)/$(LIBDIR) ++ install -p -m 0644 dkms_framework.conf $(DESTDIR)/$(ETC)/framework.conf ++ install -p -m 0644 dkms_dbversion $(DESTDIR)/$(VAR) ++ install -p -m 0644 dkms.bash-completion $(DESTDIR)/$(BASHDIR)/dkms ++ install -p -m 0644 dkms.service $(DESTDIR)/$(SYSTEMD_UNITDIR) ++ gzip -c -9 dkms.8 > $(DESTDIR)/$(MAN)/dkms.8.gz ++ chmod 0644 $(DESTDIR)/$(MAN)/dkms.8.gz ++ touch --reference=dkms.8 $(DESTDIR)/$(MAN)/dkms.8.gz ++ mkdir -p -m 0755 $(DESTDIR)/$(KCONF)/prerm.d $(DESTDIR)/$(KCONF)/postinst.d ++ install -p -m 0755 kernel_prerm.d_dkms $(DESTDIR)/$(KCONF)/prerm.d/dkms ++ install -p -m 0755 kernel_postinst.d_dkms $(DESTDIR)/$(KCONF)/postinst.d/dkms + +-fm: +- sed -e "s/\[INSERT_VERSION_HERE\]/$(RELEASE_VERSION)/" dkms-freshmeat.txt.in > dkms-freshmeat.txt diff --git a/sys-kernel/dkms/files/dkms-2.3-systemd-service-fix.patch b/sys-kernel/dkms/files/dkms-2.3-systemd-service-fix.patch new file mode 100644 index 00000000..fe99ed25 --- /dev/null +++ b/sys-kernel/dkms/files/dkms-2.3-systemd-service-fix.patch @@ -0,0 +1,23 @@ +diff -Nur a/dkms.service b/dkms.service +--- a/dkms.service 2016-08-31 18:23:47.000000000 +0100 ++++ b/dkms.service 2017-05-21 11:52:28.087487858 +0100 +@@ -1,11 +1,15 @@ + [Unit] +-Description=Builds and install new kernel modules through DKMS +-Documentation=man:dkms(8) ++Description=DKMS Autoinstall service ++DefaultDependencies=no ++After=local-fs.target ++Conflicts=shutdown.target ++Before=basic.target shutdown.target + + [Service] ++ExecStart=/usr/lib/dkms/dkms_autoinstaller start + Type=oneshot +-RemainAfterExit=true +-ExecStart=/bin/sh -c 'dkms autoinstall --verbose --kernelver $(uname -r)' ++TimeoutSec=0 ++StandardInput=tty + + [Install] + WantedBy=multi-user.target diff --git a/sys-kernel/dkms/files/dkms.initd b/sys-kernel/dkms/files/dkms.initd new file mode 100644 index 00000000..3647ff49 --- /dev/null +++ b/sys-kernel/dkms/files/dkms.initd @@ -0,0 +1,18 @@ +#!/sbin/openrc-run +# Copyright 1999-2012 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +depend() { + need localmount + before net +} + +start() { + ebegin "Starting Dynamic Kernel Module Support " + /usr/lib/dkms/dkms_autoinstaller start + eend 0 +} + +status() { + /usr/lib/dkms/dkms_autoinstaller status +} -- cgit v1.2.3