]> arthur.barton.de Git - ax-zsh.git/blobdiff - install.sh
10_terminal: Add command to window title in iTerm.app
[ax-zsh.git] / install.sh
index b87b85546d6d58a3dd5a9b1d5b2dc8b66c4ac18b..0c50964d91ea1a282f7bf4a04bef0392da45d50d 100755 (executable)
@@ -4,6 +4,20 @@
 # Copyright (c) 2015 Alexander Barton <alex@barton.de>
 #
 
+# Include "ax-common.sh":
+for dir in "$HOME/lib" "$HOME/.ax" /usr/local /opt/ax /usr; do
+       [ -z "$ax_common_sourced" ] || break
+       ax_common="${dir}/lib/ax/ax-common.sh"
+       [ -r "$ax_common" ] && . "$ax_common"
+done
+if [ -z "$ax_common_sourced" ]; then
+       ax_msg() {
+               shift
+               echo "$@"
+       }
+fi
+unset dir ax_common ax_common_sourced
+
 safe_rm() {
        if [ -f "$1" -a ! -L "$1" ]; then
                rm -f "$1.bak" || exit 1
@@ -15,6 +29,9 @@ safe_rm() {
 umask 027
 
 [ -n "$AXZSH" ] || AXZSH="$HOME/.axzsh"
+export AXZSH
+
+ax_msg - "Installing AX-ZSH into \"$AXZSH\" ..."
 
 safe_rm "$AXZSH" || exit 1
 ln -sv "$PWD" "$AXZSH" || exit 1
@@ -23,3 +40,17 @@ for f in ~/.zlogin ~/.zlogout ~/.zprofile ~/.zshrc; do
        safe_rm "$f" || exit 1
        ln -sv "$AXZSH/ax.zsh" "$f" || exit 1
 done
+
+if [ ! -d "$AXZSH/active_plugins" ]; then
+       ax_msg - "Initializing plugin directory \"$AXZSH/active_plugins\" ..."
+       type zsh >/dev/null 2>&1
+       if [ $? -eq 0 ]; then
+               zsh "$AXZSH/bin/axzshctl" reset-plugins
+               exit $?
+       else
+               ax_msg 2 "Oops, \"zsh\" not found!?"
+               exit 1
+       fi
+else
+       ax_msg - "Plugin directory \"$AXZSH/active_plugins\" already exists. Ok."
+fi