Path: blob/master/pkg/cidata/cidata.TEMPLATE.d/boot/08-shell-prompt.sh
2658 views
#!/bin/sh12# SPDX-FileCopyrightText: Copyright The Lima Authors3# SPDX-License-Identifier: Apache-2.045set -eux67# This script is only intended for the default.yaml image, which is based on Ubuntu LTS89if [ "${LIMA_CIDATA_NAME}" = "default" ] && command -v patch >/dev/null 2>&1 && grep -q color_prompt "${LIMA_CIDATA_HOME}/.bashrc"; then1011! grep -q "^# Lima PS1" "${LIMA_CIDATA_HOME}/.bashrc" || exit 01213# Change the default shell prompt from "green" to "lime green" (#32CD32)1415patch --forward -r - "${LIMA_CIDATA_HOME}/.bashrc" <<'EOF'16@@ -37,7 +37,11 @@1718# set a fancy prompt (non-color, unless we know we "want" color)19case "$TERM" in20- xterm-color|*-256color) color_prompt=yes;;21+ xterm-color) color_prompt=yes;;22+ *-256color) color_prompt=256;;23+esac24+case "$COLORTERM" in25+ truecolor) color_prompt=true;;26esac2728# uncomment for a colored prompt, if the terminal has the capability; turned29@@ -56,7 +60,12 @@30fi31fi3233-if [ "$color_prompt" = yes ]; then34+# Lima PS1: set color to lime green35+if [ "$color_prompt" = true ]; then36+ PS1='${debian_chroot:+($debian_chroot)}\[\033[38;2;50;205;50m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '37+elif [ "$color_prompt" = 256 ]; then38+ PS1='${debian_chroot:+($debian_chroot)}\[\033[38;5;77m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '39+elif [ "$color_prompt" = yes ]; then40PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '41else42PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '43EOF4445fi464748