diff options
author | saber-nyan | 2017-12-24 03:07:53 +0300 |
---|---|---|
committer | saber-nyan | 2017-12-24 14:08:54 +0300 |
commit | 61f4bb6429de7546ca39562c6c0c0aa93460907b (patch) | |
tree | 490ccb15fa12e01d2267c7e423813a57a1df0249 | |
download | aur-61f4bb6429de7546ca39562c6c0c0aa93460907b.tar.gz |
First commit
Added hooks and Arch Linux PKGBUILD + .SRCINFO
-rw-r--r-- | .SRCINFO | 20 | ||||
-rw-r--r-- | PKGBUILD | 31 | ||||
-rw-r--r-- | kernel-modules-hook.install | 16 | ||||
-rw-r--r-- | linux-modules-cleanup.conf | 1 | ||||
-rw-r--r-- | linux-modules-cleanup.service | 9 | ||||
-rw-r--r-- | linux-modules-post.hook | 14 | ||||
-rw-r--r-- | linux-modules-pre.hook | 14 |
7 files changed, 105 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..d86c0939b943 --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,20 @@ +pkgbase = kernel-modules-hook + pkgdesc = Keeps your system fully functional after a kernel upgrade + pkgver = 0.1.1 + pkgrel = 1 + url = https://github.com/saber-nyan/kernel-modules-hook + install = kernel-modules-hook.install + arch = any + license = unknown + depends = rsync + source = linux-modules-cleanup.conf + source = linux-modules-cleanup.service + source = linux-modules-post.hook + source = linux-modules-pre.hook + sha256sums = 4169b44c297ddb7aad2220c6eba7c7942e3396f92528c59617955ab5560cb4cf + sha256sums = 5d947290ef8c94b33c79c531e5615f4c9bea38e7649092d34af3bf0af5b1ca24 + sha256sums = 39a124a4fb5cf3f2cace0bd5bd203a6d5d78aac1eb7dfb7610b91839281ac58b + sha256sums = 86cedb612d06f618beb0b47a06d78fe1a34e726ceb213dfa6ba498415c1e53b4 + +pkgname = kernel-modules-hook + diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..3185f0e5f370 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,31 @@ +# Maintainer: saber-nyan <saber-nyan@ya.ru> +# Hooks: https://www.reddit.com/r/archlinux/comments/4zrsc3/keep_your_system_fully_functional_after_a_kernel/d6yin0r/ +pkgname=kernel-modules-hook +pkgver=0.1.1 +pkgrel=1 +pkgdesc="Keeps your system fully functional after a kernel upgrade" +arch=('any') +url="https://github.com/saber-nyan/kernel-modules-hook" +license=('unknown') +depends=('rsync') +install="${pkgname}.install" +source=( + "linux-modules-cleanup.conf" + "linux-modules-cleanup.service" + "linux-modules-post.hook" + "linux-modules-pre.hook" + ) +sha256sums=( + "4169b44c297ddb7aad2220c6eba7c7942e3396f92528c59617955ab5560cb4cf" + "5d947290ef8c94b33c79c531e5615f4c9bea38e7649092d34af3bf0af5b1ca24" + "39a124a4fb5cf3f2cace0bd5bd203a6d5d78aac1eb7dfb7610b91839281ac58b" + "86cedb612d06f618beb0b47a06d78fe1a34e726ceb213dfa6ba498415c1e53b4" + ) + +package() { + cd "$pkgname-$pkgver" + install -Dm644 'linux-modules-cleanup.conf' "${pkgdir}/usr/lib/tmpfiles.d/linux-modules-cleanup.conf" + install -Dm644 'linux-modules-cleanup.service' "${pkgdir}/usr/lib/systemd/system/linux-modules-cleanup.service" + install -Dm644 'linux-modules-post.hook' "${pkgdir}/usr/share/libalpm/hooks/linux-modules-post.hook" + install -Dm644 'linux-modules-pre.hook' "${pkgdir}/usr/share/libalpm/hooks/linux-modules-pre.hook" +} diff --git a/kernel-modules-hook.install b/kernel-modules-hook.install new file mode 100644 index 000000000000..b0af4a3ce954 --- /dev/null +++ b/kernel-modules-hook.install @@ -0,0 +1,16 @@ +post_install() { + cat << EOF + +Please execute + + $ sudo systemctl daemon-reload + $ sudo systemctl enable linux-modules-cleanup + +Report any issues to: +https://github.com/saber-nyan/kernel-modules-hook/issues + + + ~desu + +EOF +} diff --git a/linux-modules-cleanup.conf b/linux-modules-cleanup.conf new file mode 100644 index 000000000000..80bc0cf896e7 --- /dev/null +++ b/linux-modules-cleanup.conf @@ -0,0 +1 @@ +R! /usr/lib/modules/.old/* - - - 4w diff --git a/linux-modules-cleanup.service b/linux-modules-cleanup.service new file mode 100644 index 000000000000..35a60dc2b3bb --- /dev/null +++ b/linux-modules-cleanup.service @@ -0,0 +1,9 @@ +[Unit] +Description=Clean up modules from old kernels + +[Service] +Type=oneshot +ExecStart=/bin/bash -exc 'for i in /usr/lib/modules/[0-9]*; do if [[ $${i##*/} = \'%v\' ]] || pacman -Qo "$${i}"; then continue; fi; rsync -AHXal "$${i}" /usr/lib/modules/.old/; rm -rf "$${i}"; done' + +[Install] +WantedBy=basic.target diff --git a/linux-modules-post.hook b/linux-modules-post.hook new file mode 100644 index 000000000000..b4d15d1ae8ce --- /dev/null +++ b/linux-modules-post.hook @@ -0,0 +1,14 @@ +[Trigger] +Operation = Upgrade +Type = Package +Target = linux +Target = linux-hardened +Target = linux-lts +Target = linux-zen + +[Action] +Description = Restore Linux kernel modules +When = PostTransaction +Depends = coreutils +Depends = rsync +Exec = /bin/sh -xc 'KVER="${KVER:-$(uname -r)}"; if test -e "/lib/modules/backup/${KVER}"; then rsync -AHXal --ignore-existing "/lib/modules/backup/${KVER}" /lib/modules/; fi; rm -rf /lib/modules/backup' diff --git a/linux-modules-pre.hook b/linux-modules-pre.hook new file mode 100644 index 000000000000..257f5f5ac039 --- /dev/null +++ b/linux-modules-pre.hook @@ -0,0 +1,14 @@ +[Trigger] +Operation = Upgrade +Type = Package +Target = linux +Target = linux-hardened +Target = linux-lts +Target = linux-zen + + +[Action] +Description = Save Linux kernel modules +When = PreTransaction +Depends = rsync +Exec = /bin/sh -c 'KVER="${KVER:-$(uname -r)}"; if test -e "/lib/modules/${KVER}"; then rsync -AHXal --delete-after "/lib/modules/${KVER}" /lib/modules/backup/; fi' |