]> arthur.barton.de Git - ax-zsh.git/blob - install.sh
install.sh: export AXZSH variable
[ax-zsh.git] / install.sh
1 #!/bin/sh
2 #
3 # AX-ZSH: Alex' Modular ZSH Configuration
4 # Copyright (c) 2015 Alexander Barton <alex@barton.de>
5 #
6
7 safe_rm() {
8         if [ -f "$1" -a ! -L "$1" ]; then
9                 rm -f "$1.bak" || exit 1
10                 mv -v "$1" "$1.bak" || exit 1
11         fi
12         rm -f "$1" || exit 1
13 }
14
15 umask 027
16
17 [ -n "$AXZSH" ] || AXZSH="$HOME/.axzsh"
18 export AXZSH
19
20 echo "* Installing AX-ZSH into \"$AXZSH\" ..."
21
22 safe_rm "$AXZSH" || exit 1
23 ln -sv "$PWD" "$AXZSH" || exit 1
24
25 for f in ~/.zlogin ~/.zlogout ~/.zprofile ~/.zshrc; do
26         safe_rm "$f" || exit 1
27         ln -sv "$AXZSH/ax.zsh" "$f" || exit 1
28 done
29
30 if [ ! -d "$AXZSH/active_plugins" ]; then
31         echo "* Initializing plugin directory \"$AXZSH/active_plugins\" ..."
32         zsh "$AXZSH/bin/axzshctl" reset-plugins
33 else
34         echo "* Plugin directory \"$AXZSH/active_plugins\" already exists. Ok."
35 fi