kexec-tools/kdump-dep-generator.sh
WANG Chao ed12e00218 kdump-dep-generator: Add kdump service dependencies on the fly
kdump-dep-generator is a systemd generator, used to write out kdump
service dependencies.

Currently it's only useful for ssh dump case. And in ssh dump case, it
writes out a dependency which kdump.service "Wants"
network-online.target:

  # ls -l /run/systemd/generator/kdump.service.wants/
  [..] network-online.target -> /usr/lib/systemd/system/network-online.target

So that kdump.service will pull in network-online.target and delayed
start until network-online.target is reached.

In the future, we could use generator to write out kdump.service
dynamically and get rid of the static defined kdump.service at all.

v1->v2:
Vivek: not using hardcoded run time generator path, use what systemd pass in.

Signed-off-by: WANG Chao <chaowang@redhat.com>
Acked-by: Vivek Goyal <vgoyal@redhat.com>
2014-04-17 11:27:31 +08:00

23 lines
504 B
Bash

#!/bin/sh
# More details about systemd generator:
# http://www.freedesktop.org/wiki/Software/systemd/Generators/
. /usr/lib/kdump/kdump-lib.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