The mkinitcpio add_runscript does not add a runtime script to the initcpio image. The result is that none of the runtime hooks actually run during startup.
Following are the steps to reproduce the issue.
Create a build hook
sudo nano /usr/lib/initcpio/install/customhook1
$this->bbcode_second_pass_code('', '
#!/bin/bash
build() {
echo "Build hook customhook1 called"
add_runscript
}
help() {
cat <<HELPEOF
Help message for customhook1.
HELPEOF
}
')
Create a runtime hook
sudo nano /usr/lib/initcpio/hooks/customhook1
$this->bbcode_second_pass_code('', '
#!/usr/bin/ash
run_hook() {
echo "Runtime hook customhook1 called"
}
')
Add the hook to mkinitcpio.conf
sudo nano /etc/mkinitcpio.conf
$this->bbcode_second_pass_code('', '
HOOKS="customhook1 base udev autodetect modconf block filesystems keyboard fsck customhook1"
')
Generate new initcpio image
$this->bbcode_second_pass_code('', 'sudo mkinitcpio -p linux-odroid-c2')
The output from the above command is as follows
$this->bbcode_second_pass_code('', '
==> Building image from preset: /etc/mkinitcpio.d/linux-odroid-c2.preset: 'defau
lt'
-> -k 3.14.79-27-ARCH -c /etc/mkinitcpio.conf -g /boot/initramfs-linux.img
==> Starting build: 3.14.79-27-ARCH
-> Running build hook: [customhook1]
Build hook customhook1 called
-> Running build hook: [base]
-> Running build hook: [udev]
-> Running build hook: [autodetect]
-> Running build hook: [modconf]
-> Running build hook: [block]
-> Running build hook: [filesystems]
-> Running build hook: [keyboard]
-> Running build hook: [fsck]
==> Generating module dependencies
==> Creating gzip-compressed initcpio image: /boot/initramfs-linux.img
')
Upon restart the console output should print Runtime hook customhook1 called. However, the produced console output indicates that the customhook1 hook does not run (simply search for customhook1 to verify).