summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorOliver Mangold2018-02-27 12:01:00 +0100
committerOliver Mangold2018-02-27 12:01:00 +0100
commitef68af96fd7ea01c71481aac2508caa7da488f59 (patch)
tree344f469c4ae3bc5af25067333d72cea30b593d54
downloadaur-ef68af96fd7ea01c71481aac2508caa7da488f59.tar.gz
initial release
-rw-r--r--.SRCINFO17
-rw-r--r--PKGBUILD22
-rw-r--r--kmodcache.conf1
-rw-r--r--kmodcache.service10
-rwxr-xr-xmake-kmod-cache8
-rwxr-xr-xmodprobe7
6 files changed, 65 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..2ded9bfeb907
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,17 @@
+pkgbase = kmodcache
+ pkgdesc = Scripts to make a copy of installed kernel modules, which will be used for on-demand loading from then point on, thus make reboots unnecessary after kernel updates.
+ pkgver = 1.0
+ pkgrel = 1
+ arch = any
+ license = GPL3
+ source = kmodcache.conf
+ source = modprobe
+ source = make-kmod-cache
+ source = kmodcache.service
+ sha256sums = SKIP
+ sha256sums = SKIP
+ sha256sums = SKIP
+ sha256sums = SKIP
+
+pkgname = kmodcache
+
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..65eb20bc6e9e
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,22 @@
+# Maintainer: Oliver Mangold <o.mangold@gmail.com>
+
+pkgname=kmodcache
+pkgver=1.0
+pkgrel=1
+pkgdesc="Scripts to make a copy of installed kernel modules, which will be used for on-demand loading from then point on, thus make reboots unnecessary after kernel updates."
+arch=('any')
+license=('GPL3')
+depends=()
+makedepends=()
+source=('kmodcache.conf' 'modprobe' 'make-kmod-cache' 'kmodcache.service')
+sha256sums=('SKIP' 'SKIP' 'SKIP' 'SKIP')
+
+package() {
+ #cd "${pkgname}"
+ install -m 755 -d "$pkgdir"/usr/lib/modules "$pkgdir"/etc/sysctl.d "$pkgdir"/usr/lib/systemd/system "$pkgdir"/usr/bin "$pkgdir"/usr/local/bin
+ install -m 755 make-kmod-cache "$pkgdir"/usr/bin
+ install -m 755 modprobe "$pkgdir"/usr/local/bin
+ install -m 644 kmodcache.conf "$pkgdir"/etc/sysctl.d
+ install -m 644 kmodcache.service "$pkgdir"/usr/lib/systemd/system
+ ln -s /var/cache/kmods "$pkgdir"/usr/lib/modules/cached
+}
diff --git a/kmodcache.conf b/kmodcache.conf
new file mode 100644
index 000000000000..03f70de9a847
--- /dev/null
+++ b/kmodcache.conf
@@ -0,0 +1 @@
+kernel.modprobe = /usr/local/bin/modprobe
diff --git a/kmodcache.service b/kmodcache.service
new file mode 100644
index 000000000000..ea983abb1de2
--- /dev/null
+++ b/kmodcache.service
@@ -0,0 +1,10 @@
+[Unit]
+Description=update modules cache for active kernel
+
+[Service]
+Type=oneshot
+ExecStart=/usr/bin/make-kmod-cache
+ExecRestart=/usr/bin/make-kmod-cache
+
+[Install]
+WantedBy=multi-user.target
diff --git a/make-kmod-cache b/make-kmod-cache
new file mode 100755
index 000000000000..22379d8a0939
--- /dev/null
+++ b/make-kmod-cache
@@ -0,0 +1,8 @@
+#!/bin/bash -e
+
+moddir=/lib/modules/`uname -r`
+[ -d "$moddir" ]
+rm -f /var/cache/kmods/osrelease
+rm -rf /var/cache/kmods
+cp -r -L --preserve=all --reflink=auto "$moddir" /var/cache/kmods
+cp -a /proc/sys/kernel/osrelease /var/cache/kmods/osrelease
diff --git a/modprobe b/modprobe
new file mode 100755
index 000000000000..97d4cf38f6f0
--- /dev/null
+++ b/modprobe
@@ -0,0 +1,7 @@
+#!/bin/bash
+
+if cmp /proc/sys/kernel/osrelease /var/cache/kmods/osrelease 2>/dev/null; then
+ exec /sbin/modprobe -S "cached" "$@"
+else
+ exec /sbin/modprobe "$@"
+fi