diff --git a/common.sh b/common.sh index b825310..4d7dd40 100644 --- a/common.sh +++ b/common.sh @@ -6,6 +6,15 @@ DEV=0 EXTRA=0 WORKSTATION=0 + +if [[ -n "$DISPLAY" ]] && command -v meld &> /dev/null; +then + merge_cmd=(meld) +else + merge_cmd=(vim -d) +fi + + if [[ "$#" -eq 0 ]]; then ALL=1 fi @@ -43,6 +52,7 @@ while true; do done if [ "${ALL}" -eq 1 ]; then + CORE=1 WORKSTATION=1 EXTRA=1 DEV=1 diff --git a/install_dotfiles.sh b/install_dotfiles.sh index a947bd7..1286deb 100755 --- a/install_dotfiles.sh +++ b/install_dotfiles.sh @@ -105,12 +105,7 @@ function install() { fi if [ -e "${dst}" ]; then - if command -v meld &> /dev/null - then - run_as_user "${user}" meld "${src}" "${dst}" - else - run_as_user "${user}" vim -d "${src}" "${dst}" - fi + run_as_user "${user}" "${merge_cmd[@]}" "${src}" "${dst}" fi backup_file "${dst}" echo "${dst} will now be linked." diff --git a/install_pam.sh b/install_pam.sh index fc86759..274073a 100755 --- a/install_pam.sh +++ b/install_pam.sh @@ -5,6 +5,6 @@ set -euo pipefail SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" if ! diff "${SCRIPT_DIR}/etc/pam.d/login" /etc/pam.d/login &> /dev/null; then - sudo meld "${SCRIPT_DIR}/etc/pam.d/login" /etc/pam.d/login + sudo "${merge_cmd[@]}" "${SCRIPT_DIR}/etc/pam.d/login" /etc/pam.d/login fi