.dotfiles/setup.sh

99 lines
2.2 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
2020-11-08 21:55:05 +01:00
if [ "$(prompt " - do you want to continue")" != "yes" ]; then
echo " alllrighty then, byyye"
exit
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
multiselect SELECTED "$OPTIONS_STRING"
# 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]}
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