summarylogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.SRCINFO6
-rw-r--r--PKGBUILD6
-rwxr-xr-xpost-hook15
-rwxr-xr-xpre-hook2
4 files changed, 21 insertions, 8 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 7b44a933dd2..e7b314875db 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,6 +1,6 @@
pkgbase = saved-kernel-modules
pkgdesc = Save kernel modules of the running kernel
- pkgver = 0.1
+ pkgver = 0.2
pkgrel = 1
install = saved-kernel-modules.install
arch = i686
@@ -15,8 +15,8 @@ pkgbase = saved-kernel-modules
source = saved-kernel-modules.timer
source = 50-save-kernel-modules-pre.hook
source = 90-save-kernel-modules-post.hook
- md5sums = 274488fa3e34c36ab2c163bf21a880be
- md5sums = 947db382e3e874d19a5c05be18193552
+ md5sums = f821782df7a0588897661a1e2426b96a
+ md5sums = b3266b577aca38b3576452e44e36f513
md5sums = f71b096bfc811eb7a043e47e39a9a103
md5sums = f5741018c8b49127af92c78ab89a3412
md5sums = c1768f4613b5f21ac3d5b5966816b062
diff --git a/PKGBUILD b/PKGBUILD
index 1f466713106..479420c3a13 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,6 +1,6 @@
# Maintainer: Jonathan Kotta <jpkotta@gmail.com>
pkgname=saved-kernel-modules
-pkgver=0.1
+pkgver=0.2
pkgrel=1
pkgdesc="Save kernel modules of the running kernel"
arch=('i686' 'x86_64')
@@ -12,8 +12,8 @@ changelog=
source=(pre-hook post-hook cleanup README
saved-kernel-modules.service saved-kernel-modules.timer
50-save-kernel-modules-pre.hook 90-save-kernel-modules-post.hook)
-md5sums=('274488fa3e34c36ab2c163bf21a880be'
- '947db382e3e874d19a5c05be18193552'
+md5sums=('f821782df7a0588897661a1e2426b96a'
+ 'b3266b577aca38b3576452e44e36f513'
'f71b096bfc811eb7a043e47e39a9a103'
'f5741018c8b49127af92c78ab89a3412'
'c1768f4613b5f21ac3d5b5966816b062'
diff --git a/post-hook b/post-hook
index 91fb9cac846..479bc5c156d 100755
--- a/post-hook
+++ b/post-hook
@@ -8,7 +8,18 @@ cd /usr/lib/modules/saved-kernel-modules
running_kernel=$(uname -r)
-if [ -e modules/"$running_kernel" ] \
- && [ ! -e /usr/lib/modules/"$running_kernel" ] ; then
+if [ -e modules/"$running_kernel" ] ; then
+ if [ -L /usr/lib/modules/"$running_kernel" ] ; then
+ # symlink already there, do nothing
+ exit 0
+ elif [ -d /usr/lib/modules/"$running_kernel" ] ; then
+ # leftover for some reason, make a backup
+ suffix="bck-$(date -u +%FT%T)"
+ mv /usr/lib/modules/"$running_kernel" \
+ /usr/lib/modules/"$running_kernel-${suffix}"
+ echo "This directory was backed up by saved-kernel-modules, it's probably safe to delete." \
+ > /usr/lib/modules/"$running_kernel-${suffix}"/DELETE_THIS_DIR
+ fi
+
ln -s $PWD/modules/"$running_kernel" /usr/lib/modules/"$running_kernel"
fi
diff --git a/pre-hook b/pre-hook
index 8c9a43300ef..dbde00d5d7c 100755
--- a/pre-hook
+++ b/pre-hook
@@ -18,5 +18,7 @@ if [ -e modules/"$running_kernel" ] ; then
exit 0
fi
+mkdir -p modules
+
# copy with hardlinks, much faster
cp --archive --link /usr/lib/modules/"$running_kernel" modules/