[arch-dev-public] [PATCH] Implement a hook-system that allows to add custom code to the initscripts at certain places

Thomas Bächler thomas at archlinux.org
Tue Aug 25 11:38:18 EDT 2009

Aaron Griffin schrieb:
> I read through this, and was a little bit hesitant on this functionality.
> But then I gave in. Something about it feels weird to me, but if we
> just get it in there, it can be improved incrementally.

What exactly feels weird? It's the best solution I could come up with that
a) doesn't add any new stuff (like new directories, files, concepts, we 
just use functions.d)
b) works when multiple packages want to plug into the same hook

The original suggestion from Michael is here:

--- a/functions
+++ b/functions
@@ -229,6 +229,15 @@ ck_status() {

+# 'Hooks' are optional code snippets supplied in files in
+# directory /etc/rc.d/hooks.d. The single argument
+# is the hook's filename. If a hook doesn't exist
+# nothing happens ...
+hook() {
+  if [ -f /etc/rc.d/hooks.d/$1 ]; then
+    . /etc/rc.d/hooks.d/$1
+  fi

  #Source additional functions at the end to allow overrides
  for f in /etc/rc.d/functions.d/*; do

I don't like that one at all, as it fulfills none of the above requirements.

Then I added one that just defines a bunch of hook_whatever() functions, 
but then one package could override another package's hook.

 > Would it be useful to look into the stages/names that debian uses for
 > their hooks system? Check their initramfs tools for their naming
 > (there's a lot).

Hmm, are you talking about naming of the hooks? I would accept any 
change proposal on those.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 260 bytes
Desc: OpenPGP digital signature
URL: <http://www.archlinux.org/pipermail/arch-dev-public/attachments/20090825/8b627015/attachment.pgp>

More information about the arch-dev-public mailing list