summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarel Kočí <karel.koci@nic.cz>2019-12-10 12:24:34 +0100
committerKarel Kočí <karel.koci@nic.cz>2019-12-10 12:24:34 +0100
commitac157ebc5a8450b7431ec60062a0f294a939b587 (patch)
treec59de596a131f7e19b0090d162dbd2e9b47de9d8
parentdf160a6e5daae5910e4f044ed35f8cb46a3638c1 (diff)
downloadalpine-personal-pkgs-ac157ebc5a8450b7431ec60062a0f294a939b587.tar.gz
alpine-personal-pkgs-ac157ebc5a8450b7431ec60062a0f294a939b587.tar.bz2
alpine-personal-pkgs-ac157ebc5a8450b7431ec60062a0f294a939b587.zip
shellrc: add prompt for ash
-rw-r--r--shellrc/APKBUILD3
-rwxr-xr-xshellrc/prompt.sh12
2 files changed, 14 insertions, 1 deletions
diff --git a/shellrc/APKBUILD b/shellrc/APKBUILD
index a60f9c6..c281eb4 100644
--- a/shellrc/APKBUILD
+++ b/shellrc/APKBUILD
@@ -2,7 +2,7 @@
# Maintainer: Karel Kočí <cynerd@email.cz>
pkgname=shellrc
pkgver=0.7.5
-pkgrel=1
+pkgrel=2
pkgdesc="Shell initialization files"
url="https://git.cynerd.cz/shellrc/"
arch="noarch"
@@ -13,6 +13,7 @@ options="!check"
package() {
"$builddir/install" --prefix "$pkgdir"
+ cp prompt.sh "$pkgdir/etc/profile.d/prompt.sh"
}
zsh() {
diff --git a/shellrc/prompt.sh b/shellrc/prompt.sh
new file mode 100755
index 0000000..7a857da
--- /dev/null
+++ b/shellrc/prompt.sh
@@ -0,0 +1,12 @@
+# Better prompt
+case "$TERM" in
+ xterm*|rxvt*)
+ export PS1='$(EC=$?
+[ $EC = 0 ] || echo -n "\e[1;33m$EC:"
+if [ `id -u` -eq "0" ]; then
+ echo -n "\[\e[1;31m\]\u@\h:\[\e[1;34m\]\W\[\e[1;31m\]\$\[\e[0m\] "
+else
+ echo -n "\[\e[1;32m\]\u@\h:\[\e[1;34m\]\W\[\e[1;32m\]\$\[\e[0m\] "
+fi)'
+ ;;
+esac