From: Jo Zzsi Date: Sat, 9 Nov 2024 20:30:05 +0000 (-0500) Subject: feat: systemd-battery-check dracut module X-Git-Tag: 106~229 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7cf47b26fe2e8a1a6fcac301db74ae3dbbf523b0;p=thirdparty%2Fdracut-ng.git feat: systemd-battery-check dracut module --- diff --git a/.github/labeler.yml b/.github/labeler.yml index 279ee7b2d..ae425be9d 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -70,6 +70,10 @@ fips-crypto-policies: - changed-files: - any-glob-to-any-file: 'modules.d/[0-9][0-9]fips-crypto-policies/*' +systemd-battery-check: + - changed-files: + - any-glob-to-any-file: 'modules.d/[0-9][0-9]systemd-battery-check/*' + systemd-ac-power: - changed-files: - any-glob-to-any-file: 'modules.d/[0-9][0-9]systemd-ac-power/*' diff --git a/modules.d/01systemd-battery-check/module-setup.sh b/modules.d/01systemd-battery-check/module-setup.sh new file mode 100755 index 000000000..64cdd0a24 --- /dev/null +++ b/modules.d/01systemd-battery-check/module-setup.sh @@ -0,0 +1,28 @@ +#!/bin/bash +# 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 the module can't be installed + require_binaries "$systemdutildir"/systemd-battery-check || return 1 + + # Return 255 to only include the module, if another module requires it. + return 255 +} + +# Module dependency requirements. +depends() { + # This module has external dependency on other module(s). + echo systemd + # Return 0 to include the dependent module(s) in the initramfs. + return 0 +} + +# Install the required file(s) for the module in the initramfs. +install() { + inst_multiple \ + "$systemdsystemunitdir"/systemd-battery-check.service \ + "$systemdsystemunitdir"/initrd.target.wants/systemd-battery-check.service \ + "$systemdutildir"/systemd-battery-check +} diff --git a/test/TEST-41-FULL-SYSTEMD/test.sh b/test/TEST-41-FULL-SYSTEMD/test.sh index f7daebbd5..1874dbccc 100755 --- a/test/TEST-41-FULL-SYSTEMD/test.sh +++ b/test/TEST-41-FULL-SYSTEMD/test.sh @@ -135,7 +135,7 @@ EOF # TODO enable systemd-bsod for Gentoo test_dracut \ - -m "resume dracut-systemd systemd-ac-power systemd-coredump systemd-creds systemd-cryptsetup systemd-integritysetup systemd-ldconfig systemd-pcrphase systemd-pstore systemd-repart systemd-sysext systemd-veritysetup" \ + -m "systemd-battery-check resume dracut-systemd systemd-ac-power systemd-coredump systemd-creds systemd-cryptsetup systemd-integritysetup systemd-ldconfig systemd-pcrphase systemd-pstore systemd-repart systemd-sysext systemd-veritysetup" \ --add-drivers "btrfs" \ "$TESTDIR"/initramfs.testing