Please read this before reporting a bug:
https://wiki.archlinux.org/title/Bug_reporting_guidelines
Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.
REPEAT: Do NOT report bugs for outdated packages!
https://wiki.archlinux.org/title/Bug_reporting_guidelines
Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.
REPEAT: Do NOT report bugs for outdated packages!
FS#49460 - [systemd] add_systemd_unit should auto provision unit resources with help of ConditionPathExists
Attached to Project:
Arch Linux
Opened by Andrei Pozolotin (random-archer) - Tuesday, 24 May 2016, 22:01 GMT
Last edited by Eli Schwartz (eschwartz) - Thursday, 04 January 2018, 04:18 GMT
Opened by Andrei Pozolotin (random-archer) - Tuesday, 24 May 2016, 22:01 GMT
Last edited by Eli Schwartz (eschwartz) - Thursday, 04 January 2018, 04:18 GMT
|
Detailscurrently, add_systemd_unit can auto provision binaries:
https://git.archlinux.org/svntogit/packages.git/tree/trunk/initcpio-install-systemd?h=packages/systemd#n48 similar logic can also be applied in order to auto provision unit resources: 1) first, check if service unit contains entry ConditionPathExists=/etc/initrd-release https://www.freedesktop.org/software/systemd/man/systemd.unit.html that means it is a service that is expected to run only from initramfs 2) now look for other ConditionPathExists= entries * if they are already provisioned into initramfs, then good * else discover resource types and provision them from the host sample implementation could be: case $key in ConditionPathExists) # auto provision resources local path="${values[0]}" if [[ -e $BUILDROOT$path ]] ; then plain "use existing path $path" else plain "use resolved path $path" if [[ -e $path]] ; then if [[ -d $path]] ; then add_full_dir "$path" else add_file "$path" fi else error "missing path $path" fi fi ;; |
This task depends upon
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
Elsewhere:
- Please don't use the AUR as a code hosting site, and please provide patches rather than code dumps, so that it's actually possible to see what the changes are.
- Your code doesn't follow style -- we always use [[ instead of [.
- Lines like "result=$($command 2>&1)" or "unit_list=$(grep -l "$tag" $dir/*.service)" are simply not safe due to word splitting and glob expansion. "code=$(echo "${values[@]}")" is entirely nonsense. You need to learn to use arrays.
RE "I have no idea what InitrdBinary, InitrdPath, InitrdBuild, and InitrdCall are"
* yes, this is a new proposed feature for systemd mkinitcpio [add_systemd_unit()] function. if you are interested, I can elaborate more.
* no need to ask upstream, this will be arch-only X-$foo extension, for provisioning systemd resources in initrd with help of arch mkinitcpio
* the InitrdCall implementation actually works, I use it already
* I have documented this proposed extension here:
https://github.com/random-archer/mkinitcpio-systemd-tool/blob/master/README.md
https://wiki.archlinux.org/index.php/Dm-crypt/Specialties#Remote_unlocking_of_the_root_.28or_other.29_partition
RE "Elsewhere:"
* I moved the source to github https://github.com/random-archer/mkinitcpio-systemd-tool
* I applied your style request: https://github.com/random-archer/mkinitcpio-systemd-tool/blob/master/mkinitcpio-install.sh
* I improved my understanding of arrays (a little), thank you :-)
* I do not know how to improve "result=$($command 2>&1)" or "unit_list=$(grep -l "$tag" $dir/*.service)", any pointers much appreciated.
Thank you.