2974fa3f26
Currently kdump-dep-generator will source kdump-lib.sh. Notice kdump-dep-generator have #!/bin/sh so it should be POSIX, but kdump-lib.sh is a non-POSIX bash script. When Bash is configured to run in POSIX mode for #!/bin/sh scripts, it will fail with: /usr/lib/kdump/kdump-lib.sh: line 1042: syntax error near unexpected token `<' /usr/lib/kdump/kdump-lib.sh: line 1042: ` done < <( _crashkernel_parse "$ck")' This subshell call is easy to convert into a pipe but we should just source kdump-lib-initramfs.sh here, the only thing kdump-dep-generator needs is is_ssh_dump_target which is in kdump-lib-initramfs.sh, also prevents further POSIX violations. Signed-off-by: Kairui Song <kasong@tencent.com> Reviewed-by: Philipp Rudo <prudo@redhat.com>
24 lines
547 B
Bash
24 lines
547 B
Bash
#!/bin/sh
|
|
|
|
# More details about systemd generator:
|
|
# http://www.freedesktop.org/wiki/Software/systemd/Generators/
|
|
|
|
. /usr/lib/kdump/kdump-lib-initramfs.sh
|
|
. /usr/lib/kdump/kdump-logger.sh
|
|
|
|
# If invokded with no arguments for testing purpose, output to /tmp to
|
|
# avoid overriding the existing.
|
|
dest_dir="/tmp"
|
|
|
|
if [ -n "$1" ]; then
|
|
dest_dir=$1
|
|
fi
|
|
|
|
systemd_dir=/usr/lib/systemd/system
|
|
kdump_wants=$dest_dir/kdump.service.wants
|
|
|
|
if is_ssh_dump_target; then
|
|
mkdir -p $kdump_wants
|
|
ln -sf $systemd_dir/network-online.target $kdump_wants/
|
|
fi
|