Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions .SRCINFO
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
pkgbase = kernel-modules-hook
pkgdesc = Keeps your system fully functional after a kernel upgrade
pkgver = 0.1.7
pkgver = 0.1.8
pkgrel = 1
url = https://github.com/saber-nyan/kernel-modules-hook
install = kernel-modules-hook.install
arch = any
license = UNLICENSE
depends = rsync
source = linux-modules-cleanup.conf
source = linux-modules-cleanup.service
source = 10-linux-modules-post.hook
source = 10-linux-modules-pre.hook
source = UNLICENSE
sha256sums = 4169b44c297ddb7aad2220c6eba7c7942e3396f92528c59617955ab5560cb4cf
sha256sums = 5d947290ef8c94b33c79c531e5615f4c9bea38e7649092d34af3bf0af5b1ca24
sha256sums = 900502d030e925fca6188b9448fbaf6562d6e23cd5c50938cdf00522825f76c2
sha256sums = f7ea2947c3fbe1510b3ea5cc5793b8197f0718dcb12daea3da9b27b3cf1c4116
sha256sums = f8d3ee1fc95f9a6c754aed063cfb5d3b0d6dbd35eb5c310988881e16cf665345
sha256sums = 3b90321be042ea728e27bef530aeb22cecc4cd0aeda625ab4a72fb46dae3abee
sha256sums = dc99191391b847deecf81abded84b03eb832ca1b36e56a4a4deec8bf1332f051
sha256sums = 7e12e5df4bae12cb21581ba157ced20e1986a0508dd10d0e8a4ab9a4cf94e85c

pkgname = kernel-modules-hook
Expand Down
3 changes: 1 addition & 2 deletions 10-linux-modules-post.hook
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,4 @@ Target = usr/lib/modules/*/vmlinuz
Description = Restoring Linux kernel modules...
When = PostTransaction
Depends = coreutils
Depends = rsync
Exec = /bin/sh -xc 'KVER="${KVER:-$(uname -r)}"; if test -e "/usr/lib/modules/backup/${KVER}"; then rsync -AHXal --ignore-existing "/usr/lib/modules/backup/${KVER}" /usr/lib/modules/; fi; rm -rf /usr/lib/modules/backup'
Exec = /bin/sh -xc 'KVER="${KVER:-$(uname -r)}"; if test -e "/usr/lib/modules/backup/${KVER}"; then cp -ral "/usr/lib/modules/backup/${KVER}" /usr/lib/modules/; fi; rm -rf /usr/lib/modules/backup'
4 changes: 2 additions & 2 deletions 10-linux-modules-pre.hook
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ Target = usr/lib/modules/*/vmlinuz
[Action]
Description = Saving Linux kernel modules...
When = PreTransaction
Depends = rsync
Exec = /bin/sh -c 'KVER="${KVER:-$(uname -r)}"; if test -e "/usr/lib/modules/${KVER}"; then rsync -AHXal --delete-after "/usr/lib/modules/${KVER}" /usr/lib/modules/backup/; fi'
Depends = coreutils
Exec = /bin/sh -xc 'KVER="${KVER:-$(uname -r)}"; if test -e "/usr/lib/modules/${KVER}"; then mkdir -p /usr/lib/modules/backup; cp -ral "/usr/lib/modules/${KVER}" /usr/lib/modules/backup; fi'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With cp -ral you can actually drop the -r, as it is already included in the -a flag.

9 changes: 4 additions & 5 deletions PKGBUILD
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
# Maintainer: Artoria Pendragon <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.7
pkgver=0.1.8
pkgrel=1
pkgdesc="Keeps your system fully functional after a kernel upgrade"
arch=('any')
url="https://github.com/saber-nyan/kernel-modules-hook"
license=('UNLICENSE')
depends=('rsync')
install="${pkgname}.install"
source=("linux-modules-cleanup.conf"
"linux-modules-cleanup.service"
"10-linux-modules-post.hook"
"10-linux-modules-pre.hook"
"UNLICENSE")
sha256sums=('4169b44c297ddb7aad2220c6eba7c7942e3396f92528c59617955ab5560cb4cf'
'5d947290ef8c94b33c79c531e5615f4c9bea38e7649092d34af3bf0af5b1ca24'
'900502d030e925fca6188b9448fbaf6562d6e23cd5c50938cdf00522825f76c2'
'f7ea2947c3fbe1510b3ea5cc5793b8197f0718dcb12daea3da9b27b3cf1c4116'
'f8d3ee1fc95f9a6c754aed063cfb5d3b0d6dbd35eb5c310988881e16cf665345'
'3b90321be042ea728e27bef530aeb22cecc4cd0aeda625ab4a72fb46dae3abee'
'dc99191391b847deecf81abded84b03eb832ca1b36e56a4a4deec8bf1332f051'
'7e12e5df4bae12cb21581ba157ced20e1986a0508dd10d0e8a4ab9a4cf94e85c')

package() {
Expand Down
2 changes: 1 addition & 1 deletion linux-modules-cleanup.service
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ 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'
ExecStart=/bin/bash -exc 'for i in /usr/lib/modules/[0-9]*; do if [[ $${i##*/} = \'%v\' ]] || pacman -Qo "$${i}"; then continue; fi; mkdir -p /usr/lib/modules/.old; mv "$${i}" /usr/lib/modules/.old/; done'

[Install]
WantedBy=basic.target