From 623aa5bb7a2357b09387266dd81a6f27fd61a753 Mon Sep 17 00:00:00 2001 From: "flyingscorpio@arch-desktop" Date: Wed, 8 Apr 2020 17:38:14 +0200 Subject: [PATCH] Remove separator as a script, put as a function --- installation_scripts/separator.sh | 11 ------- installation_scripts/vim_update.sh | 16 ---------- main_install.sh | 47 ++++++++++++++++++------------ 3 files changed, 29 insertions(+), 45 deletions(-) delete mode 100644 installation_scripts/separator.sh diff --git a/installation_scripts/separator.sh b/installation_scripts/separator.sh deleted file mode 100644 index f7589c9..0000000 --- a/installation_scripts/separator.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash - -## This script is used to visually separate commands in the other scripts - -if [ $? -eq 0 ]; then - echo -n "${GREEN}" -else - echo -n "${RED}" -fi -echo "========================================" -echo "${NC}" diff --git a/installation_scripts/vim_update.sh b/installation_scripts/vim_update.sh index d391794..3ed68fc 100644 --- a/installation_scripts/vim_update.sh +++ b/installation_scripts/vim_update.sh @@ -24,8 +24,6 @@ else echo "Nothing changed.${NC}" fi -/bin/bash "$BASE_DIR"/installation_scripts/separator.sh - # }}} # Add colors {{{ @@ -38,8 +36,6 @@ for color_file in $color_files; do ln -rs "$BASE_DIR"/dotfiles/vim_colors/"$color_file" ~/.vim/colors/ 2> /dev/null done -/bin/bash "$BASE_DIR"/installation_scripts/separator.sh - # }}} # Install or update Vundle {{{ @@ -63,8 +59,6 @@ else fi fi -/bin/bash "$BASE_DIR"/installation_scripts/separator.sh - # }}} # Update Vundle plugins {{{ @@ -86,8 +80,6 @@ if [ "$UPDATE" = 'true' ]; then fi fi -/bin/bash "$BASE_DIR"/installation_scripts/separator.sh - # }}} # Setup git-submodules for python-mode {{{ @@ -103,8 +95,6 @@ if [ -e ~/.vim/bundle/python-mode ]; then fi fi -/bin/bash "$BASE_DIR"/installation_scripts/separator.sh - # }}} # Install linters {{{ @@ -142,8 +132,6 @@ else exit 1 fi -/bin/bash "$BASE_DIR"/installation_scripts/separator.sh - # }}} # Install YouCompleteMe {{{ @@ -171,8 +159,6 @@ else echo "YouCompleteMe is already installed, skipping..." fi -/bin/bash "$BASE_DIR"/installation_scripts/separator.sh - # }}} # Add YouCompleteMe extra conf files {{{ @@ -182,8 +168,6 @@ echo "Adding YouCompleteMe extra_conf files..." ln -rs "$BASE_DIR"/dotfiles/ycm_extra_conf.py ~/.ycm_extra_conf.py 2> /dev/null ln -rs "$BASE_DIR"/dotfiles/global_extra_conf.py ~/.global_extra_conf.py 2> /dev/null -/bin/bash "$BASE_DIR"/installation_scripts/separator.sh - # }}} exit 0 diff --git a/main_install.sh b/main_install.sh index 13e6dc3..e5bae1f 100755 --- a/main_install.sh +++ b/main_install.sh @@ -13,6 +13,17 @@ export GREEN export ORANGE export NC +separator() { + exit_status=$? + if [ $exit_status -eq 0 ]; then + echo -n "${GREEN}" + else + echo -n "${RED}" + fi + echo "========================================" + echo "${NC}" +} + BASE_DIR="$PWD" export BASE_DIR @@ -91,7 +102,7 @@ else exit 1 fi -/bin/bash "$BASE_DIR"/installation_scripts/separator.sh +separator # }}} @@ -101,7 +112,7 @@ echo "Setting up configuration for Vim" /bin/bash "$BASE_DIR"/installation_scripts/vim_update.sh -/bin/bash "$BASE_DIR"/installation_scripts/separator.sh +separator # }}} @@ -111,36 +122,36 @@ echo "Configuring ProtonVPN..." sudo protonvpn init && sudo protonvpn c --cc CH -/bin/bash "$BASE_DIR"/installation_scripts/separator.sh +separator # }}} # Update .bashrc {{{ echo "Updating .bashrc..." -if cp ~/SetupCockpit/dotfiles/bashrc ~/.bashrc; then - echo "${GREEN}Successfully updated .bashrc${NC}" -else - echo "${ORANGE}There was a problem while updating .bashrc${NC}" + +if [ ! -L ~/.bashrc ]; then + ln -rs "$BASE_DIR"/dotfiles/bashrc ~/.bashrc 2> /dev/null fi -/bin/bash ~/SetupCockpit/separator.sh +separator # }}} # Update .bash_aliases {{{ echo "Updating .bash_aliases..." -if cp ~/SetupCockpit/dotfiles/bash_aliases ~/.bash_aliases; then - echo "${GREEN}Successfully updated .bash_aliases${NC}" -else - echo "${ORANGE}There was a problem while updating .bash_aliases${NC}" + +if [ ! -L ~/.bash_aliases ]; then + ln -rs "$BASE_DIR"/dotfiles/bash_aliases ~/.bash_aliases 2> /dev/null fi -/bin/bash ~/SetupCockpit/separator.sh +separator # }}} +exit + # Configure Git {{{ echo "Configuring Git..." @@ -151,7 +162,7 @@ git config --global alias.co "checkout" git config --global alias.st "status" git config --global alias.br "branch" -/bin/bash ~/SetupCockpit/separator.sh +separator # }}} @@ -169,7 +180,7 @@ else fi fi -/bin/bash ~/SetupCockpit/separator.sh +separator # }}} @@ -184,7 +195,7 @@ else git clone https://github.com/magicmonty/bash-git-prompt.git ~/.bash-git-prompt --depth=1 fi -/bin/bash ~/SetupCockpit/separator.sh +separator # }}} @@ -204,7 +215,7 @@ echo " " > ~/.local/share/mime/packages/text-markdown.xml fi -/bin/bash ~/SetupCockpit/separator.sh +separator # }}} @@ -214,6 +225,6 @@ echo "Cloning projects..." /bin/bash clone_projects.sh -/bin/bash ~/SetupCockpit/separator.sh +separator # }}}