Skip to content

Commit dfdaf14

Browse files
author
Pingfan Liu
committed
kdumpctl: Move _is_osbuild() to kdump-lib.sh
_is_osbuild() will be used in kdump-lib.sh, so moving it from kdumpctl to kdump-lib.sh Signed-off-by: Pingfan Liu <[email protected]>
1 parent d79ce00 commit dfdaf14

File tree

2 files changed

+19
-19
lines changed

2 files changed

+19
-19
lines changed

kdump-lib.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,25 @@ FADUMP_APPEND_ARGS_SYS_NODE="/sys/kernel/fadump/bootargs_append"
1717
# shellcheck disable=SC2034
1818
FENCE_KDUMP_CONFIG_FILE="/etc/sysconfig/fence_kdump"
1919

20+
# read the value of an environ variable from given environ file path
21+
#
22+
# The environment variable entries in /proc/[pid]/environ are separated
23+
# by null bytes instead of by spaces.
24+
#
25+
# $1: environment variable
26+
# $2: environ file path
27+
read_proc_environ_var()
28+
{
29+
local _var=$1 _environ_path=$2
30+
sed -n -E "s/.*(^|\x00)${_var}=([^\x00]*).*/\2/p" < "$_environ_path"
31+
}
32+
33+
_OSBUILD_ENVIRON_PATH='/proc/1/environ'
34+
_is_osbuild()
35+
{
36+
[[ $(read_proc_environ_var container "$_OSBUILD_ENVIRON_PATH") == bwrap-osbuild ]]
37+
}
38+
2039
is_uki()
2140
{
2241
local img

kdumpctl

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1752,25 +1752,6 @@ reset_crashkernel_after_update()
17521752
done
17531753
}
17541754

1755-
# read the value of an environ variable from given environ file path
1756-
#
1757-
# The environment variable entries in /proc/[pid]/environ are separated
1758-
# by null bytes instead of by spaces.
1759-
#
1760-
# $1: environment variable
1761-
# $2: environ file path
1762-
read_proc_environ_var()
1763-
{
1764-
local _var=$1 _environ_path=$2
1765-
sed -n -E "s/.*(^|\x00)${_var}=([^\x00]*).*/\2/p" < "$_environ_path"
1766-
}
1767-
1768-
_OSBUILD_ENVIRON_PATH='/proc/1/environ'
1769-
_is_osbuild()
1770-
{
1771-
[[ $(read_proc_environ_var container "$_OSBUILD_ENVIRON_PATH") == bwrap-osbuild ]]
1772-
}
1773-
17741755
reset_crashkernel_for_installed_kernel()
17751756
{
17761757
local _installed_kernel

0 commit comments

Comments
 (0)