From 9b76a831692896ec0a52608e2d6995173549a7e5 Mon Sep 17 00:00:00 2001 From: "flyingscorpio@pinebook-pro" Date: Sat, 11 Apr 2020 10:24:58 +0200 Subject: [PATCH] Add symlink test to bash files --- main_install.sh | 36 ++++++++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 10 deletions(-) diff --git a/main_install.sh b/main_install.sh index e039957..5d4f7fd 100755 --- a/main_install.sh +++ b/main_install.sh @@ -136,7 +136,7 @@ install_scripts() { # {{{ separator } # }}} -install_scripts +# install_scripts update_vim() { # {{{ # Update vim configuration @@ -146,7 +146,7 @@ update_vim() { # {{{ separator } # }}} -update_vim +# update_vim setup_sddm() { # {{{ # Update sddm @@ -182,16 +182,32 @@ setup_bash_files() { # {{{ # Set up .bashrc echo "Updating .bashrc..." - if [ ! -L ~/.bashrc ]; then - ln -rs "$BASE_DIR"/dotfiles/bash/bashrc ~/.bashrc 2> /dev/null + if [ ~/.bashrc -ef "$BASE_DIR"/dotfiles/bash/bashrc ]; then + echo "${GREEN}.bashrc points to the right location." + echo "Nothing changed.${NC}" + else + if [ "$OVERWRITE" = 'true' ]; then + rm ~/.bashrc 2> /dev/null + fi + if ln -rs "$BASE_DIR"/dotfiles/bash/bashrc ~/.bashrc; then + echo "${ORANGE}.bashrc symlink created${NC}" + fi fi separator # Set up .bash_aliases echo "Updating .bash_aliases..." - if [ ! -L ~/.bash_aliases ]; then - ln -rs "$BASE_DIR"/dotfiles/bash/bash_aliases ~/.bash_aliases 2> /dev/null + if [ ~/.bash_aliases -ef "$BASE_DIR"/dotfiles/bash/bash_aliases ]; then + echo "${GREEN}.bash_aliases points to the right location." + echo "Nothing changed.${NC}" + else + if [ "$OVERWRITE" = 'true' ]; then + rm ~/.bash_aliases 2> /dev/null + fi + if ln -rs "$BASE_DIR"/dotfiles/bash/bash_aliases ~/.bash_aliases; then + echo "${ORANGE}.bash_aliases symlink created${NC}" + fi fi separator @@ -233,7 +249,7 @@ install_rust() { # {{{ separator } # }}} -install_rust +# install_rust bash_git_prompt() { # {{{ # Clone bash-git-prompt @@ -251,7 +267,7 @@ bash_git_prompt() { # {{{ separator } # }}} -bash_git_prompt +# bash_git_prompt markdown_mimetype() { # {{{ # Add MIME type for reading .md files in Firefox (need to add extension too) @@ -271,7 +287,7 @@ markdown_mimetype() { # {{{ separator } # }}} -markdown_mimetype +# markdown_mimetype clone_projects() { # {{{ # Clone projects @@ -281,4 +297,4 @@ clone_projects() { # {{{ separator } # }}} -clone_projects +# clone_projects