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
|
|
|
|
2021-08-19 16:10:28 +02:00
|
|
|
INTERACTIVE=$(tty -s && echo "true" || echo "false")
|
|
|
|
|
2021-06-22 13:05:12 +02:00
|
|
|
#Loading all the helper scripts
|
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
|
2021-06-22 13:05:12 +02:00
|
|
|
. ./helpers/asdf-install.sh --source-only
|
2020-11-08 21:55:05 +01:00
|
|
|
|
|
|
|
echo "-- welcome to my setup script --"
|
2020-11-07 15:58:15 +01:00
|
|
|
|
2021-08-19 16:09:20 +02:00
|
|
|
if [ "$(which git)" = "" ] && ["$(which curl)" = ""]; then
|
2021-01-20 21:22:53 +01:00
|
|
|
|
2021-08-19 16:09:20 +02:00
|
|
|
echo "-- installing prerequesits (git, curl) --"
|
|
|
|
|
|
|
|
if [ $INTERACTIVE = "true" ]; then
|
|
|
|
if [ "$(prompt " - do you want to continue")" != "yes" ]; then
|
|
|
|
echo " alllrighty then, byyye"
|
|
|
|
exit
|
|
|
|
fi
|
2021-01-20 21:22:53 +01:00
|
|
|
fi
|
2020-11-08 21:55:05 +01:00
|
|
|
|
2021-08-19 16:09:20 +02:00
|
|
|
echo ""
|
2020-11-07 14:03:30 +01:00
|
|
|
|
2021-08-19 16:09:20 +02:00
|
|
|
#Prerequesits
|
|
|
|
echo "-- installing prerequisites --"
|
2020-11-08 21:55:05 +01:00
|
|
|
|
2021-08-19 16:09:20 +02:00
|
|
|
install git
|
|
|
|
install curl
|
2020-11-07 14:03:30 +01:00
|
|
|
|
2021-08-19 16:09:20 +02:00
|
|
|
echo "-----------------------------------"
|
|
|
|
|
|
|
|
fi
|
2020-11-08 21:55:05 +01:00
|
|
|
|
|
|
|
#Make the selection
|
|
|
|
echo "-- what do you want to install? --"
|
|
|
|
|
2021-08-19 16:02:46 +02:00
|
|
|
OPTIONS_VALUES=(
|
|
|
|
"ZSH"
|
|
|
|
"NVIM"
|
|
|
|
"ASDF"
|
|
|
|
"DRNV"
|
|
|
|
"NODE"
|
|
|
|
"GO"
|
|
|
|
"PYTH"
|
|
|
|
"DENO"
|
|
|
|
"HUGO"
|
|
|
|
"RUST"
|
|
|
|
)
|
|
|
|
|
|
|
|
OPTIONS_LABELS=("zsh + oh-my-zsh" "Neovim (Requires asdf)" "asdf" "Direnv" "NodeJS" "Golang" "Python" "Deno" "Hugo" "Rust")
|
2021-09-12 16:25:06 +02:00
|
|
|
for i in "${!OPTIONS_VALUES[@]"; do
|
2020-11-08 21:55:05 +01:00
|
|
|
OPTIONS_STRING+="${OPTIONS_VALUES[$i]} (${OPTIONS_LABELS[$i]});"
|
|
|
|
done
|
2021-01-20 21:22:53 +01:00
|
|
|
|
|
|
|
if [ $INTERACTIVE = "true" ]; then
|
2021-06-22 13:05:12 +02:00
|
|
|
multiselect SELECTED "$OPTIONS_STRING":
|
2021-01-20 21:22:53 +01:00
|
|
|
fi
|
2020-11-08 21:55:05 +01:00
|
|
|
|
|
|
|
# Variables
|
|
|
|
INST_ZSH=${SELECTED[0]}
|
|
|
|
INST_NVIM=${SELECTED[1]}
|
2021-06-22 13:05:12 +02:00
|
|
|
INST_ASDF=${SELECTED[2]}
|
|
|
|
INST_DRNV=${SELECTED[3]}
|
|
|
|
INST_NODE=${SELECTED[4]}
|
|
|
|
INST_GO=${SELECTED[5]}
|
|
|
|
INST_PYTH=${SELECTED[6]}
|
|
|
|
INST_DENO=${SELECTED[7]}
|
|
|
|
INST_HUGO=${SELECTED[8]}
|
|
|
|
INST_RUST=${SELECTED[9]}
|
2020-11-08 21:55:05 +01:00
|
|
|
|
2021-01-20 21:22:53 +01:00
|
|
|
if [ $INTERACTIVE = "false" ]; then
|
2021-01-20 21:35:34 +01:00
|
|
|
INST_ZSH=true
|
2021-09-12 16:21:27 +02:00
|
|
|
INST_ASDF=true
|
2021-06-22 13:05:12 +02:00
|
|
|
INST_NVIM=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
|
2021-06-22 13:05:12 +02:00
|
|
|
if [ "$INST_ASDF" = true ]; then
|
|
|
|
|
|
|
|
# Requirements for ASDF
|
|
|
|
install gnupg2
|
|
|
|
install unzip
|
|
|
|
./install/install-asdf.sh
|
|
|
|
|
|
|
|
if [ "$INST_NVIM" = true ]; then
|
|
|
|
asdfInstall neovim
|
|
|
|
./install/install-nvim.sh
|
|
|
|
fi
|
|
|
|
|
|
|
|
[[ "$INST_NODE" = true ]] && asdfInstall nodejs
|
|
|
|
[[ "$INST_GO" = true ]] && asdfInstall golang
|
|
|
|
[[ "$INST_PYTH" = true ]] && asdfInstall python
|
|
|
|
[[ "$INST_DENO" = true ]] && asdfInstall deno
|
|
|
|
[[ "$INST_HUGO" = true ]] && asdfInstall hugo
|
|
|
|
[[ "$INST_RUST" = true ]] && asdfInstall rust
|
|
|
|
fi
|
2020-11-08 21:55:05 +01:00
|
|
|
|
|
|
|
echo "-- linking .dotfiles --"
|
|
|
|
|
2020-11-07 15:58:15 +01:00
|
|
|
linkFile .bashrc
|
|
|
|
linkFile .p10k.zsh
|
|
|
|
linkFile .dircolors
|
2021-08-23 18:47:23 +02:00
|
|
|
linkFile .tmux.conf
|
2020-11-07 15:58:15 +01:00
|
|
|
|
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_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-07 16:40:23 +01:00
|
|
|
|
2020-11-08 21:55:05 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
# Change to home dir
|
|
|
|
cd ~
|
|
|
|
|
|
|
|
echo "-- ALL DONE --"
|
|
|
|
|
2021-06-22 13:05:12 +02:00
|
|
|
if [ "$INST_ZSH" = true ]; then
|
|
|
|
zsh
|
|
|
|
fi
|