bin/git-branch-dates: Smarter automatic line truncation
[dotfiles.git] / .bash_profile
index 997404022d2d6f2df25a90b6d84be943e10b5534..be7ef93e81c4c2eb05c5fac93c9580eb1351b95c 100644 (file)
@@ -5,8 +5,22 @@ if [ -f ~/.bashrc ]; then
   source ~/.bashrc
 fi
 
-# keychain
-if [ -f ~/.ssh/id_dsa ]; then
-  /usr/bin/keychain -q ~/.ssh/id_dsa
-  source ~/.keychain/`hostname`-sh > /dev/null
+# Set mintty color-palette
+if [ "$UNAME" = "Cygwin" ]; then
+  source ~/.mintty/colors/solarized-ansi.sh
 fi
+
+# keychain
+keychain=$(type -P keychain)
+test -n "$keychain" && \
+  test -z "$SUDO_USER" && {
+  ids=""
+  test -f ~/.ssh/id_rsa && ids="$ids id_rsa"
+  test -f ~/.ssh/id_ed25519 && ids="$ids id_ed25519"
+  if [ -n "$ids" ]; then
+    eval `$keychain -q $ids`
+    source ~/.keychain/`hostname`-sh > /dev/null
+  fi
+  unset ids
+}
+unset keychain