]> arthur.barton.de Git - ax-zsh.git/blobdiff - install.sh
install.sh: Fix ax_msg() fallback function
[ax-zsh.git] / install.sh
index 2572990f3efb8ec780fa447f48d1c60f3158969a..526256cb9dfb9b8331466b3b7cae2e6dd60c0597 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
@@ -17,7 +31,7 @@ umask 027
 [ -n "$AXZSH" ] || AXZSH="$HOME/.axzsh"
 export AXZSH
 
-echo "* Installing AX-ZSH into \"$AXZSH\" ..."
+ax_msg - "Installing AX-ZSH into \"$AXZSH\" ..."
 
 safe_rm "$AXZSH" || exit 1
 ln -sv "$PWD" "$AXZSH" || exit 1
@@ -28,8 +42,8 @@ for f in ~/.zlogin ~/.zlogout ~/.zprofile ~/.zshrc; do
 done
 
 if [ ! -d "$AXZSH/active_plugins" ]; then
-       echo "* Initializing plugin directory \"$AXZSH/active_plugins\" ..."
+       ax_msg - "Initializing plugin directory \"$AXZSH/active_plugins\" ..."
        zsh "$AXZSH/bin/axzshctl" reset-plugins
 else
-       echo "* Plugin directory \"$AXZSH/active_plugins\" already exists. Ok."
+       ax_msg - "Plugin directory \"$AXZSH/active_plugins\" already exists. Ok."
 fi