aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPádraig Brady <pbrady@redhat.com>2012-08-08 21:56:17 +0100
committerBill Nottingham <notting@redhat.com>2012-09-14 15:59:19 -0400
commit8d627ea4b403a8c291b3b26e5bf42af147da8717 (patch)
treecaef99d1989b66fa94e30bdaa1a64ecaf60f810b
parent02ca71f53ca1fe26a416b20a8a6b392565f74b57 (diff)
downloadinitscripts-8d627ea4b403a8c291b3b26e5bf42af147da8717.tar
initscripts-8d627ea4b403a8c291b3b26e5bf42af147da8717.tar.gz
initscripts-8d627ea4b403a8c291b3b26e5bf42af147da8717.tar.bz2
initscripts-8d627ea4b403a8c291b3b26e5bf42af147da8717.tar.xz
initscripts-8d627ea4b403a8c291b3b26e5bf42af147da8717.zip
Enable 256 color terminals by default
-rw-r--r--Makefile1
-rw-r--r--term256.csh27
-rw-r--r--term256.sh28
3 files changed, 56 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index e3be9e3e..cc3231b2 100644
--- a/Makefile
+++ b/Makefile
@@ -24,6 +24,7 @@ install:
install -m644 rwtab statetab networks $(ROOT)/etc
install -m755 service setsysfont $(ROOT)/sbin
install -m644 lang.csh lang.sh $(ROOT)/etc/profile.d
+ install -m644 term256.csh term256.sh $(ROOT)/etc/profile.d
install -m644 debug.csh debug.sh $(ROOT)/etc/profile.d
install -m755 sys-unconfig $(ROOT)/usr/sbin
install -m644 service.8 sys-unconfig.8 $(ROOT)$(mandir)/man8
diff --git a/term256.csh b/term256.csh
new file mode 100644
index 00000000..1197512c
--- /dev/null
+++ b/term256.csh
@@ -0,0 +1,27 @@
+# Enable 256 color capabilities for appropriate terminals
+
+# Uncomment this if you want remote xterms connecting
+# to this system, to be sent 256 colors. Note that
+# local xterms, ssh'ing to localhost are considered
+# remote in this context, but in that case, $TERM should
+# have already been set to 256 color capable.
+# SEND_256_COLORS_TO_REMOTE=1
+
+# Terminals with any of the following set, support 256 colors (and are local)
+set local256="$?COLORTERM$?XTERM_VERSION$?ROXTERM_ID$?KONSOLE_DBUS_SESSION"
+
+if ($?TERM && ($local256 || $?SEND_256_COLORS_TO_REMOTE)) then
+
+ switch ($TERM)
+ case 'xterm':
+ case 'screen':
+ case 'Eterm':
+ setenv TERM "$TERM-256color"
+ endsw
+
+ if ($?TERMCAP && ($TERM == "screen-256color")) then
+ setenv TERMCAP `echo "$TERMCAP" | sed -e 's/Co#8/Co#256/g'`
+ endif
+endif
+
+unset local256
diff --git a/term256.sh b/term256.sh
new file mode 100644
index 00000000..43d45ce6
--- /dev/null
+++ b/term256.sh
@@ -0,0 +1,28 @@
+# Enable 256 color capabilities for appropriate terminals
+
+# Uncomment this if you want remote xterms connecting
+# to this system, to be sent 256 colors. Note that
+# local xterms, ssh'ing to localhost are considered
+# remote in this context, but in that case, $TERM should
+# have already been set to 256 color capable.
+# SEND_256_COLORS_TO_REMOTE=1
+
+# Terminals with any of the following set, support 256 colors (and are local)
+local256="$COLORTERM$XTERM_VERSION$ROXTERM_ID$KONSOLE_DBUS_SESSION"
+
+if [ -n "$local256" ] || [ -n "$SEND_256_COLORS_TO_REMOTE" ]; then
+
+ case "$TERM" in
+ 'xterm') TERM=xterm-256color;;
+ 'screen') TERM=screen-256color;;
+ 'Eterm') TERM=Eterm-256color;;
+ esac
+ export TERM
+
+ if [ -n "$TERMCAP" ] && [ "$TERM" = "screen-256color" ]; then
+ TERMCAP=$(echo "$TERMCAP" | sed -e 's/Co#8/Co#256/g')
+ export TERMCAP
+ fi
+fi
+
+unset local256