From: Ondrej Dubaj Date: Thu, 29 Aug 2019 12:31:06 +0000 (+0200) Subject: added debug-shell to initrd in systemd version >= 240 X-Git-Tag: 050~159 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=707d4e79feadb475b79fd8f15dd2fea70aa79869;p=thirdparty%2Fdracut.git added debug-shell to initrd in systemd version >= 240 --- diff --git a/modules.d/00systemd/module-setup.sh b/modules.d/00systemd/module-setup.sh index feec6ca5a..f931d0ab5 100755 --- a/modules.d/00systemd/module-setup.sh +++ b/modules.d/00systemd/module-setup.sh @@ -1,15 +1,21 @@ #!/bin/bash +getSystemdVersion() { + SYSTEMD_VERSION=$($systemdutildir/systemd --version | { read a b a; echo $b; }) + # Check if the systemd version is a valid number + if ! [[ $SYSTEMD_VERSION =~ ^[0-9]+$ ]]; then + dfatal "systemd version is not a number ($SYSTEMD_VERSION)" + exit 1 + fi + + echo $SYSTEMD_VERSION +} + # called by dracut check() { [[ $mount_needs ]] && return 1 if require_binaries $systemdutildir/systemd; then - SYSTEMD_VERSION=$($systemdutildir/systemd --version | { read a b a; echo $b; }) - # Check if the systemd version is a valid number - if ! [[ $SYSTEMD_VERSION =~ ^[0-9]+$ ]]; then - dfatal "systemd version is not a number ($SYSTEMD_VERSION)" - exit 1 - fi + SYSTEMD_VERSION=$(getSystemdVersion) (( $SYSTEMD_VERSION >= 198 )) && return 0 return 255 fi @@ -36,6 +42,12 @@ install() { exit 1 fi + if [ $(getSystemdVersion) -ge 240 ]; then + inst_multiple -o \ + $systemdutildir/system-generators/systemd-debug-generator \ + $systemdsystemunitdir/debug-shell.service + fi + inst_multiple -o \ $systemdutildir/systemd \ $systemdutildir/systemd-coredump \