mirror of
https://github.com/speed47/spectre-meltdown-checker.git
synced 2026-06-17 12:03:09 +02:00
split script in multiple files, reassembled through build.sh
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
# vim: set ts=4 sw=4 sts=4 et:
|
||||
# Search dmesg for a pattern, returning nothing if the buffer has been truncated
|
||||
# Args: $1=grep_pattern
|
||||
# Sets: ret_dmesg_grep_grepped
|
||||
# Returns: 0=found, 1=not found, 2=dmesg truncated
|
||||
dmesg_grep() {
|
||||
ret_dmesg_grep_grepped=''
|
||||
if ! dmesg 2>/dev/null | grep -qE -e '(^|\] )Linux version [0-9]' -e '^FreeBSD is a registered'; then
|
||||
# dmesg truncated
|
||||
return 2
|
||||
fi
|
||||
ret_dmesg_grep_grepped=$(dmesg 2>/dev/null | grep -E "$1" | head -n1)
|
||||
# not found:
|
||||
[ -z "$ret_dmesg_grep_grepped" ] && return 1
|
||||
# found, output is in $ret_dmesg_grep_grepped
|
||||
return 0
|
||||
}
|
||||
|
||||
# Check whether the system is running CoreOS/Flatcar
|
||||
# Returns: 0 if CoreOS, 1 otherwise
|
||||
is_coreos() {
|
||||
command -v coreos-install >/dev/null 2>&1 && command -v toolbox >/dev/null 2>&1 && return 0
|
||||
return 1
|
||||
}
|
||||
Reference in New Issue
Block a user