From: Jóhann B. Guðmundsson Date: Thu, 4 Feb 2021 18:19:02 +0000 (+0000) Subject: feat(systemd-repart): introducing systemd-repart module X-Git-Tag: 052~110 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c3446a7ce0fd73084b8c625f618969e3bb5f5161;p=thirdparty%2Fdracut.git feat(systemd-repart): introducing systemd-repart module This modules introduces systemd-repart which can be used to generate partition(s), via a simple systemd-repart drop-in(s), which can be useful in wide varity of usecase. feat(systemd-repart): adding module to spec file feat(systemd-repart): removing unessary requirement on type unit fix: spelling error --- diff --git a/dracut.spec b/dracut.spec index 595da452e..3b37e8a62 100644 --- a/dracut.spec +++ b/dracut.spec @@ -336,6 +336,7 @@ echo 'dracut_rescue_image="yes"' > $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/ %{dracutlibdir}/modules.d/01systemd-sysusers %{dracutlibdir}/modules.d/01systemd-initrd %{dracutlibdir}/modules.d/01systemd-coredump +%{dracutlibdir}/modules.d/01systemd-repart %{dracutlibdir}/modules.d/03modsign %{dracutlibdir}/modules.d/03rescue %{dracutlibdir}/modules.d/04watchdog diff --git a/modules.d/01systemd-repart/module-setup.sh b/modules.d/01systemd-repart/module-setup.sh new file mode 100755 index 000000000..4b1c6ac53 --- /dev/null +++ b/modules.d/01systemd-repart/module-setup.sh @@ -0,0 +1,55 @@ +#!/bin/sh +# This file is part of dracut. +# SPDX-License-Identifier: GPL-2.0-or-later + +# Prerequisite check(s) for module. +check() { + + # If the binary(s) requirements are not fulfilled + # return 1 to not include the binary. + require_binaries systemd-repart || return 1 + + # If the module dependency requirements are not fulfilled + # return 1 to not include the required module(s). + if ! dracut_module_included "systemd"; then + derror "systemd-repart needs systemd in the initramfs." + return 1 + fi + + # Return 255 to only include the module, if another module requires it. + return 255 + +} + +# Module dependency requirements. +depends() { + + # This module has external dependency on the systemd module. + echo systemd + # Return 0 to include the dependent systemd module in the initramfs. + return 0 + +} + +# Install the required file(s) for the module in the initramfs. +install() { + + # Install the required file(s. + inst_multiple -o \ + # Install vendor repartition configurations + $libdir/repart.d/*.conf + # Install the systemd type service unit for systemd repart. + $systemdsystemunitdir/systemd-repart.service \ + $systemdsystemunitdir/initrd-root-fs.target.wants/systemd-repart.service + # Install the binary executable(s) for systemd repart. + systemd-repart + + # Install the hosts local user configurations if enabled. + if [[ $hostonly ]]; then + inst_multiple -H -o \ + /etc/repart.d/*.conf \ + $systemdsystemconfdir/systemd-repart.service \ + $systemdsystemconfdir/systemd-repart.service.d/*.conf + ${NULL} + fi +}