aboutsummaryrefslogtreecommitdiffstats
path: root/install.sh
diff options
context:
space:
mode:
authorYann Herklotz <ymherklotz@gmail.com>2018-08-27 18:53:02 +0100
committerYann Herklotz <ymherklotz@gmail.com>2018-08-27 18:53:02 +0100
commitc389d95f5f0ea71000678cf8495eb0d0687603bc (patch)
tree028cc864806a8fe0661c630953fd4562fe9a545e /install.sh
parent202dc06ba35846508d8eade5b1674ed3558ddef0 (diff)
downloaddotfiles-c389d95f5f0ea71000678cf8495eb0d0687603bc.tar.gz
dotfiles-c389d95f5f0ea71000678cf8495eb0d0687603bc.zip
Adding options to install script
Diffstat (limited to 'install.sh')
-rwxr-xr-x[-rw-r--r--]install.sh131
1 files changed, 111 insertions, 20 deletions
diff --git a/install.sh b/install.sh
index 9b5ca42..a5d8ad2 100644..100755
--- a/install.sh
+++ b/install.sh
@@ -2,40 +2,131 @@
SCRIPT_DIR=$(dirname "$(readlink -f "$0")")
-EXTRA_OPTS=" -s "
+function print_help {
+ echo "Install configuration options to the correct paths."
+ echo ""
+ echo " USAGE:"
+ echo " install.sh [OPTIONS] [PROG [PROG ...]]"
+ echo ""
+ echo " OPTIONS:"
+ echo " -f, --force Force and overwrite current"
+ echo " configurations."
+ echo " -h, --help Print this help message."
+ echo " PROG The program for which the config should"
+ echo " be installed. If this is left empty it will"
+ echo " install all the configurations. More that"
+ echo " one can be specified."
+ echo ""
+ echo " EXAMPLE:"
+ echo " install.sh -f emacs X tmux i3"
+}
+
+function ln_configs {
+ ln $EXTRA_OPTS ${SCRIPT_DIR}/${1} $2
+}
+
+function mk {
+ if [[ $FORCE -eq 1 ]]; then
+ mkdir -p "$1"
+ fi
+}
+EXTRA_OPTS=" -s "
for i in "$@"; do
case $i in
-f | --force)
EXTRA_OPTS+=" -f "
+ FORCE=1
+ ;;
+
+ -h | --help)
+ print_help
+ exit 0
;;
+ emacs) EMACS=1; NOT_ALL=1;;
+ X) X=1; NOT_ALL=1;;
+ tmux) TMUX=1; NOT_ALL=1;;
+ i3) I3=1; NOT_ALL=1;;
+ zsh) ZSH=1; NOT_ALL=1;;
+ isync) ISYNC=1; NOT_ALL=1;;
+ polybar) POLYBAR=1; NOT_ALL=1;;
+ compton) COMPTON=1; NOT_ALL=1;;
+ firefox) FIREFOX=1; NOT_ALL=1;;
+ ncmpcpp) NCMPCPP=1; NOT_ALL=1;;
+ mpd) MPD=1; NOT_ALL=1;;
+
+ *)
+ print_help
+ exit 1
+
esac
done
-function ln_configs {
- ln $EXTRA_OPTS ${SCRIPT_DIR}/${1} $2
-}
+if [[ ! -z $EMACS ]] || [[ -z $NOT_ALL ]]; then
+ echo "Installing emacs config..."
+ mk ~/.emacs.d
+ cp ${SCRIPT_DIR}/emacs/init.el ~/.emacs.d/init.el
+ ln_configs emacs/loader.org ~/.emacs.d/loader.org
+fi
+
+if [[ ! -z $X ]] || [[ -z $NOT_ALL ]]; then
+ echo "Installing X config..."
+ ln_configs X/.Xmodmap ~/.Xmodmap
+ ln_configs X/.Xresources ~/.Xresources
+ ln_configs X/.xinitrc ~/.xinitrc
+fi
+
+if [[ ! -z $TMUX ]] || [[ -z $NOT_ALL ]]; then
+ echo "Installing tmux config..."
+ ln_configs tmux/.tmux.conf ~/.tmux.conf
+fi
+
+if [[ ! -z $I3 ]] || [[ -z $NOT_ALL ]]; then
+ echo "Installing i3 config..."
+ mk ~/.config/i3
+ ln_configs i3/config ~/.config/i3/config
+fi
+
+if [[ ! -z $ZSH ]] || [[ -z $NOT_ALL ]]; then
+ echo "Installing zsh config..."
+ ln_configs zsh/.zshrc ~/.zshrc
+ ln_configs zsh/.zsh ~/.zsh
+fi
-echo "Installing emacs config..."
-cp ${current_dir}/emacs/init.el ~/.emacs.d/init.el
-ln_configs emacs/loader.org ~/.emacs.d/loader.org
+if [[ ! -z $ISYNC ]] || [[ -z $NOT_ALL ]]; then
+ echo "Installing isync config..."
+ ln_configs isync/.mbsyncrc ~/.mbsyncrc
+fi
-echo "Installing X config..."
-ln_configs X/.Xmodmap ~/.Xmodmap
-ln_configs X/.Xresources ~/.Xresources
-ln_configs X/.xinitrc ~/.xinitrc
+if [[ ! -z $POLYBAR ]] || [[ -z $NOT_ALL ]]; then
+ echo "Installing polybar config..."
+ mk ~/.config/polybar
+ ln_configs polybar/config ~/.config/polybar/config
+ ln_configs polybar/launch.sh ~/.config/polybar/launch.sh
+fi
-echo "Installing tmux config..."
-ln_configs tmux/.tmux.conf ~/.tmux.conf
+if [[ ! -z $COMPTON ]] || [[ -z $NOT_ALL ]]; then
+ echo "Installing compton config..."
+ mk ~/.config
+ ln_configs compton/compton.conf ~/.config/compton.conf
+fi
-echo "Installing i3 config..."
-ln_configs i3/config ~/.config/i3/config
+if [[ ! -z $FIREFOX ]] || [[ -z $NOT_ALL ]]; then
+ echo "Installing firefox config..."
+ ln_configs firefox/userChrome.css ~/.mozilla/firefox/1ye8etqv.default/chrome/userChrome.css
+fi
-echo "Installing zsh config..."
-ln_configs zsh/.zshrc ~/.zshrc
-ln_configs zsh/.zsh ~/.zsh
+if [[ ! -z $NCMPCPP ]] || [[ -z $NOT_ALL ]]; then
+ echo "Installing ncmpcpp config..."
+ mk ~/.ncmpcpp
+ ln_configs ncmpcpp/bindings ~/.ncmpcpp/bindings
+ ln_configs ncmpcpp/config ~/.ncmpcpp/config
+fi
-echo "Installing isync config..."
-ln_configs isync/.mbsyncrc ~/.mbsyncrc
+if [[ ! -z $MPD ]] || [[ -z $NOT_ALL ]]; then
+ echo "Installing mpd config..."
+ mk ~/.config/mpd
+ ln_configs mpd/mpd.conf ~/.config/mpd/mpd.conf
+fi