update: kernel-modules-hook-hardlinks

This commit is contained in:
JerryXiao 2023-04-02 11:05:50 +08:00
parent bbb9f075a9
commit 512e59c17d
Signed by: Jerry
GPG key ID: 22618F758B5BE2E5
4 changed files with 7 additions and 7 deletions

View file

@ -10,19 +10,19 @@ provides=("$_pkgname")
url="https://github.com/VannTen/$_pkgname"
license=('GPL3')
source=("linux-modules-cleanup.conf"
"10-linux-modules-post.hook"
"10-linux-modules-pre.hook"
"61-linux-modules-post.hook"
"linux-modules-restore"
"linux-modules-save"
)
sha256sums=('950f851eba08dac4d0b93ff62b3fb16ddacd4f8ebb98a2435f80bf05f2ea5a29'
'fc4d53dec520c80fe97dfda65b238c7d678e7ef26aaebffc5b43f924477ea4f4'
'087e5ed70b2fc512d814fbded9e873955b1da5b6bf1e31975174d704ad143156'
'28b995f6ea62899620d43d71e542bfc3432ad3ce90a6582f4ded1173fe8c0837'
'5d9092689d9baa3d8e5ac65ae92d1c201e23c4ef42c99d131f9465c99d6505ef')
'fc4d53dec520c80fe97dfda65b238c7d678e7ef26aaebffc5b43f924477ea4f4'
'a6e3013f04f45e6d1ed63b4545fb0d4f102d230db582bec76568dbf40c529fbb'
'36a8ab6bcb3e0bf8c82324877471ec8798e5ae273b26bdfbc4b6f59035af0351')
package() {
install -Dm644 'linux-modules-cleanup.conf' "${pkgdir}/usr/lib/tmpfiles.d/linux-modules-cleanup.conf"
install -Dm644 10-linux-modules-{pre,post}.hook -t "${pkgdir}/usr/share/libalpm/hooks/"
install -Dm644 10-linux-modules-pre.hook 61-linux-modules-post.hook -t "${pkgdir}/usr/share/libalpm/hooks/"
install -Dm755 linux-modules-{save,restore} -t "${pkgdir}/usr/share/libalpm/scripts/"
}

View file

@ -3,7 +3,7 @@
kver=$(uname -r)
while read -r line; do
# We only care about the running kernel
if [[ "$line" == usr/lib/modules/$kver/vmlinuz && -d "${line/$kver/running-kernel}" ]];then
if [[ "$line" == usr/lib/modules/$kver/vmlinuz && -d usr/lib/modules/running-kernel ]];then
mount --mkdir --bind --options ro /usr/lib/modules/{running-kernel,$kver}
# Mounting read-only since the only modification here should be unmounting
# when rebooting or reinstalling the running kernel

View file

@ -15,7 +15,7 @@ while read -r line; do
#
# This is the removal case, so we save the kernel
mkdir /usr/lib/modules/running-kernel
cp --archive --link /usr/lib/modules/{$kver}/{kernel,modules*} \
cp --archive --link --no-target-directory /usr/lib/modules/${kver}/ \
/usr/lib/modules/running-kernel/
fi
# If we are re-removing the running kernel, (after removing + reinstalling),