aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2013-11-04 12:26:21 +0100
committerGravatar Christian Hesse <mail@eworm.de>2013-11-04 12:26:21 +0100
commit8670d1284bb8ec42bb305680eac91a919b78ae3f (patch)
tree3270654528f684fee9e66dfd2bba40062a5323e0
parent6c2c8c8cf708c9d7ed758d9062d7e1791dcdb73c (diff)
downloadpacredir-8670d1284bb8ec42bb305680eac91a919b78ae3f.tar.gz
pacredir-8670d1284bb8ec42bb305680eac91a919b78ae3f.tar.zst
add initcpio hook
-rw-r--r--Makefile2
-rw-r--r--initcpio/hook/paccache11
-rw-r--r--initcpio/install/paccache9
3 files changed, 22 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index 4c8afa6..1991c75 100644
--- a/Makefile
+++ b/Makefile
@@ -47,6 +47,8 @@ install-bin: pacredir
$(INSTALL) -D -m0644 systemd/pacserve.service $(DESTDIR)/usr/lib/systemd/system/pacserve.service
$(INSTALL) -D -m0644 systemd/pacdbserve.service $(DESTDIR)/usr/lib/systemd/system/pacdbserve.service
$(INSTALL) -D -m0644 systemd/pacredir.service $(DESTDIR)/usr/lib/systemd/system/pacredir.service
+ $(INSTALL) -D -m0644 initcpio/hook/paccache $(DESTDIR)/usr/lib/initcpio/hooks/paccache
+ $(INSTALL) -D -m0644 initcpio/install/paccache $(DESTDIR)/usr/lib/initcpio/install/paccache
$(INSTALL) -D -m0755 dhcpcd/80-pacredir $(DESTDIR)/usr/lib/dhcpcd/dhcpcd-hooks/80-pacredir
install-doc: README.html
diff --git a/initcpio/hook/paccache b/initcpio/hook/paccache
new file mode 100644
index 0000000..8aa2fc0
--- /dev/null
+++ b/initcpio/hook/paccache
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+run_latehook() {
+ local newroot="/new_root/"
+
+ if [[ -n "${paccache}" ]]; then
+ msg ":: Adding paccache host '${paccache}' to pacredir.conf..."
+ echo "pacserve hosts = ${paccache}" >> ${newroot}/etc/pacredir.conf
+ echo "pacdbserve hosts = ${paccache}" >> ${newroot}/etc/pacredir.conf
+ fi
+}
diff --git a/initcpio/install/paccache b/initcpio/install/paccache
new file mode 100644
index 0000000..1cb06a4
--- /dev/null
+++ b/initcpio/install/paccache
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+build() {
+ add_runscript
+}
+
+help() {
+ echo "This hook adds Server to pacredir.conf from inside initramfs."
+}