Skip to content

Commit 72a8c37

Browse files
committed
Change the default prompt color from green to lime
Only do this for the "default" linux distribution Signed-off-by: Anders F Björklund <[email protected]>
1 parent 67e465e commit 72a8c37

File tree

3 files changed

+45
-0
lines changed

3 files changed

+45
-0
lines changed

docs/internal.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ Max file name length = 30
102102
The volume label is "cidata", as defined by [cloud-init NoCloud](https://cloudinit.readthedocs.io/en/latest/topics/datasources/nocloud.html).
103103

104104
### Environment variables
105+
- `LIMA_CIDATA_NAME`: the lima instance name
105106
- `LIMA_CIDATA_MNT`: the mount point of the disk. `/mnt/lima-cidata`.
106107
- `LIMA_CIDATA_USER`: the user name string
107108
- `LIMA_CIDATA_UID`: the numeric UID
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#!/bin/sh
2+
set -eux
3+
4+
if [ "${LIMA_CIDATA_NAME}" = "default" ]; then
5+
6+
! grep -q "^# Lima PS1" "/home/${LIMA_CIDATA_USER}.linux/.bashrc" || exit 0
7+
8+
# Change the default shell prompt from "green" to "lime" (#BFFF00)
9+
10+
patch --forward -r - "/home/${LIMA_CIDATA_USER}.linux/.bashrc" <<'EOF'
11+
@@ -37,7 +37,11 @@
12+
13+
# set a fancy prompt (non-color, unless we know we "want" color)
14+
case "$TERM" in
15+
- xterm-color|*-256color) color_prompt=yes;;
16+
+ xterm-color) color_prompt=yes;;
17+
+ *-256color) color_prompt=256;;
18+
+esac
19+
+case "$COLORTERM" in
20+
+ truecolor) color_prompt=true;;
21+
esac
22+
23+
# uncomment for a colored prompt, if the terminal has the capability; turned
24+
@@ -56,8 +60,13 @@
25+
fi
26+
fi
27+
28+
-if [ "$color_prompt" = yes ]; then
29+
- PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
30+
+# Lima PS1: set color to lime
31+
+if [ "$color_prompt" = true ]; then
32+
+ PS1='${debian_chroot:+($debian_chroot)}\[\033[38;2;192;255;0m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
33+
+elif [ "$color_prompt" = 256 ]; then
34+
+ PS1='${debian_chroot:+($debian_chroot)}\[\033[38;5;154m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
35+
+elif [ "$color_prompt" = yes ]; then
36+
+ PS1='${debian_chroot:+($debian_chroot)}\[\033[01;92m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
37+
else
38+
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
39+
fi
40+
fi
41+
EOF
42+
43+
fi

pkg/cidata/cidata.TEMPLATE.d/lima.env

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
LIMA_CIDATA_NAME={{ .Name }}
12
LIMA_CIDATA_USER={{ .User }}
23
LIMA_CIDATA_UID={{ .UID }}
34
LIMA_CIDATA_MOUNTS={{ len .Mounts }}

0 commit comments

Comments
 (0)