]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
99squash: Only start the cleaner on switch-root
authorKairui Song <kasong@redhat.com>
Tue, 6 Aug 2019 07:39:31 +0000 (15:39 +0800)
committerHarald Hoyer <harald@hoyer.xyz>
Wed, 23 Oct 2019 12:40:24 +0000 (14:40 +0200)
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 <kasong@redhat.com>
modules.d/99squash/module-setup.sh
modules.d/99squash/squash-mnt-clear.service

index bd4c922b37b43e72d4a0ee0a00fe60800037bb89..b79afb903ea149b6910c25afd4541e12561945ce 100644 (file)
@@ -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"
 }
index f8d5db46fcb6e7737050f00668304d08b5d32441..84441f60a1b29d29aa2dd1ef3695daa8e35283a1 100644 (file)
@@ -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