|
| 1 | +#!/bin/bash |
| 2 | +# This file is part of dracut. |
| 3 | +# SPDX-License-Identifier: GPL-2.0-or-later |
| 4 | + |
| 5 | +# Prerequisite check(s) for module. |
| 6 | +check() { |
| 7 | + |
| 8 | + # If the binary(s) requirements are not fulfilled the module can't be installed. |
| 9 | + require_binaries systemd-tmpfiles || return 1 |
| 10 | + |
| 11 | + # Return 255 to only include the module, if another module requires it. |
| 12 | + return 255 |
| 13 | + |
| 14 | +} |
| 15 | + |
| 16 | +# Module dependency requirements. |
| 17 | +depends() { |
| 18 | + |
| 19 | + # Return 0 to include the dependent module(s) in the initramfs. |
| 20 | + return 0 |
| 21 | + |
| 22 | +} |
| 23 | + |
| 24 | +# Install the required file(s) and directories for the module in the initramfs. |
| 25 | +install() { |
| 26 | + |
| 27 | + # Excluding "$tmpfilesdir/home.conf", sets up /home /srv |
| 28 | + # Excluding "$tmpfilesdir/portables.conf", belongs in seperated portables module |
| 29 | + # Excluding "$tmpfilesdir/journal-nocow.conf", requires spesific btrfs setup |
| 30 | + # Excluding "$tmpfilesdir/legacy.conf", belongs in seperated legacy module |
| 31 | + # Excluding "$tmpfilesdir/systemd-nologin.conf", belongs in seperated pam module |
| 32 | + # Excluding "$tmpfilesdir/systemd-nspawn.conf", belongs in seperated machined module |
| 33 | + # Excluding "$tmpfilesdir/systemd-pstore.conf", belongs in seperated pstore module |
| 34 | + # Excluding "$tmpfilesdir/x11.conf", belongs in seperated x11 module |
| 35 | + |
| 36 | + |
| 37 | + inst_multiple -o \ |
| 38 | + /usr/lib/group \ |
| 39 | + /usr/lib/passwd \ |
| 40 | + "$tmpfilesdir/etc.conf" \ |
| 41 | + "$tmpfilesdir/static-nodes-permissions.conf" \ |
| 42 | + "$tmpfilesdir/systemd-tmp.conf" \ |
| 43 | + "$tmpfilesdir/systemd.conf" \ |
| 44 | + "$tmpfilesdir/var.conf" \ |
| 45 | + "$systemdsystemunitdir"/systemd-tmpfiles-clean.service \ |
| 46 | + "$systemdsystemunitdir/systemd-tmpfiles-clean.service.d/*.conf" \ |
| 47 | + "$systemdsystemunitdir"/systemd-tmpfiles-setup.service \ |
| 48 | + "$systemdsystemunitdir/systemd-tmpfiles-setup.service.d/*.conf" \ |
| 49 | + "$systemdsystemunitdir"/systemd-tmpfiles-setup-dev.service \ |
| 50 | + "$systemdsystemunitdir/systemd-tmpfiles-setup-dev.service.d/*.conf" \ |
| 51 | + "$systemdsystemunitdir"/systemd-tmpfiles-clean.timer \ |
| 52 | + "$systemdsystemunitdir"/timers.target.wants/systemd-tmpfiles-clean.timer \ |
| 53 | + "$systemdsystemunitdir"/sysinit.target.wants/systemd-tmpfiles-setup-dev.service \ |
| 54 | + "$systemdsystemunitdir"/sysinit.target.wants/systemd-tmpfiles-setup.service \ |
| 55 | + systemd-tmpfiles |
| 56 | + |
| 57 | + # Install the hosts local user configurations if enabled. |
| 58 | + if [[ $hostonly ]]; then |
| 59 | + inst_multiple -H -o \ |
| 60 | + /etc/group \ |
| 61 | + /etc/passwd \ |
| 62 | + "$tmpfilesconfdir/*.conf" \ |
| 63 | + "$systemdsystemconfdir"/systemd-tmpfiles-clean.service \ |
| 64 | + "$systemdsystemconfdir/systemd-tmpfiles-clean.service.d/*.conf" \ |
| 65 | + "$systemdsystemconfdir"/systemd-tmpfiles-setup.service \ |
| 66 | + "$systemdsystemconfdir/systemd-tmpfiles-setup.service.d/*.conf" \ |
| 67 | + "$systemdsystemconfdir"/systemd-tmpfiles-setup-dev.service \ |
| 68 | + "$systemdsystemconfdir/systemd-tmpfiles-setup-dev.service.d/*.conf" |
| 69 | + fi |
| 70 | + |
| 71 | +} |
0 commit comments