Harald Hoyer 9d5d75
From 095e1f37c41e8995c95635a47dbe2bf61d8ee2bc Mon Sep 17 00:00:00 2001
Harald Hoyer 9d5d75
From: Kairui Song <kasong@redhat.com>
Harald Hoyer 9d5d75
Date: Tue, 11 Sep 2018 19:32:24 +0800
Harald Hoyer 9d5d75
Subject: [PATCH] Add support for building a squashed initramfs
Harald Hoyer 9d5d75
Harald Hoyer 9d5d75
With all files stored in ramfs, and most of them are not compressed,
Harald Hoyer 9d5d75
the initramfs will take up a lot of memory. Besides, if the file number
Harald Hoyer 9d5d75
is large, each file will waste some memory due to page fragmetation.
Harald Hoyer 9d5d75
This is due to ramfs' design, at least one page will be allocated for
Harald Hoyer 9d5d75
one file however small the file is. On machine with large page size,
Harald Hoyer 9d5d75
this will become worse and waste too many memory.
Harald Hoyer 9d5d75
Harald Hoyer 9d5d75
One approach to reducing the memory usage is to reduce the number of
Harald Hoyer 9d5d75
files that got directly loaded into the root ramfs, and compress files
Harald Hoyer 9d5d75
by put most files will into a read-only squash image and keep a minimum
Harald Hoyer 9d5d75
set of executable and libraries outside as the loader for the squash
Harald Hoyer 9d5d75
image. After the squash image is mounted, the real 'init' will be
Harald Hoyer 9d5d75
executed and then everything behaves as usual.
Harald Hoyer 9d5d75
Harald Hoyer 9d5d75
This patch will introduce a '99squash' module which will never be
Harald Hoyer 9d5d75
included by default. User can force add it, and if it is included,
Harald Hoyer 9d5d75
dracut will perform some extra steps before creating the final image:
Harald Hoyer 9d5d75
Harald Hoyer 9d5d75
For now, "/etc" and "/usr" will be moved into the squashfs image.
Harald Hoyer 9d5d75
"/init" will be renamed to "/init.stock" and replaced by "/init.squash".
Harald Hoyer 9d5d75
Files and folders need to be accessible before mounting the image will
Harald Hoyer 9d5d75
be still avaliable at their original place. And due to squashfs is
Harald Hoyer 9d5d75
readonly, an overlayfs layer will be created on top of squashfs mount
Harald Hoyer 9d5d75
point, as many dracut module require readwrite access to "/etc" and
Harald Hoyer 9d5d75
"/usr", "init.squash" will ultimately call "/init.stock".
Harald Hoyer 9d5d75
Harald Hoyer 9d5d75
An extra systemd service will be installed. This service will umount all
Harald Hoyer 9d5d75
squashfs related mount points right before switch-root to release
Harald Hoyer 9d5d75
resources properly. This service will not actually do anything if
Harald Hoyer 9d5d75
switch-root is not used.
Harald Hoyer 9d5d75
Harald Hoyer 9d5d75
This is very helpful when mem resource is very limited, like Kdump.
Harald Hoyer 9d5d75
According to my tests, this squash module can help save about 35MB of
Harald Hoyer 9d5d75
memory with 64K page size, or about 15MB with 4K page size on an
Harald Hoyer 9d5d75
ordinary kdump capture routine. This module could also help reduce
Harald Hoyer 9d5d75
memory usage for normal boot up process.
Harald Hoyer 9d5d75
Harald Hoyer 9d5d75
Won't change any behavior if squash module is not enabled.
Harald Hoyer 9d5d75
Harald Hoyer 9d5d75
Signed-off-by: Kairui Song <kasong@redhat.com>
Harald Hoyer 9d5d75
---
Harald Hoyer 9d5d75
 dracut.sh                                   | 114 ++++++++++++++++++++++++++++
Harald Hoyer 9d5d75
 modules.d/99squash/clear-squash.sh          |   9 +++
Harald Hoyer 9d5d75
 modules.d/99squash/init.sh                  |   7 ++
Harald Hoyer 9d5d75
 modules.d/99squash/module-setup.sh          |  29 +++++++
Harald Hoyer 9d5d75
 modules.d/99squash/setup-squash.sh          |  61 +++++++++++++++
Harald Hoyer 9d5d75
 modules.d/99squash/shutdown.sh              |   7 ++
Harald Hoyer 9d5d75
 modules.d/99squash/squash-mnt-clear.service |  19 +++++
