X-Git-Url: https://arthur.barton.de/gitweb/?a=blobdiff_plain;f=install.sh;h=526256cb9dfb9b8331466b3b7cae2e6dd60c0597;hb=ae12b745b56317dd84fe7f31f5678184353ed97b;hp=8cb92e3bc25aa32c3b0c9cc6ea8f958483fdfcac;hpb=23f0f61d7227124e73b14cff56113aefe97ddf61;p=ax-zsh.git diff --git a/install.sh b/install.sh index 8cb92e3..526256c 100755 --- a/install.sh +++ b/install.sh @@ -4,6 +4,20 @@ # Copyright (c) 2015 Alexander Barton # +# 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 @@ -12,10 +26,24 @@ safe_rm() { rm -f "$1" || exit 1 } +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 + for f in ~/.zlogin ~/.zlogout ~/.zprofile ~/.zshrc; do safe_rm "$f" || exit 1 - ln -sv "$PWD/ax.zsh" "$f" || exit 1 + ln -sv "$AXZSH/ax.zsh" "$f" || exit 1 done -safe_rm ~/.axzsh || exit 1 -ln -sv "$PWD" ~/.axzsh || exit 1 +if [ ! -d "$AXZSH/active_plugins" ]; then + ax_msg - "Initializing plugin directory \"$AXZSH/active_plugins\" ..." + zsh "$AXZSH/bin/axzshctl" reset-plugins +else + ax_msg - "Plugin directory \"$AXZSH/active_plugins\" already exists. Ok." +fi