From: Kairui Song Date: Tue, 6 Aug 2019 07:39:31 +0000 (+0800) Subject: 99squash: Only start the cleaner on switch-root X-Git-Tag: 050~138 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5d88809319049eb06e3472dcd11cca9c4557d8c2;p=thirdparty%2Fdracut.git 99squash: Only start the cleaner on switch-root Currently it starts the cleaner early and do the clean up job if switch root is called. It's better to just start the service only on switch root to avoid any risk of service dependency failure and make is simpler. Signed-off-by: Kairui Song --- diff --git a/modules.d/99squash/module-setup.sh b/modules.d/99squash/module-setup.sh index bd4c922b3..b79afb903 100644 --- a/modules.d/99squash/module-setup.sh +++ b/modules.d/99squash/module-setup.sh @@ -25,5 +25,6 @@ install() { inst $moddir/init.sh /squash/init.sh inst "$moddir/squash-mnt-clear.service" "$systemdsystemunitdir/squash-mnt-clear.service" - ln_r "$systemdsystemunitdir/squash-mnt-clear.service" "$systemdsystemunitdir/initrd.target.wants/squash-mnt-clear.service" + mkdir -p "$initdir$systemdsystemunitdir/initrd-switch-root.target.wants" + ln_r "$systemdsystemunitdir/squash-mnt-clear.service" "$systemdsystemunitdir/initrd-switch-root.target.wants/squash-mnt-clear.service" } diff --git a/modules.d/99squash/squash-mnt-clear.service b/modules.d/99squash/squash-mnt-clear.service index f8d5db46f..84441f60a 100644 --- a/modules.d/99squash/squash-mnt-clear.service +++ b/modules.d/99squash/squash-mnt-clear.service @@ -4,17 +4,14 @@ [Unit] Description=Cleanup squashfs mounts when switch root DefaultDependencies=no -After=initrd.target -After=dracut-initqueue.service dracut-pre-pivot.service -Before=initrd-cleanup.service +Before=initrd-switch-root.service +After=initrd-switch-root.target ConditionPathExists=/squash/root -Conflicts=initrd-switch-root.target -IgnoreOnIsolate=true [Service] Type=oneshot -RemainAfterExit=yes +RemainAfterExit=no StandardInput=null StandardOutput=syslog+console StandardError=syslog+console -ExecStop=/squash/clear-squash.sh +ExecStart=/squash/clear-squash.sh