Harald Hoyer 9d5d75
 7 files changed, 246 insertions(+)
Harald Hoyer 9d5d75
Harald Hoyer 9d5d75
diff --git a/dracut.sh b/dracut.sh
Harald Hoyer 9d5d75
index 8ee8c168..e683a9bc 100755
Harald Hoyer 9d5d75
--- a/dracut.sh
Harald Hoyer 9d5d75
+++ b/dracut.sh
Harald Hoyer 9d5d75
@@ -1747,6 +1747,120 @@ fi
Harald Hoyer 9d5d75
 
Harald Hoyer 9d5d75
 dinfo "*** Creating image file '$outfile' ***"
Harald Hoyer 9d5d75
 
Harald Hoyer 9d5d75
+if dracut_module_included "squash"; then
Harald Hoyer 9d5d75
+    if ! check_kernel_config CONFIG_SQUASHFS; then
Harald Hoyer 9d5d75
+        dfatal "CONFIG_SQUASHFS have to be enabled for dracut squash module to work"
Harald Hoyer 9d5d75
+        exit 1
Harald Hoyer 9d5d75
+    fi
Harald Hoyer 9d5d75
+    if ! check_kernel_config CONFIG_OVERLAY_FS; then
Harald Hoyer 9d5d75
+        dfatal "CONFIG_OVERLAY_FS have to be enabled for dracut squash module to work"
Harald Hoyer 9d5d75
+        exit 1
Harald Hoyer 9d5d75
+    fi
Harald Hoyer 9d5d75
+    if ! check_kernel_config CONFIG_DEVTMPFS; then
Harald Hoyer 9d5d75
+        dfatal "CONFIG_DEVTMPFS have to be enabled for dracut squash module to work"
Harald Hoyer 9d5d75
+        exit 1
Harald Hoyer 9d5d75
+    fi
Harald Hoyer 9d5d75
+
Harald Hoyer 9d5d75
+    readonly squash_dir="${DRACUT_TMPDIR}/squashfs"
Harald Hoyer 9d5d75
+    readonly squash_img=$initdir/squash/root.img
Harald Hoyer 9d5d75
+
Harald Hoyer 9d5d75
+    # Currently only move "usr" "etc" to squashdir
Harald Hoyer 9d5d75
+    readonly squash_candidate=( "usr" "etc" )
Harald Hoyer 9d5d75
+
Harald Hoyer 9d5d75
+    mkdir -m 0755 -p $squash_dir
Harald Hoyer 9d5d75
+    for folder in "${squash_candidate[@]}"; do
Harald Hoyer 9d5d75
+        mv $initdir/$folder $squash_dir/$folder
Harald Hoyer 9d5d75
+    done
Harald Hoyer 9d5d75
+
Harald Hoyer 9d5d75
+    # Reinstall required files, because we have moved some important folders to $squash_dir
Harald Hoyer 9d5d75
+    inst_multiple "echo" "sh" "mount" "modprobe" "mkdir" \
Harald Hoyer 9d5d75
+        "systemctl" "udevadm" "$systemdutildir/systemd"
Harald Hoyer 9d5d75
+    hostonly="" instmods "loop" "squashfs" "overlay"
Harald Hoyer 9d5d75
+
Harald Hoyer 9d5d75
+    for folder in "${squash_candidate[@]}"; do
Harald Hoyer 9d5d75
+        # Remove duplicated files in squashfs image, save some more space
Harald Hoyer 9d5d75
+        [[ ! -d $initdir/$folder/ ]] && continue
Harald Hoyer 9d5d75
+        for file in $(find $initdir/$folder/ -not -type d);
Harald Hoyer 9d5d75
+        do
Harald Hoyer 9d5d75
+            if [[ -e $squash_dir${file#$initdir} ]]; then
Harald Hoyer 9d5d75
+                mv $squash_dir${file#$initdir} $file
Harald Hoyer 9d5d75
+            fi
Harald Hoyer 9d5d75
+        done
Harald Hoyer 9d5d75
+    done
Harald Hoyer 9d5d75
+
Harald Hoyer 9d5d75
+    # Move some files out side of the squash image, including:
Harald Hoyer 9d5d75
+    # - Files required to boot and mount the squashfs image
Harald Hoyer 9d5d75
+    # - Files need to be accessable without mounting the squash image
Harald Hoyer 9d5d75
+    required_in_root() {
Harald Hoyer 9d5d75
+        local file=$1
Harald Hoyer 9d5d75
+        local _sqsh_file=$squash_dir/$file
Harald Hoyer 9d5d75
+        local _init_file=$initdir/$file
Harald Hoyer 9d5d75
+
Harald Hoyer 9d5d75
+        if [[ -e $_init_file ]]; then
Harald Hoyer 9d5d75
+            return
Harald Hoyer 9d5d75
+        fi
Harald Hoyer 9d5d75
+
Harald Hoyer 9d5d75
+        if [[ ! -e $_sqsh_file ]] && [[ ! -L $_sqsh_file ]]; then
Harald Hoyer 9d5d75
+            derror "$file is required to boot a squashed initramfs but it's not installed!"
Harald Hoyer 9d5d75
+            return
Harald Hoyer 9d5d75
+        fi
Harald Hoyer 9d5d75
+
Harald Hoyer 9d5d75
+        if [[ ! -d $(dirname $_init_file) ]]; then
Harald Hoyer 9d5d75
+            required_in_root $(dirname $file)
Harald Hoyer 9d5d75
+        fi
Harald Hoyer 9d5d75
+
Harald Hoyer 9d5d75
+        if [[ -d $_sqsh_file ]]; then
Harald Hoyer 9d5d75
+            if [[ -L $_sqsh_file ]]; then
Harald Hoyer 9d5d75
+                cp --preserve=all -P $_sqsh_file $_init_file
Harald Hoyer 9d5d75
+            else
Harald Hoyer 9d5d75
+                mkdir $_init_file
Harald Hoyer 9d5d75
+            fi
Harald Hoyer 9d5d75
+        else
Harald Hoyer 9d5d75
+            if [[ -L $_sqsh_file ]]; then
Harald Hoyer 9d5d75
+                cp --preserve=all -P $_sqsh_file $_init_file
Harald Hoyer 9d5d75
+                _sqsh_file=$(realpath $_sqsh_file 2>/dev/null)
Harald Hoyer 9d5d75
+                if [[ -e $_sqsh_file ]] && [[ "$_sqsh_file" == "$squash_dir"* ]]; then
Harald Hoyer 9d5d75
+                    # Relative symlink
Harald Hoyer 9d5d75
+                    required_in_root ${_sqsh_file#$squash_dir/}
Harald Hoyer 9d5d75
+                    return
Harald Hoyer 9d5d75
+                fi
Harald Hoyer 9d5d75
+                if [[ -e $squash_dir$_sqsh_file ]]; then
Harald Hoyer 9d5d75
+                    # Absolute symlink
Harald Hoyer 9d5d75
+                    required_in_root ${_sqsh_file#/}
Harald Hoyer 9d5d75
+                    return
Harald Hoyer 9d5d75
+                fi
Harald Hoyer 9d5d75
+                required_in_root ${module_spec#$squash_dir/}
Harald Hoyer 9d5d75
+            else
Harald Hoyer 9d5d75
+                mv $_sqsh_file $_init_file
Harald Hoyer 9d5d75
+            fi
Harald Hoyer 9d5d75
+        fi
Harald Hoyer 9d5d75
+    }
Harald Hoyer 9d5d75
+
Harald Hoyer 9d5d75
+    required_in_root etc/initrd-release
Harald Hoyer 9d5d75
+
Harald Hoyer 9d5d75
+    for module_spec in $squash_dir/usr/lib/modules/*/modules.*;
Harald Hoyer 9d5d75
+    do
Harald Hoyer 9d5d75
+        required_in_root ${module_spec#$squash_dir/}
Harald Hoyer 9d5d75
+    done
Harald Hoyer 9d5d75
+
Harald Hoyer 9d5d75
+    for dracut_spec in $squash_dir/usr/lib/dracut/*;
Harald Hoyer 9d5d75
+    do
Harald Hoyer 9d5d75
+        required_in_root ${dracut_spec#$squash_dir/}
Harald Hoyer 9d5d75
+    done
Harald Hoyer 9d5d75
+
Harald Hoyer 9d5d75
+    mv $initdir/init $initdir/init.stock
Harald Hoyer 9d5d75
+    mv $initdir/shutdown $initdir/shutdown.stock
Harald Hoyer 9d5d75
+    ln -s squash/init.sh $initdir/init
Harald Hoyer 9d5d75
+    ln -s squash/shutdown.sh $initdir/shutdown
Harald Hoyer 9d5d75
+
Harald Hoyer 9d5d75
+    mksquashfs $squash_dir $squash_img -comp xz -b 64K -Xdict-size 100% &> /dev/null
Harald Hoyer 9d5d75
+
Harald Hoyer 9d5d75
+    if [[ $? != 0 ]]; then
Harald Hoyer 9d5d75
+        dfatal "dracut: Failed making squash image"
Harald Hoyer 9d5d75
+        exit 1
Harald Hoyer 9d5d75
+    fi
Harald Hoyer 9d5d75
+fi
Harald Hoyer 9d5d75
+
Harald Hoyer 9d5d75
 if [[ $uefi = yes ]]; then
Harald Hoyer 9d5d75
     readonly uefi_outdir="$DRACUT_TMPDIR/uefi"
Harald Hoyer 9d5d75
     mkdir "$uefi_outdir"
Harald Hoyer 9d5d75
diff --git a/modules.d/99squash/clear-squash.sh b/modules.d/99squash/clear-squash.sh
Harald Hoyer 9d5d75
new file mode 100755
Harald Hoyer 9d5d75
index 00000000..34cb4cf5
Harald Hoyer 9d5d75
--- /dev/null
Harald Hoyer 9d5d75
+++ b/modules.d/99squash/clear-squash.sh
Harald Hoyer 9d5d75
@@ -0,0 +1,9 @@
Harald Hoyer 9d5d75
+#!/bin/sh
Harald Hoyer 9d5d75
+SQUASH_MNT_REC=/squash/mounts
Harald Hoyer 9d5d75
+SQUASH_MNTS=( )
Harald Hoyer 9d5d75
+
Harald Hoyer 9d5d75
+while read mnt; do
Harald Hoyer 9d5d75
+    SQUASH_MNTS+=( "$mnt" )
Harald Hoyer 9d5d75
+done <<< "$(cat $SQUASH_MNT_REC)"
Harald Hoyer 9d5d75
+
Harald Hoyer 9d5d75
+umount --lazy -- ${SQUASH_MNTS[@]}
Harald Hoyer 9d5d75
diff --git a/modules.d/99squash/init.sh b/modules.d/99squash/init.sh
Harald Hoyer 9d5d75
new file mode 100755
Harald Hoyer 9d5d75
index 00000000..bca49db5
Harald Hoyer 9d5d75
--- /dev/null
Harald Hoyer 9d5d75
+++ b/modules.d/99squash/init.sh
Harald Hoyer 9d5d75
@@ -0,0 +1,7 @@
Harald Hoyer 9d5d75
+#!/bin/sh
Harald Hoyer 9d5d75
+/squash/setup-squash.sh
Harald Hoyer 9d5d75
+
Harald Hoyer 9d5d75
+exec /init.stock
Harald Hoyer 9d5d75
+
Harald Hoyer 9d5d75
+echo "Something went wrong when trying to start original init executable!"
Harald Hoyer 9d5d75
+exit 1
Harald Hoyer 9d5d75
diff --git a/modules.d/99squash/module-setup.sh b/modules.d/99squash/module-setup.sh
Harald Hoyer 9d5d75
new file mode 100644
Harald Hoyer 9d5d75
index 00000000..935fd721
Harald Hoyer 9d5d75
--- /dev/null
Harald Hoyer 9d5d75
+++ b/modules.d/99squash/module-setup.sh
Harald Hoyer 9d5d75
@@ -0,0 +1,29 @@
Harald Hoyer 9d5d75
+#!/bin/bash
Harald Hoyer 9d5d75
+
Harald Hoyer 9d5d75
+check() {
Harald Hoyer 9d5d75
+    return 255
Harald Hoyer 9d5d75
+}
Harald Hoyer 9d5d75
+
Harald Hoyer 9d5d75
+depends() {
Harald Hoyer 9d5d75
+    echo "bash systemd systemd-initrd"
Harald Hoyer 9d5d75
+    return 0
Harald Hoyer 9d5d75
+}
Harald Hoyer 9d5d75
+
Harald Hoyer 9d5d75
+installkernel() {
Harald Hoyer 9d5d75
+    hostonly="" instmods squashfs loop overlay
Harald Hoyer 9d5d75
+}
Harald Hoyer 9d5d75
+
Harald Hoyer 9d5d75
+install() {
Harald Hoyer 9d5d75
+    if ! type -P mksquashfs >/dev/null || ! type -P unsquashfs >/dev/null ; then
Harald Hoyer 9d5d75
+        derror "squash module requires squashfs-tools to be installed."
Harald Hoyer 9d5d75
+        return 1
Harald Hoyer 9d5d75
+    fi
Harald Hoyer 9d5d75
+
Harald Hoyer 9d5d75
+    inst_multiple kmod modprobe mount mkdir ln echo
Harald Hoyer 9d5d75
+    inst $moddir/setup-squash.sh /squash/setup-squash.sh
Harald Hoyer 9d5d75
+    inst $moddir/clear-squash.sh /squash/clear-squash.sh
Harald Hoyer 9d5d75
+    inst $moddir/init.sh /squash/init.sh
Harald Hoyer 9d5d75
+
Harald Hoyer 9d5d75
+    inst "$moddir/squash-mnt-clear.service" "$systemdsystemunitdir/squash-mnt-clear.service"
Harald Hoyer 9d5d75
+    ln_r "$systemdsystemunitdir/squash-mnt-clear.service" "$systemdsystemunitdir/initrd.target.wants/squash-mnt-clear.service"
Harald Hoyer 9d5d75
+}
Harald Hoyer 9d5d75
diff --git a/modules.d/99squash/setup-squash.sh b/modules.d/99squash/setup-squash.sh
Harald Hoyer 9d5d75
new file mode 100755
Harald Hoyer 9d5d75
index 00000000..d2740e7c
Harald Hoyer 9d5d75
--- /dev/null
Harald Hoyer 9d5d75
+++ b/modules.d/99squash/setup-squash.sh
Harald Hoyer 9d5d75
@@ -0,0 +1,61 @@
Harald Hoyer 9d5d75
+#!/bin/sh
Harald Hoyer 9d5d75
+PATH=/bin:/sbin
Harald Hoyer 9d5d75
+
Harald Hoyer 9d5d75
+SQUASH_IMG=/squash/root.img
Harald Hoyer 9d5d75
+SQUASH_MNT=/squash/root
Harald Hoyer 9d5d75
+SQUASH_MNT_REC=/squash/mounts
Harald Hoyer 9d5d75
+SQUASHED_MNT="usr etc"
Harald Hoyer 9d5d75
+
Harald Hoyer 9d5d75
+echo $SQUASH_MNT > $SQUASH_MNT_REC
Harald Hoyer 9d5d75
+
Harald Hoyer 9d5d75
+# Following mount points are neccessary for mounting a squash image
Harald Hoyer 9d5d75
+
Harald Hoyer 9d5d75
+[ ! -d /proc/self ] && \
Harald Hoyer 9d5d75
+    mount -t proc -o nosuid,noexec,nodev proc /proc
Harald Hoyer 9d5d75
+
Harald Hoyer 9d5d75
+[ ! -d /sys/kernel ] && \
Harald Hoyer 9d5d75
+    mount -t sysfs -o nosuid,noexec,nodev sysfs /sys
Harald Hoyer 9d5d75
+
Harald Hoyer 9d5d75
+[ ! -e /dev/loop-control ] && \
Harald Hoyer 9d5d75
+    mount -t devtmpfs -o mode=0755,noexec,nosuid,strictatime devtmpfs /dev
Harald Hoyer 9d5d75
+
Harald Hoyer 9d5d75
+# Need a loop device backend, overlayfs, and squashfs module
Harald Hoyer 9d5d75
+modprobe loop
Harald Hoyer 9d5d75
+if [ $? != 0 ]; then
Harald Hoyer 9d5d75
+    echo "Unable to setup loop module"
Harald Hoyer 9d5d75
+fi
Harald Hoyer 9d5d75
+
Harald Hoyer 9d5d75
+modprobe squashfs
Harald Hoyer 9d5d75
+if [ $? != 0 ]; then
Harald Hoyer 9d5d75
+    echo "Unable to setup squashfs module"
Harald Hoyer 9d5d75
+fi
Harald Hoyer 9d5d75
+
Harald Hoyer 9d5d75
+modprobe overlay
Harald Hoyer 9d5d75
+if [ $? != 0 ]; then
Harald Hoyer 9d5d75
+    echo "Unable to setup overlay module"
Harald Hoyer 9d5d75
+fi
Harald Hoyer 9d5d75
+
Harald Hoyer 9d5d75
+[ ! -d "$SQUASH_MNT" ] && \
Harald Hoyer 9d5d75
+	mkdir -m 0755 -p $SQUASH_MNT
Harald Hoyer 9d5d75
+
Harald Hoyer 9d5d75
+# Mount the squashfs image
Harald Hoyer 9d5d75
+mount -t squashfs -o ro,loop $SQUASH_IMG $SQUASH_MNT
Harald Hoyer 9d5d75
+
Harald Hoyer 9d5d75
+if [ $? != 0 ]; then
Harald Hoyer 9d5d75
+    echo "Unable to mount squashed initramfs image"
Harald Hoyer 9d5d75
+fi
Harald Hoyer 9d5d75
+
Harald Hoyer 9d5d75
+for file in $SQUASHED_MNT; do
Harald Hoyer 9d5d75
+	lowerdir=$SQUASH_MNT/$file
Harald Hoyer 9d5d75
+	workdir=/squash/overlay-work/$file
Harald Hoyer 9d5d75
+	upperdir=/$file
Harald Hoyer 9d5d75
+	mntdir=/$file
Harald Hoyer 9d5d75
+
Harald Hoyer 9d5d75
+	mkdir -m 0755 -p $workdir
Harald Hoyer 9d5d75
+	mkdir -m 0755 -p $mntdir
Harald Hoyer 9d5d75
+
Harald Hoyer 9d5d75
+	mount -t overlay overlay -o\
Harald Hoyer 9d5d75
+		lowerdir=$lowerdir,upperdir=$upperdir,workdir=$workdir $mntdir
Harald Hoyer 9d5d75
+
Harald Hoyer 9d5d75
+	echo $mntdir >> $SQUASH_MNT_REC
Harald Hoyer 9d5d75
+done
Harald Hoyer 9d5d75
diff --git a/modules.d/99squash/shutdown.sh b/modules.d/99squash/shutdown.sh
Harald Hoyer 9d5d75
new file mode 100755
Harald Hoyer 9d5d75
index 00000000..535779f4
Harald Hoyer 9d5d75
--- /dev/null
Harald Hoyer 9d5d75
+++ b/modules.d/99squash/shutdown.sh
Harald Hoyer 9d5d75
@@ -0,0 +1,7 @@
Harald Hoyer 9d5d75
+#!/bin/sh
Harald Hoyer 9d5d75
+/squash/setup-squash.sh
Harald Hoyer 9d5d75
+
Harald Hoyer 9d5d75
+exec /shutdown.stock
Harald Hoyer 9d5d75
+
Harald Hoyer 9d5d75
+echo "Something went wrong when trying to start original shutdown executable!"
Harald Hoyer 9d5d75
+exit 1
Harald Hoyer 9d5d75
diff --git a/modules.d/99squash/squash-mnt-clear.service b/modules.d/99squash/squash-mnt-clear.service
Harald Hoyer 9d5d75
new file mode 100644
Harald Hoyer 9d5d75
index 00000000..8dd17812
Harald Hoyer 9d5d75
--- /dev/null
Harald Hoyer 9d5d75
+++ b/modules.d/99squash/squash-mnt-clear.service
Harald Hoyer 9d5d75
@@ -0,0 +1,19 @@
Harald Hoyer 9d5d75
+#  This file is part of dracut.
Harald Hoyer 9d5d75
+#
Harald Hoyer 9d5d75
+
Harald Hoyer 9d5d75
+[Unit]
Harald Hoyer 9d5d75
+Description=Cleanup squashfs mounts when switch root
Harald Hoyer 9d5d75
+DefaultDependencies=no
Harald Hoyer 9d5d75
+After=initrd.target
Harald Hoyer 9d5d75
+After=dracut-initqueue.service dracut-pre-pivot.service
Harald Hoyer 9d5d75
+Before=initrd-cleanup.service
Harald Hoyer 9d5d75
+ConditionPathExists=/squash/root
Harald Hoyer 9d5d75
+Conflicts=initrd-switch-root.target
Harald Hoyer 9d5d75
+
Harald Hoyer 9d5d75
+[Service]
Harald Hoyer 9d5d75
+Type=oneshot
Harald Hoyer 9d5d75
+RemainAfterExit=yes
Harald Hoyer 9d5d75
+StandardInput=null
Harald Hoyer 9d5d75
+StandardOutput=syslog+console
Harald Hoyer 9d5d75
+StandardError=syslog+console
Harald Hoyer 9d5d75
+ExecStop=/squash/clear-squash.sh
Harald Hoyer 9d5d75