diff --git a/.yadm/bootstrap b/.yadm/bootstrap index a1dc138..5a64d51 100755 --- a/.yadm/bootstrap +++ b/.yadm/bootstrap @@ -1,6 +1,7 @@ #!/bin/sh RED='\033[1;31m' +YELLOW='\033[1;33m' GREEN='\033[1;32m' CYAN='\033[1;36m' NC='\033[0m' @@ -9,8 +10,13 @@ info() { echo -e "${CYAN}$1${NC}" } +warn() { + echo -e "${YELLOW}$1${NC}" +} + error() { echo -e "${RED}$1${NC}" + echo "See bootstrap.log for details" exit 1 } @@ -18,22 +24,49 @@ success() { echo -e "${GREEN}$1${NC}" } +echo "Boostrap starting..." >> bootstrap.log + # Fish configuration info "Checking for fish shell..." which fish 2> /dev/null fish_found=$? if [ $fish_found -eq 0 ]; then - success "Fish shell found." + echo -e "\nFish installation" >> bootstrap.log info " -> Installing virtualfish..." - pip install --user virtualfish || error "!! Failed to install virtualfish" + pip install --user virtualfish >> boostrap.log 2>&1 || error "!! Failed to install virtualfish" info " -> Installing oh-my-fish..." - curl -L https://get.oh-my.fish > install || error "!! Failed to download oh-my-fish installer" - curl https://raw.githubusercontent.com/oh-my-fish/oh-my-fish/master/bin/install.sha256 > install.sha256 || error "!! Failed to download oh-my-fish checksum" - sha256sum -c install.sha256 || error "!! Checksum failed for oh-my-fish." - fish install --noninteractive || error "!! Install failed for oh-my-fish." - fish -c 'omf install' || error "!! Oh-my-fish failed to install some packages" + curl -L https://get.oh-my.fish > install 2>> bootstrap.log || error "!! Failed to download oh-my-fish installer" + curl https://raw.githubusercontent.com/oh-my-fish/oh-my-fish/master/bin/install.sha256 > install.sha256 2>> bootstrap.log || error "!! Failed to download oh-my-fish checksum" + sha256sum -c install.sha256 >> bootstrap.log 2>&1 || error "!! Checksum failed for oh-my-fish." + fish install --noninteractive >> bootstrap.log 2>&1 + ret=$? + if [ $ret -eq 2 ]; + then + warn " -> Oh-my-fish already installed, not reinstalling." + elif [ $ret -eq 0 ]; + then + success " -> Oh-my-fish installed." + else + error " -> !! Install failed for oh-my-fish." + fi + rm install install.sha256 + fish -c 'omf install' >> bootstrap.log 2>&1 || error "!! Oh-my-fish failed to install some packages" success "Successfully configured fish" else - info "No fish shell available, skipping." + warn "No fish shell available, skipping." +fi + +# nvim config +info "Checking for nvim..." +which nvim 2> /dev/null +nvim_found=$? +if [ $nvim_found -eq 0 ]; +then + echo -e "\nNvim installation" >> bootstrap.log + info " -> Setting up plugins..." + curl -fLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim 2>> bootstrap.log + nvim +PlugInstall +qall +else + warn "Nvim not available, skipping." fi