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
master
Jóhann B. Guðmundsson 2021-02-04 18:19:02 +00:00
parent 7135c81931
commit c3446a7ce0
2 changed files with 56 additions and 0 deletions

View File

@ -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

View File

@ -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
}