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
Task Type Feature Request
Category Packages: Core
Status Closed
Assigned To Dave Reisner (falconindy)
Tom Gundersen (tomegun)
Christian Hesse (eworm)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 2
Private No

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 :)
Comment by Jean-Philippe Garcia Ballester (giga) - Thursday, 16 October 2014, 04:20 GMT
The category is wrong, it should be Packages: Core.

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.
Comment by Andrei Pozolotin (random-archer) - Monday, 23 May 2016, 15:08 GMT
additional change, required in my experience:
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")
Comment by Andrei Pozolotin (random-archer) - Saturday, 28 May 2016, 00:29 GMT

Loading...