From aca4e2a9b1c4293889cc93d163712a69481d3b71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Lesimple?= Date: Fri, 11 Aug 2023 17:10:35 +0200 Subject: [PATCH] enh: move root warning to the bottom --- spectre-meltdown-checker.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/spectre-meltdown-checker.sh b/spectre-meltdown-checker.sh index 66afb8d..efe952a 100755 --- a/spectre-meltdown-checker.sh +++ b/spectre-meltdown-checker.sh @@ -2441,13 +2441,6 @@ if [ "$opt_cpu" != all ] && [ "$opt_cpu" -gt "$max_core_id" ]; then fi if [ "$opt_live" = 1 ]; then - # root check (only for live mode, for offline mode, we already checked if we could read the files) - if [ "$(id -u)" -ne 0 ]; then - _warn "Note that you should launch this script with root privileges to get accurate information." - _warn "We'll proceed but you might see permission denied errors." - _warn "To run it as root, you can try the following command: sudo $0" - _warn - fi _info "Checking for vulnerabilities on current system" _info "Kernel is \033[35m$os $(uname -r) $(uname -v) $(uname -m)\033[0m" _info "CPU is \033[35m$cpu_friendly_name\033[0m" @@ -6326,6 +6319,13 @@ if [ -n "$mockme" ] && [ "$opt_mock" = 1 ]; then _warn "To mock this CPU, set those vars: "$(echo "$mockme" | sort -u) fi +# root check +if [ "$(id -u)" -ne 0 ]; then + _warn "Note that you should launch this script with root privileges to get completely accurate information." + _warn "To run it as root, you can try the following command: sudo $0" + _warn +fi + if [ "$opt_explain" = 0 ]; then _info "Need more detailed information about mitigation options? Use --explain" fi