mirror of
https://github.com/romkatv/powerlevel10k.git
synced 2024-12-23 15:41:57 +00:00
Simplify detect_virt segment
This commit is contained in:
parent
829c7ceaae
commit
b61d021abd
1 changed files with 4 additions and 8 deletions
|
@ -1046,18 +1046,14 @@ prompt_history() {
|
||||||
################################################################
|
################################################################
|
||||||
# Detection for virtualization (systemd based systems only)
|
# Detection for virtualization (systemd based systems only)
|
||||||
prompt_detect_virt() {
|
prompt_detect_virt() {
|
||||||
if ! command -v systemd-detect-virt > /dev/null; then
|
local virt=$(systemd-detect-virt 2> /dev/null)
|
||||||
return
|
|
||||||
fi
|
|
||||||
local virt=$(systemd-detect-virt)
|
|
||||||
if [[ "$virt" == "none" ]]; then
|
if [[ "$virt" == "none" ]]; then
|
||||||
if [[ "$(ls -di / | grep -o 2)" != "2" ]]; then
|
if [[ "$(ls -di / | grep -o 2)" != "2" ]]; then
|
||||||
virt="chroot"
|
virt="chroot"
|
||||||
"$1_prompt_segment" "$0" "$2" "$DEFAULT_COLOR" "yellow" "$virt"
|
|
||||||
else
|
|
||||||
;
|
|
||||||
fi
|
fi
|
||||||
else
|
fi
|
||||||
|
|
||||||
|
if [[ -n "${virt}" ]]; then
|
||||||
"$1_prompt_segment" "$0" "$2" "$DEFAULT_COLOR" "yellow" "$virt"
|
"$1_prompt_segment" "$0" "$2" "$DEFAULT_COLOR" "yellow" "$virt"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue