changeset 422:9d016276d889

Added compatibility with joyent's smartos.
author Edho Arief <edho@myconan.net>
date Wed, 19 Dec 2012 05:35:43 +0000
parents 6e682757a5f7
children f4a29755dd01
files rc/bashrc
diffstat 1 files changed, 23 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/rc/bashrc	Tue Dec 11 23:36:20 2012 +0700
+++ b/rc/bashrc	Wed Dec 19 05:35:43 2012 +0000
@@ -87,24 +87,31 @@
       [ -d "${i}" ] && PATH="${PATH}:${i}"
     done
     [ -d "/opt/csw/gnu" ] && PATH="/opt/csw/gnu:${PATH}"
+    # Joyent's pkgsrc is awesome.
+    [ -d /opt/local ] && PATH="/opt/local/bin:/opt/local/sbin:${PATH}"
+    # Working terminfo (as opposed to solaris' mostly-broken terminfo).
+    [ -d /opt/local/share/lib/terminfo ] && export TERMINFO=/opt/local/share/lib/terminfo
     alias ping="ping -s"
     alias ping6="ping -A inet6"
-    # Hello tmux. Perhaps one day we'll have title with dtterm.
-    # But for now we work this around by prepending tmux call with xterm-256color
-    # which hopefully exists. Otherwise we have to live with no title.
-    case "${TERM}" in
-      xterm*)
-        if [ -f "/usr/share/lib/terminfo/x/xterm-256color" ]; then
-          export TERM="xterm-256color"
-        else
-          echo "No xterm-256color terminal, using dtterm. Tmux title won't work."
-          export TERM="dtterm"
-        fi
-      ;;
-      screen)
-        [ -f "/usr/share/lib/terminfo/s/screen" ] || export TERM="dtterm"
-      ;;
-    esac
+    # Check if we have sane(?) terminfo, assume broken terminfo otherwise.
+    if [ -z "${TERMINFO}" ]; then
+      # Hello tmux. Perhaps one day we'll have title with dtterm.
+      # But for now we work this around by prepending tmux call with xterm-256color
+      # which hopefully exists. Otherwise we have to live with no title.
+      case "${TERM}" in
+        xterm*)
+          if [ -f "/usr/share/lib/terminfo/x/xterm-256color" ]; then
+            export TERM="xterm-256color"
+          else
+            echo "No xterm-256color terminal, using dtterm. Tmux title won't work."
+            export TERM="dtterm"
+          fi
+        ;;
+        screen)
+          [ -f "/usr/share/lib/terminfo/s/screen" ] || export TERM="dtterm"
+        ;;
+      esac
+    fi
     if command -v ggrep > /dev/null 2>&1; then
       _has_gnu_grep=y
       _grep="ggrep"