summaryrefslogtreecommitdiff
path: root/shellrc
diff options
context:
space:
mode:
authorKarel Kočí <karel.koci@nic.cz>2019-05-02 09:51:43 +0200
committerKarel Kočí <karel.koci@nic.cz>2019-05-02 09:51:43 +0200
commit311356df14662edce3c855fec1b9b5daad516be7 (patch)
tree634b4fdd1f9efc2366c34ac8080cf4c4fb5cd4e5 /shellrc
parent146a09e0a4ccc92459f5611d74536c3a6d3af911 (diff)
downloadopenwrt-personal-pkgs-311356df14662edce3c855fec1b9b5daad516be7.tar.gz
openwrt-personal-pkgs-311356df14662edce3c855fec1b9b5daad516be7.tar.bz2
openwrt-personal-pkgs-311356df14662edce3c855fec1b9b5daad516be7.zip
shellrc: add color prompt
Diffstat (limited to 'shellrc')
-rw-r--r--shellrc/Makefile4
-rw-r--r--shellrc/files/profile.prompt.sh12
2 files changed, 15 insertions, 1 deletions
diff --git a/shellrc/Makefile b/shellrc/Makefile
index 5cf70a9..d13cd06 100644
--- a/shellrc/Makefile
+++ b/shellrc/Makefile
@@ -8,7 +8,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=shellrc
-PKG_RELEASE:=1
+PKG_RELEASE:=2
PKG_SOURCE_URL:=https://git.cynerd.cz/shellrc
PKG_MAINTAINER:=Karel Kočí <cynerd@email.cz>
@@ -33,6 +33,8 @@ Build/Compile:=:
define Package/$(PKG_NAME)/install
$(PKG_BUILD_DIR)/install --prefix "$(1)"
+ $(INSTALL_DIR) $(1)/etc/profile.d
+ $(INSTALL_DATA) ./files/profile.prompt.sh $(1)/etc/profile.d/prompt.sh
endef
define Package/$(PKG_NAME)-bash/install
diff --git a/shellrc/files/profile.prompt.sh b/shellrc/files/profile.prompt.sh
new file mode 100644
index 0000000..122a35b
--- /dev/null
+++ b/shellrc/files/profile.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