FS#42396 - [systemd] Use units in /etc when generating initrd
Attached to Project:
Arch Linux
Opened by Jean-Philippe Garcia Ballester (giga) - Thursday, 16 October 2014, 01:51 GMT
Last edited by freswa (frederik) - Tuesday, 24 March 2020, 19:01 GMT
Opened by Jean-Philippe Garcia Ballester (giga) - Thursday, 16 October 2014, 01:51 GMT
Last edited by freswa (frederik) - Tuesday, 24 March 2020, 19:01 GMT
|
Details
The function 'add_systemd_unit' in the file
'/usr/lib/initcpio/install/systemd' searches for units and
dependencies only in '/usr/lib/systemd/system'.
It could be useful if it also added units in '/etc/systemd/system', as it would allow for easy configuration of initrd by user. Attached patch adds the feature. |
This task depends upon
Closed by freswa (frederik)
Tuesday, 24 March 2020, 19:01 GMT
Reason for closing: None
Additional comments about closing: This seems pretty stalled to me. If it's still an issue, please fill a re-open request. Thank you :)
Tuesday, 24 March 2020, 19:01 GMT
Reason for closing: None
Additional comments about closing: This seems pretty stalled to me. If it's still an issue, please fill a re-open request. Thank you :)
Also, to be more explicit on the use case:
When systemd is not used in initrd, if one wants to add a hook to mkinitcpio, he needs to add a script in /etc/initcpio/install what will add required files to the initrd image, and a script in /etc/initcpio/hooks that will run stuff at boot time.
When systemd is used in initrd, the script in /etc/initcpio/hooks is replaced by systemd units. When these units are written by the user, they are supposed to be in /etc/systemd/system, hence the need for the add_systemd_unit function to also look for units and dependencies in /etc.
https://bugs.archlinux.org/task/49441
2) (type -P "$1") does not work reliably with absolute paths, must use unit name (file name) instead:
unit=$(basename $1)
unit=$(PATH=/etc/systemd/system:/usr/lib/systemd/system:/lib/systemd/system type -P "$unit")
see function "add_systemd_unit_X()":
https://aur.archlinux.org/packages/mkinitcpio-systemd-tool/
https://aur.archlinux.org/cgit/aur.git/tree/mkinitcpio-install.sh?h=mkinitcpio-systemd-tool