CoreOS: warn if launched without --coreos option

This commit is contained in:
Stéphane Lesimple 2018-01-15 12:44:18 +01:00
parent 1f2543cfeb
commit 2cd55f5445
1 changed files with 12 additions and 1 deletions

View File

@ -516,6 +516,12 @@ unload_cpuid()
fi
}
is_coreos()
{
which coreos-install >/dev/null && which toolbox >/dev/null && return 0
return 1
}
# check for mode selection inconsistency
if [ "$opt_live_explicit" = 1 ]; then
if [ -n "$opt_kernel" -o -n "$opt_config" -o -n "$opt_map" ]; then
@ -527,7 +533,7 @@ fi
# coreos mode
if [ "$opt_coreos" = 1 ]; then
if ! which coreos-install || ! which toolbox; then
if ! is_coreos; then
_warn "CoreOS mode asked, but we're not under CoreOS!"
exit 255
fi
@ -541,6 +547,11 @@ if [ "$opt_coreos" = 1 ]; then
unload_cpuid
unload_msr
exit $exitcode
else
if is_coreos; then
_warn "You seem to be running CoreOS, you might want to use the --coreos option for better results"
_warn
fi
fi
# root check (only for live mode, for offline mode, we already checked if we could read the files)