.dotfiles/setup.sh

110 lines
2.4 KiB
Bash
Raw Normal View History

2020-11-07 14:03:30 +01:00
#!/bin/bash
2020-11-07 15:58:15 +01:00
cd "$(dirname "$0")"
2020-11-07 14:03:30 +01:00
2020-11-08 21:55:05 +01:00
. ./helpers/installer.sh --source-only
. ./helpers/prompt.sh --source-only
. ./helpers/linker.sh --source-only
. ./helpers/multiselect.sh --source-only
echo "-- welcome to my setup script --"
echo "-- installing prerequesits (git, curl) --"
2020-11-07 15:58:15 +01:00
2021-01-20 21:22:53 +01:00
INTERACTIVE=$(tty -s && echo "true" || echo "false")
if [ $INTERACTIVE = "true" ]; then
if [ "$(prompt " - do you want to continue")" != "yes" ]; then
echo " alllrighty then, byyye"
exit
fi
2020-11-08 21:55:05 +01:00
fi
echo ""
2020-11-07 14:03:30 +01:00
#Prerequesits
2020-11-08 21:55:05 +01:00
echo "-- installing prerequisites --"
2020-11-07 14:03:30 +01:00
install git
install curl
2020-11-08 21:55:05 +01:00
echo "-----------------------------------"
#Make the selection
echo "-- what do you want to install? --"
OPTIONS_VALUES=("ZSH" "NVIM" "DRNV" "GVM" "NVM" "SDKM")
OPTIONS_LABELS=("zsh + oh-my-zsh" "Neovim" "Direnv" "Go Version Manager" "Node Version Manager" "Java Version Manager")
for i in "${!OPTIONS_VALUES[@]}"; do
OPTIONS_STRING+="${OPTIONS_VALUES[$i]} (${OPTIONS_LABELS[$i]});"
done
2021-01-20 21:22:53 +01:00
if [ $INTERACTIVE = "true" ]; then
multiselect SELECTED "$OPTIONS_STRING"
fi
2020-11-08 21:55:05 +01:00
# Variables
INST_ZSH=${SELECTED[0]}
INST_NVIM=${SELECTED[1]}
INST_DRNV=${SELECTED[2]}
INST_GVM=${SELECTED[3]}
INST_NVM=${SELECTED[4]}
INST_SDKM=${SELECTED[5]}
2021-01-20 21:22:53 +01:00
if [ $INTERACTIVE = "false" ]; then
2021-01-20 21:35:34 +01:00
INST_ZSH=true
2021-01-20 21:22:53 +01:00
fi
2020-11-08 21:55:05 +01:00
echo "-----------------------------------"
echo -e "-- installing programs --"
[[ "$INST_DRNV" = true ]] && install direnv
[[ "$INST_GVM" = true ]] && echo " - installing GVM"
[[ "$INST_NVM" = true ]] && echo " - installing NVM"
[[ "$INST_SDKM" = true ]] && echo " - installing SDKM"
echo "-- linking .dotfiles --"
2020-11-07 15:58:15 +01:00
linkFile .bashrc
linkFile .p10k.zsh
linkFile .dircolors
2020-11-08 21:55:05 +01:00
echo "-----------------------------------"
if [ "$INST_ZSH" = true ]; then
echo "-- installing oh-my-zsh --"
linkFile .zshrc
install zsh
2020-11-07 14:03:30 +01:00
2020-11-08 21:55:05 +01:00
zsh $(pwd)/install/oh-my-zsh.sh
zsh $(pwd)/install/zsh-autosuggestions.sh
zsh $(pwd)/install/p10k.sh
2020-11-07 15:58:15 +01:00
2020-11-08 21:55:05 +01:00
echo "-----------------------------------"
fi
2020-11-07 15:58:15 +01:00
2020-11-08 21:55:05 +01:00
if [ "$INST_NVIM" = true ]; then
install neovim
2020-11-08 21:55:05 +01:00
echo "-- Configuring Optixal's Neovim (https://github.com/Optixal/neovim-init.vim) --"
2020-11-08 21:55:05 +01:00
sh $(pwd)/install/install-config.sh
echo "-----------------------------------"
fi
2020-11-08 21:55:05 +01:00
if [ "$INST_ZSH" = true ]; then
# Change default shell
if [ $SHELL != $(which zsh) ]; then
echo " - changing default shell"
chsh -s $(which zsh)
export SHELL=$(which zsh)
fi
2020-11-08 21:55:05 +01:00
fi
# Change to home dir
cd ~
echo "-- ALL DONE --"
zsh