summarylogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.SRCINFO15
-rw-r--r--PKGBUILD21
-rw-r--r--boot-mirror.sh7
-rw-r--r--mirror-kernel.hook12
4 files changed, 55 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..8da83f56e4f6
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,15 @@
+pkgbase = boot-mirror
+ pkgdesc = Mirror /boot directory on kernel upgrades
+ pkgver = 1.0
+ pkgrel = 1
+ url = https://wiki.archlinux.org/index.php/User:Allan/Pacman_Hooks
+ arch = any
+ license = GPL
+ depends = rsync
+ source = boot-mirror.sh
+ source = mirror-kernel.hook
+ sha256sums = b97d290f26268acbb925a1f699bb0f692c4a511d04d0898b88564196fdfeb7b7
+ sha256sums = 7b7646179a215721a3c69449e20fc108aa91e97398346761fdd95af2e75fda86
+
+pkgname = boot-mirror
+
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..b9493e18275b
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,21 @@
+# Maintainer: Marc Aldorasi <m101010a at gmail dot com>
+pkgname=boot-mirror
+pkgver=1.0
+pkgrel=1
+pkgdesc="Mirror /boot directory on kernel upgrades"
+arch=('any')
+url="https://wiki.archlinux.org/index.php/User:Allan/Pacman_Hooks"
+license=('GPL')
+depends=('rsync')
+source=("boot-mirror.sh"
+ "mirror-kernel.hook")
+sha256sums=("b97d290f26268acbb925a1f699bb0f692c4a511d04d0898b88564196fdfeb7b7"
+ "7b7646179a215721a3c69449e20fc108aa91e97398346761fdd95af2e75fda86")
+
+package() {
+ install -m755 -d "${pkgdir}/etc/pacman.d/hooks"
+ install -m 644 "${srcdir}/mirror-kernel.hook" "${pkgdir}/etc/pacman.d/hooks/mirror-kernel.hook"
+ install -m755 -d "${pkgdir}/usr/bin"
+ install -m 755 "${srcdir}/boot-mirror.sh" "${pkgdir}/usr/bin/boot-mirror.sh"
+}
+
diff --git a/boot-mirror.sh b/boot-mirror.sh
new file mode 100644
index 000000000000..26126793fc1b
--- /dev/null
+++ b/boot-mirror.sh
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+n=2
+while [ -d /boot$n ]; do
+ rsync -ra --delete /boot/ /boot$n/
+ n=$((n+1))
+done
diff --git a/mirror-kernel.hook b/mirror-kernel.hook
new file mode 100644
index 000000000000..3367e4c286a1
--- /dev/null
+++ b/mirror-kernel.hook
@@ -0,0 +1,12 @@
+[Trigger]
+Operation = Install
+Operation = Upgrade
+Operation = Remove
+Type = Package
+Target = linux
+
+[Action]
+Depends = rsync
+When = PostTransaction
+Exec = /usr/bin/boot-mirror.sh
+