Add UPDATE and OVERWRITE options as env vars
This commit is contained in:
parent
7b941b8da1
commit
7dc2f588bb
3 changed files with 56 additions and 45 deletions
|
@ -12,8 +12,11 @@ set_up_lime2_repo() {
|
|||
folder="$2"
|
||||
echo "Setting up $repo_name..."
|
||||
if [ -e ~/"$folder"/"$repo_name" ]; then
|
||||
echo "${GREEN}$repo_name is already there, updating...${NC}"
|
||||
cd ~/"$folder"/"$repo_name" && git pull
|
||||
echo "${GREEN}$repo_name is already there.${NC}"
|
||||
if [ "$UPDATE" = 'true' ]; then
|
||||
echo "Updating..."
|
||||
cd ~/"$folder"/"$repo_name" && git pull
|
||||
fi
|
||||
else
|
||||
echo "${ORANGE}Cloning new $repo_name...${NC}"
|
||||
cd ~/"$folder" && git clone ssh://flyingscorpio@2px.info.tm/~/repos/"$repo_name".git
|
||||
|
@ -28,8 +31,11 @@ set_up_gitlab_repo() {
|
|||
folder="$3"
|
||||
echo "Setting up $repo_owner/$repo_name..."
|
||||
if [ -e ~/"$folder"/"$repo_name" ]; then
|
||||
echo "${GREEN}$repo_name is already there, updating...${NC}"
|
||||
cd ~/"$folder"/"$repo_name" && git pull
|
||||
echo "${GREEN}$repo_name is already there.${NC}"
|
||||
if [ "$UPDATE" = 'true' ]; then
|
||||
echo "Updating..."
|
||||
cd ~/"$folder"/"$repo_name" && git pull
|
||||
fi
|
||||
else
|
||||
echo "${ORANGE}Cloning new $repo_name...${NC}"
|
||||
cd ~/"$folder" && git clone https://gitlab.com/"$repo_owner"/"$repo_name".git
|
||||
|
@ -75,8 +81,11 @@ set_up_gitlab_repo 'flyingscorpio' 'WikipediaAcronymScraper' 'SRC'
|
|||
|
||||
echo "Setting up 2px..."
|
||||
if [ -e ~/SRC/2px ]; then
|
||||
echo "${GREEN}2px is already there, updating...${NC}"
|
||||
cd ~/SRC/2px && git pull
|
||||
echo "${GREEN}2px is already there.${NC}"
|
||||
if [ "$UPDATE" = 'true' ]; then
|
||||
echo "Updating..."
|
||||
cd ~/SRC/2px && git pull
|
||||
fi
|
||||
else
|
||||
echo "${ORANGE}Cloning new 2px...${NC}"
|
||||
cd ~/SRC && git clone git@gitlab.com:flyingscorpio/2px.git
|
||||
|
@ -94,8 +103,11 @@ fi
|
|||
|
||||
echo "Setting up LVEL-website..."
|
||||
if [ -e ~/SRC/LVEL-website ]; then
|
||||
echo "${GREEN}LVEL-website is already there, updating...${NC}"
|
||||
cd ~/SRC/LVEL-website && git pull
|
||||
echo "${GREEN}LVEL-website is already there.${NC}"
|
||||
if [ "$UPDATE" = 'true' ]; then
|
||||
echo "Updating..."
|
||||
cd ~/SRC/LVEL-website && git pull
|
||||
fi
|
||||
else
|
||||
echo "${ORANGE}Cloning new LVEL-website...${NC}"
|
||||
cd ~/SRC && git clone git@gitlab.com:flyingscorpio/LVEL-website.git
|
||||
|
|
|
@ -7,34 +7,11 @@ if [ -z "$BASE_DIR" ]; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
# HANDLE ARGS {{{
|
||||
|
||||
overwrite='false'
|
||||
update_plugins='false'
|
||||
if [ "$1" = '-o' ] || [ "$1" = '--overwrite' ] || [ "$2" = '-o' ] || [ "$2" = '--overwrite' ]; then
|
||||
echo "${ORANGE}You agree to overwrite preexisting files!${NC}"
|
||||
overwrite='true'
|
||||
fi
|
||||
if [ "$1" = '-u' ] || [ "$1" = '--update' ] || [ "$2" = '-u' ] || [ "$2" = '--update' ]; then
|
||||
echo "${ORANGE}Set to update plugins!${NC}"
|
||||
update_plugins='true'
|
||||
fi
|
||||
if [ "$1" = '-ou' ] || [ "$1" = '-uo' ]; then
|
||||
echo "${ORANGE}Both options were set.${NC}"
|
||||
overwrite='true'
|
||||
update_plugins='true'
|
||||
fi
|
||||
|
||||
/bin/bash "$BASE_DIR"/installation_scripts/separator.sh
|
||||
|
||||
#}}}
|
||||
|
||||
# UPDATE VIMRC {{{
|
||||
|
||||
echo "Updating .vimrc..."
|
||||
echo
|
||||
if [ ! -L ~/.vimrc ]; then
|
||||
if [ $overwrite = 'true' ]; then
|
||||
if [ "$OVERWRITE" = 'true' ]; then
|
||||
rm ~/.vimrc 2> /dev/null
|
||||
ln -rs "$BASE_DIR"/dotfiles/vimrc ~/.vimrc
|
||||
echo "${ORANGE}.vimrc symlink created.${NC}"
|
||||
|
@ -54,7 +31,6 @@ fi
|
|||
# UPDATE COLORS {{{
|
||||
|
||||
echo "Updating colors..."
|
||||
echo
|
||||
mkdir -p ~/.vim/colors
|
||||
|
||||
color_files=$(ls "$BASE_DIR"/dotfiles/vim_colors)
|
||||
|
@ -69,7 +45,6 @@ done
|
|||
# INSTALL OR UPDATE VUNDLE {{{
|
||||
|
||||
echo "Setting up Vundle..."
|
||||
echo
|
||||
if [ ! -e ~/.vim/bundle/Vundle.vim ]; then
|
||||
echo "Cloning Vundle from Github..."
|
||||
if git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim; then
|
||||
|
@ -95,14 +70,13 @@ fi
|
|||
# UPDATE VUNDLE PLUGINS {{{
|
||||
|
||||
echo "Checking Vundle Plugins..."
|
||||
echo
|
||||
if vim +PluginInstall +qall; then
|
||||
echo "${GREEN}All Vundle Plugins are enabled.${NC}"
|
||||
else
|
||||
echo "${RED}There was a problem while checking Vundle Plugins.${NC}"
|
||||
exit 1
|
||||
fi
|
||||
if [ $update_plugins = 'true' ]; then
|
||||
if [ "$UPDATE" = 'true' ]; then
|
||||
echo "Updating Vundle Plugins..."
|
||||
if vim +PluginUpdate +qall; then
|
||||
echo "${GREEN}Successfully updated Vundle Plugins${NC}"
|
||||
|
@ -119,7 +93,6 @@ fi
|
|||
# SETUP GIT SUBMODULES FOR PYTHON MODE {{{
|
||||
|
||||
echo "Setting up Python-mode folder for git submodules..."
|
||||
echo
|
||||
if [ -e ~/.vim/bundle/python-mode ]; then
|
||||
cd ~/.vim/bundle/python-mode || exit 1
|
||||
if git submodule update --init --recursive; then
|
||||
|
@ -137,7 +110,6 @@ fi
|
|||
# INSTALL LINTERS {{{
|
||||
|
||||
echo "Installing linters..."
|
||||
echo
|
||||
if [ "$OS" = 'debian' ]; then
|
||||
sudo apt install flake8 pylint3 mypy shellcheck
|
||||
elif [ "$OS" = 'arch' ]; then
|
||||
|
@ -177,7 +149,6 @@ fi
|
|||
# INSTALL YOUCOMPLETEME {{{
|
||||
|
||||
echo "Setting up YouCompleteMe..."
|
||||
echo
|
||||
if [ ! -e ~/.vim/ycm_installed ]; then
|
||||
if [ "$OS" = 'debian' ]; then
|
||||
sudo apt install build-essential cmake python3-dev
|
||||
|
@ -207,7 +178,6 @@ fi
|
|||
# UPDATE YOUCOMPLETEME EXTRA CONF FILES {{{
|
||||
|
||||
echo "Updating YouCompleteMe extra_conf files..."
|
||||
echo
|
||||
|
||||
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
|
||||
|
|
|
@ -55,26 +55,55 @@ export OS
|
|||
|
||||
# }}}
|
||||
|
||||
/bin/bash "$BASE_DIR"/installation_scripts/vim_update.sh --overwrite
|
||||
exit
|
||||
# Handle args {{{
|
||||
|
||||
OVERWRITE='false'
|
||||
UPDATE='false'
|
||||
if [ "$1" = '-o' ] || [ "$1" = '--overwrite' ] || [ "$2" = '-o' ] || [ "$2" = '--overwrite' ]; then
|
||||
echo "${ORANGE}You agree to overwrite preexisting files!${NC}"
|
||||
OVERWRITE='true'
|
||||
fi
|
||||
if [ "$1" = '-u' ] || [ "$1" = '--update' ] || [ "$2" = '-u' ] || [ "$2" = '--update' ]; then
|
||||
echo "${ORANGE}Set to update plugins!${NC}"
|
||||
UPDATE='true'
|
||||
fi
|
||||
if [ "$1" = '-ou' ] || [ "$1" = '-uo' ]; then
|
||||
echo "${ORANGE}Both options were set.${NC}"
|
||||
OVERWRITE='true'
|
||||
UPDATE='true'
|
||||
fi
|
||||
|
||||
export OVERWRITE
|
||||
export UPDATE
|
||||
|
||||
# }}}
|
||||
|
||||
# Update vim configuration {{{
|
||||
|
||||
/bin/bash "$BASE_DIR"/installation_scripts/vim_update.sh
|
||||
/bin/bash "$BASE_DIR"/installation_scripts/separator.sh
|
||||
|
||||
# }}}
|
||||
|
||||
# Install scripts {{{
|
||||
|
||||
echo "Installing scripts..."
|
||||
|
||||
if [ "$OS" = 'debian' ]; then
|
||||
/bin/bash ~/SetupCockpit/installation_scripts/additional/debian_based_installs.sh
|
||||
/bin/bash "$BASE_DIR"/installation_scripts/debian_based_installs.sh
|
||||
elif [ "$OS" = 'arch' ]; then
|
||||
/bin/bash ~/SetupCockpit/installation_scripts/additional/arch_based_installs.sh
|
||||
/bin/bash "$BASE_DIR"/installation_scripts/arch_based_installs.sh
|
||||
else
|
||||
echo "${RED} Didn't receive correct OS information, quitting...${NC}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
/bin/bash ~/SetupCockpit/installation_scripts/additional/separator.sh
|
||||
/bin/bash "$BASE_DIR"/installation_scripts/separator.sh
|
||||
|
||||
# }}}
|
||||
|
||||
exit
|
||||
|
||||
# Configure ProtonVPN {{{
|
||||
|
||||
echo "Configuring ProtonVPN..."
|
||||
|
|
Loading…
Add table
Reference in a new issue