systemctl -q --root "$initdir" add-wants X.target X.service is the recommanded way to add service dependency, and it covers more corner cases. --- dracut-module-setup.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh index ec1ccc5..21f7105 100755 --- a/dracut-module-setup.sh +++ b/dracut-module-setup.sh @@ -849,8 +849,7 @@ install() { inst "/lib/kdump/kdump-logger.sh" "/lib/kdump-logger.sh" inst "$moddir/kdump.sh" "/usr/bin/kdump.sh" inst "$moddir/kdump-capture.service" "$systemdsystemunitdir/kdump-capture.service" - mkdir -p "$initdir/$systemdsystemunitdir/initrd.target.wants" - ln_r "$systemdsystemunitdir/kdump-capture.service" "$systemdsystemunitdir/initrd.target.wants/kdump-capture.service" + systemctl -q --root "$initdir" add-wants initrd.target kdump-capture.service inst "$moddir/kdump-error-handler.sh" "/usr/bin/kdump-error-handler.sh" inst "$moddir/kdump-error-handler.service" "$systemdsystemunitdir/kdump-error-handler.service" # Replace existing emergency service and emergency target
On Mon, Dec 14, 2020 at 03:12:30PM +0800, Kairui Song wrote:
systemctl -q --root "$initdir" add-wants X.target X.service is the recommanded way to add service dependency, and it covers more corner cases.
dracut-module-setup.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh index ec1ccc5..21f7105 100755 --- a/dracut-module-setup.sh +++ b/dracut-module-setup.sh @@ -849,8 +849,7 @@ install() { inst "/lib/kdump/kdump-logger.sh" "/lib/kdump-logger.sh" inst "$moddir/kdump.sh" "/usr/bin/kdump.sh" inst "$moddir/kdump-capture.service" "$systemdsystemunitdir/kdump-capture.service"
- mkdir -p "$initdir/$systemdsystemunitdir/initrd.target.wants"
- ln_r "$systemdsystemunitdir/kdump-capture.service" "$systemdsystemunitdir/initrd.target.wants/kdump-capture.service"
- systemctl -q --root "$initdir" add-wants initrd.target kdump-capture.service inst "$moddir/kdump-error-handler.sh" "/usr/bin/kdump-error-handler.sh" inst "$moddir/kdump-error-handler.service" "$systemdsystemunitdir/kdump-error-handler.service" # Replace existing emergency service and emergency target
-- 2.29.2
Acked-by: Pingfan Liu piliu@redhat.com