From e6117b92fa0108dbaf9ea3ac0ec8f5a02487c812 Mon Sep 17 00:00:00 2001 From: Jo Zzsi Date: Fri, 30 Aug 2024 12:01:19 -0400 Subject: [PATCH] chore: remove boilerplate It is not required to redefine empty functions. --- modules.d/00bash/module-setup.sh | 12 ------------ modules.d/00dash/module-setup.sh | 12 ------------ modules.d/00systemd/module-setup.sh | 5 ----- modules.d/00warpclock/module-setup.sh | 12 ------------ modules.d/01fips-crypto-policies/module-setup.sh | 10 ---------- modules.d/01fips/module-setup.sh | 5 ----- modules.d/01systemd-ac-power/module-setup.sh | 12 ------------ modules.d/01systemd-initrd/module-setup.sh | 4 ---- modules.d/01systemd-modules-load/module-setup.sh | 12 ------------ modules.d/01systemd-repart/module-setup.sh | 11 ----------- modules.d/01systemd-sysusers/module-setup.sh | 12 ------------ modules.d/01systemd-tmpfiles/module-setup.sh | 12 ------------ modules.d/04watchdog-modules/module-setup.sh | 10 ---------- modules.d/35connman/module-setup.sh | 5 ----- modules.d/35network-manager/module-setup.sh | 5 ----- modules.d/90kernel-network-modules/module-setup.sh | 5 ----- modules.d/90ppcmac/module-setup.sh | 5 ----- modules.d/95dasd/module-setup.sh | 5 ----- modules.d/95rootfs-block/module-setup.sh | 5 ----- modules.d/95zfcp/module-setup.sh | 5 ----- modules.d/98dracut-systemd/module-setup.sh | 4 ---- modules.d/98pollcdrom/module-setup.sh | 5 ----- modules.d/98syslog/module-setup.sh | 5 ----- modules.d/99base/module-setup.sh | 5 ----- modules.d/99fs-lib/module-setup.sh | 5 ----- modules.d/99shutdown/module-setup.sh | 5 ----- 26 files changed, 193 deletions(-) diff --git a/modules.d/00bash/module-setup.sh b/modules.d/00bash/module-setup.sh index 89ef65414..b5ab78029 100755 --- a/modules.d/00bash/module-setup.sh +++ b/modules.d/00bash/module-setup.sh @@ -4,29 +4,17 @@ # Prerequisite check(s) for module. check() { - # If the binary(s) requirements are not fulfilled the module can't be installed. require_binaries bash || return 1 # Return 255 to only include the module, if another module requires it. return 255 - -} - -# Module dependency requirements. -depends() { - - # Return 0 to include the dependent module(s) in the initramfs. - return 0 - } # Install the required file(s) and directories for the module in the initramfs. install() { - inst /bin/bash # Prefer bash as default shell if no other shell is preferred. [[ -L $initdir/bin/sh ]] || ln -sf bash "${initdir}/bin/sh" - } diff --git a/modules.d/00dash/module-setup.sh b/modules.d/00dash/module-setup.sh index 4a0c0e7e8..753e2247c 100755 --- a/modules.d/00dash/module-setup.sh +++ b/modules.d/00dash/module-setup.sh @@ -4,29 +4,17 @@ # Prerequisite check(s) for module. check() { - # If the binary(s) requirements are not fulfilled the module can't be installed. require_binaries dash || return 1 # Return 255 to only include the module, if another module requires it. return 255 - -} - -# Module dependency requirements. -depends() { - - # Return 0 to include the dependent module(s) in the initramfs. - return 0 - } # Install the required file(s) and directories for the module in the initramfs. install() { - inst /bin/dash # Prefer dash as default shell if no other shell is preferred. [[ -L $initdir/bin/sh ]] || ln -sf dash "${initdir}/bin/sh" - } diff --git a/modules.d/00systemd/module-setup.sh b/modules.d/00systemd/module-setup.sh index 1cfaa6e39..498cd7edd 100755 --- a/modules.d/00systemd/module-setup.sh +++ b/modules.d/00systemd/module-setup.sh @@ -11,11 +11,6 @@ check() { return 255 } -# called by dracut -depends() { - return 0 -} - installkernel() { hostonly='' instmods autofs4 ipv6 algif_hash hmac sha256 instmods -s efivarfs diff --git a/modules.d/00warpclock/module-setup.sh b/modules.d/00warpclock/module-setup.sh index dd093f3c4..5e4d74d71 100755 --- a/modules.d/00warpclock/module-setup.sh +++ b/modules.d/00warpclock/module-setup.sh @@ -4,7 +4,6 @@ # Prerequisite check(s) for module. check() { - # hwclock does not exist on S390(x), bail out silently then local _arch=${DRACUT_ARCH:-$(uname -m)} [ "$_arch" = "s390" ] || [ "$_arch" = "s390x" ] && return 1 @@ -14,20 +13,10 @@ check() { # Return 255 to only include the module, if another module requires it. return 255 - -} - -# Module dependency requirements. -depends() { - - # Return 0 to include the dependent module(s) in the initramfs. - return 0 - } # Install the required file(s) and directories for the module in the initramfs. install() { - inst_hook pre-trigger 00 "$moddir/warpclock.sh" inst_multiple -o \ @@ -35,5 +24,4 @@ install() { /etc/localtime \ /etc/adjtime \ hwclock - } diff --git a/modules.d/01fips-crypto-policies/module-setup.sh b/modules.d/01fips-crypto-policies/module-setup.sh index ee00452e8..e1fbcbfec 100755 --- a/modules.d/01fips-crypto-policies/module-setup.sh +++ b/modules.d/01fips-crypto-policies/module-setup.sh @@ -9,16 +9,6 @@ check() { return 255 } -# called by dracut -depends() { - return 0 -} - -# called by dracut -installkernel() { - return 0 -} - # called by dracut install() { inst_hook pre-pivot 01 "$moddir/fips-crypto-policies.sh" diff --git a/modules.d/01fips/module-setup.sh b/modules.d/01fips/module-setup.sh index 1e0c9d097..3d24ee21d 100755 --- a/modules.d/01fips/module-setup.sh +++ b/modules.d/01fips/module-setup.sh @@ -5,11 +5,6 @@ check() { return 255 } -# called by dracut -depends() { - return 0 -} - # called by dracut installkernel() { local _fipsmodules _mod _bootfstype diff --git a/modules.d/01systemd-ac-power/module-setup.sh b/modules.d/01systemd-ac-power/module-setup.sh index c4e7fdd1a..01cabc05f 100755 --- a/modules.d/01systemd-ac-power/module-setup.sh +++ b/modules.d/01systemd-ac-power/module-setup.sh @@ -4,26 +4,14 @@ # Prerequisite check(s) for module. check() { - # Return 255 to only include the module, if another module requires it. return 255 - -} - -# Module dependency requirements. -depends() { - - # Return 0 to include the dependent module(s) in the initramfs. - return 0 - } # Install the required file(s) and directories for the module in the initramfs. install() { - inst_rules "$moddir/99-initrd-power-targets.rules" inst systemd-ac-power inst_simple "$moddir/initrd-on-ac-power.target" "$systemdsystemunitdir/initrd-on-ac-power.target" inst_simple "$moddir/initrd-on-battery-power.target" "$systemdsystemunitdir/initrd-on-battery-power.target" - } diff --git a/modules.d/01systemd-initrd/module-setup.sh b/modules.d/01systemd-initrd/module-setup.sh index 603868612..97906edce 100755 --- a/modules.d/01systemd-initrd/module-setup.sh +++ b/modules.d/01systemd-initrd/module-setup.sh @@ -13,10 +13,6 @@ depends() { echo base systemd-udevd systemd-journald systemd-tmpfiles } -installkernel() { - return 0 -} - # called by dracut install() { inst_multiple -o \ diff --git a/modules.d/01systemd-modules-load/module-setup.sh b/modules.d/01systemd-modules-load/module-setup.sh index 34778f898..c35ab4be0 100755 --- a/modules.d/01systemd-modules-load/module-setup.sh +++ b/modules.d/01systemd-modules-load/module-setup.sh @@ -4,21 +4,11 @@ # Prerequisite check(s) for module. check() { - # If the binary(s) requirements are not fulfilled the module can't be installed require_binaries "$systemdutildir"/systemd-modules-load || return 1 # Return 255 to only include the module, if another module requires it. return 255 - -} - -# Module dependency requirements. -depends() { - - # Return 0 to include the dependent module(s) in the initramfs. - return 0 - } # Install kernel module(s). @@ -60,7 +50,6 @@ installkernel() { # Install the required file(s) and directories for the module in the initramfs. install() { - inst_multiple -o \ /usr/lib/modules-load.d/*.conf \ "$modulesload/*.conf" \ @@ -85,5 +74,4 @@ install() { "$systemdsystemconfdir"/systemd-modules-load.service \ "$systemdsystemconfdir/systemd-modules-load.service.d/*.conf" fi - } diff --git a/modules.d/01systemd-repart/module-setup.sh b/modules.d/01systemd-repart/module-setup.sh index 19b7e734f..f9dafc76b 100755 --- a/modules.d/01systemd-repart/module-setup.sh +++ b/modules.d/01systemd-repart/module-setup.sh @@ -4,26 +4,15 @@ # Prerequisite check(s) for module. check() { - # If the binary(s) requirements are not fulfilled the module can't be installed. require_binaries systemd-repart || return 1 # Return 255 to only include the module, if another module requires it. return 255 - -} - -# Module dependency requirements. -depends() { - - # 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 -o \ "/usr/lib/repart.d/*.conf" \ "$systemdsystemunitdir"/systemd-repart.service \ diff --git a/modules.d/01systemd-sysusers/module-setup.sh b/modules.d/01systemd-sysusers/module-setup.sh index 351f45c01..472a8c825 100755 --- a/modules.d/01systemd-sysusers/module-setup.sh +++ b/modules.d/01systemd-sysusers/module-setup.sh @@ -4,26 +4,15 @@ # Prerequisite check(s) for module. check() { - # If the binary(s) requirements are not fulfilled the module can't be installed. require_binaries systemd-sysusers || return 1 # Return 255 to only include the module, if another module requires it. return 255 - -} - -# Module dependency requirements. -depends() { - - # Return 0 to include the dependent module(s) in the initramfs. - return 0 - } # Install the required file(s) and directories for the module in the initramfs. install() { - inst_simple "$moddir/sysusers-dracut.conf" "$systemdsystemunitdir/systemd-sysusers.service.d/sysusers-dracut.conf" inst_sysusers basic.conf @@ -40,5 +29,4 @@ install() { "$systemdsystemconfdir"/systemd-sysusers.service \ "$systemdsystemconfdir/systemd-sysusers.service.d/*.conf" fi - } diff --git a/modules.d/01systemd-tmpfiles/module-setup.sh b/modules.d/01systemd-tmpfiles/module-setup.sh index 6bd42c0a3..3643ed495 100755 --- a/modules.d/01systemd-tmpfiles/module-setup.sh +++ b/modules.d/01systemd-tmpfiles/module-setup.sh @@ -4,26 +4,15 @@ # Prerequisite check(s) for module. check() { - # If the binary(s) requirements are not fulfilled the module can't be installed. require_binaries systemd-tmpfiles || return 1 # Return 255 to only include the module, if another module requires it. return 255 - -} - -# Module dependency requirements. -depends() { - - # Return 0 to include the dependent module(s) in the initramfs. - return 0 - } # Install the required file(s) and directories for the module in the initramfs. install() { - # Excluding "$tmpfilesdir/home.conf", sets up /home /srv # Excluding "$tmpfilesdir/journal-nocow.conf", requires specific btrfs setup # Excluding "$tmpfilesdir/legacy.conf", belongs in separated legacy module @@ -67,5 +56,4 @@ install() { "$systemdsystemconfdir"/systemd-tmpfiles-setup-dev-early.service \ "$systemdsystemconfdir/systemd-tmpfiles-setup-dev-early.service.d/*.conf" fi - } diff --git a/modules.d/04watchdog-modules/module-setup.sh b/modules.d/04watchdog-modules/module-setup.sh index 2a94e3464..108d969f7 100755 --- a/modules.d/04watchdog-modules/module-setup.sh +++ b/modules.d/04watchdog-modules/module-setup.sh @@ -5,16 +5,6 @@ check() { return 255 } -# called by dracut -depends() { - return 0 -} - -# called by dracut -install() { - return 0 -} - installkernel() { local -A _drivers local _wdtdrv diff --git a/modules.d/35connman/module-setup.sh b/modules.d/35connman/module-setup.sh index 5a3b0e1d6..a7c3d5654 100755 --- a/modules.d/35connman/module-setup.sh +++ b/modules.d/35connman/module-setup.sh @@ -14,11 +14,6 @@ depends() { return 0 } -# called by dracut -installkernel() { - return 0 -} - # called by dracut install() { # We don't need `ip` but having it is *really* useful for people debugging diff --git a/modules.d/35network-manager/module-setup.sh b/modules.d/35network-manager/module-setup.sh index 67144f36f..d82294bf7 100755 --- a/modules.d/35network-manager/module-setup.sh +++ b/modules.d/35network-manager/module-setup.sh @@ -14,11 +14,6 @@ depends() { return 0 } -# called by dracut -installkernel() { - return 0 -} - # called by dracut install() { local _nm_version diff --git a/modules.d/90kernel-network-modules/module-setup.sh b/modules.d/90kernel-network-modules/module-setup.sh index 08bbbd611..04d001bfa 100755 --- a/modules.d/90kernel-network-modules/module-setup.sh +++ b/modules.d/90kernel-network-modules/module-setup.sh @@ -38,8 +38,3 @@ installkernel() { '=drivers/net/ethernet' \ ecb arc4 bridge stp llc ipv6 bonding 8021q ipvlan macvlan af_packet virtio_net xennet } - -# called by dracut -install() { - return 0 -} diff --git a/modules.d/90ppcmac/module-setup.sh b/modules.d/90ppcmac/module-setup.sh index 83f54de64..bd6e4c139 100755 --- a/modules.d/90ppcmac/module-setup.sh +++ b/modules.d/90ppcmac/module-setup.sh @@ -23,11 +23,6 @@ check() { return 0 } -# called by dracut -depends() { - return 0 -} - # called by dracut installkernel() { pmac_model() { diff --git a/modules.d/95dasd/module-setup.sh b/modules.d/95dasd/module-setup.sh index c89d09eb8..f532e5585 100755 --- a/modules.d/95dasd/module-setup.sh +++ b/modules.d/95dasd/module-setup.sh @@ -8,11 +8,6 @@ check() { return 0 } -# called by dracut -depends() { - return 0 -} - # called by dracut install() { inst_multiple dasdconf.sh diff --git a/modules.d/95rootfs-block/module-setup.sh b/modules.d/95rootfs-block/module-setup.sh index 1ee9836de..afec0cf9b 100755 --- a/modules.d/95rootfs-block/module-setup.sh +++ b/modules.d/95rootfs-block/module-setup.sh @@ -1,10 +1,5 @@ #!/bin/bash -# called by dracut -check() { - return 0 -} - # called by dracut depends() { echo base fs-lib diff --git a/modules.d/95zfcp/module-setup.sh b/modules.d/95zfcp/module-setup.sh index 09a64207d..14a52b375 100755 --- a/modules.d/95zfcp/module-setup.sh +++ b/modules.d/95zfcp/module-setup.sh @@ -10,11 +10,6 @@ check() { return 0 } -# called by dracut -depends() { - return 0 -} - # called by dracut installkernel() { instmods zfcp diff --git a/modules.d/98dracut-systemd/module-setup.sh b/modules.d/98dracut-systemd/module-setup.sh index 6b8f42ae3..724b00b1d 100755 --- a/modules.d/98dracut-systemd/module-setup.sh +++ b/modules.d/98dracut-systemd/module-setup.sh @@ -26,10 +26,6 @@ depends() { return 0 } -installkernel() { - return 0 -} - # called by dracut install() { inst_script "$moddir/dracut-emergency.sh" /bin/dracut-emergency diff --git a/modules.d/98pollcdrom/module-setup.sh b/modules.d/98pollcdrom/module-setup.sh index 9684181b2..771d32f71 100755 --- a/modules.d/98pollcdrom/module-setup.sh +++ b/modules.d/98pollcdrom/module-setup.sh @@ -5,11 +5,6 @@ check() { return 255 } -# called by dracut -depends() { - return 0 -} - # called by dracut install() { inst_hook initqueue/settled 99 "$moddir/pollcdrom.sh" diff --git a/modules.d/98syslog/module-setup.sh b/modules.d/98syslog/module-setup.sh index 2909a5625..dde0f3684 100755 --- a/modules.d/98syslog/module-setup.sh +++ b/modules.d/98syslog/module-setup.sh @@ -6,11 +6,6 @@ check() { return 255 } -# called by dracut -depends() { - return 0 -} - # called by dracut install() { local _installs diff --git a/modules.d/99base/module-setup.sh b/modules.d/99base/module-setup.sh index 09bd27c4c..8a4b17c46 100755 --- a/modules.d/99base/module-setup.sh +++ b/modules.d/99base/module-setup.sh @@ -1,10 +1,5 @@ #!/bin/bash -# called by dracut -check() { - return 0 -} - # called by dracut depends() { echo udev-rules shell-interpreter diff --git a/modules.d/99fs-lib/module-setup.sh b/modules.d/99fs-lib/module-setup.sh index c2f5cedc5..0e611a21b 100755 --- a/modules.d/99fs-lib/module-setup.sh +++ b/modules.d/99fs-lib/module-setup.sh @@ -1,10 +1,5 @@ #!/bin/bash -# called by dracut -check() { - return 0 -} - echo_fs_helper() { local fs=$2 case "$fs" in diff --git a/modules.d/99shutdown/module-setup.sh b/modules.d/99shutdown/module-setup.sh index f53017ff8..7cb9c5f54 100755 --- a/modules.d/99shutdown/module-setup.sh +++ b/modules.d/99shutdown/module-setup.sh @@ -1,10 +1,5 @@ #!/bin/bash -# called by dracut -check() { - return 0 -} - # called by dracut depends() { echo base