[Unit] Description=Memory-backed directories # What wabuntu-sysinit runs first under busybox init: on a read-only root, the # tmpfs over the homes, /var/spool and /var/cache, before anything writes there. DefaultDependencies=no After=systemd-remount-fs.service Before=local-fs.target systemd-tmpfiles-setup.service systemd-journal-flush.service [Service] Type=oneshot RemainAfterExit=yes # systemd mounts /run shared, and the script moves each home's tmpfs out of # /run/wabuntu-volatile: a mount under a shared one cannot be moved. ExecStartPre=-/bin/mount --make-private /run ExecStart=/usr/sbin/wabuntu-volatile # A write probe, not ConditionPathIsReadWrite: on a snapshot the superblock # stays read-write and only the backend refuses. ExecStartPost=/bin/sh -c 'mkdir /var/lib/.wabuntu-rw.$$$$ 2>/dev/null && rmdir /var/lib/.wabuntu-rw.$$$$ || : > /run/wabuntu-read-only-root' # On a snapshot PID 1 opens the empty /etc/machine-id read-write, cannot # truncate it and leaves it empty; /etc is a tmpfs by now, so the id goes there. ExecStartPost=-/bin/sh -c '[ -s /etc/machine-id ] || exec systemd-machine-id-setup' [Install] WantedBy=local-fs.target