Move merge command decision to common.sh and check whether DISPLAY is set
This commit is contained in:
parent
2beca9ef56
commit
64f979c300
10
common.sh
10
common.sh
@ -6,6 +6,15 @@ DEV=0
|
|||||||
EXTRA=0
|
EXTRA=0
|
||||||
WORKSTATION=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
|
if [[ "$#" -eq 0 ]]; then
|
||||||
ALL=1
|
ALL=1
|
||||||
fi
|
fi
|
||||||
@ -43,6 +52,7 @@ while true; do
|
|||||||
done
|
done
|
||||||
|
|
||||||
if [ "${ALL}" -eq 1 ]; then
|
if [ "${ALL}" -eq 1 ]; then
|
||||||
|
CORE=1
|
||||||
WORKSTATION=1
|
WORKSTATION=1
|
||||||
EXTRA=1
|
EXTRA=1
|
||||||
DEV=1
|
DEV=1
|
||||||
|
@ -105,12 +105,7 @@ function install() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -e "${dst}" ]; then
|
if [ -e "${dst}" ]; then
|
||||||
if command -v meld &> /dev/null
|
run_as_user "${user}" "${merge_cmd[@]}" "${src}" "${dst}"
|
||||||
then
|
|
||||||
run_as_user "${user}" meld "${src}" "${dst}"
|
|
||||||
else
|
|
||||||
run_as_user "${user}" vim -d "${src}" "${dst}"
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
backup_file "${dst}"
|
backup_file "${dst}"
|
||||||
echo "${dst} will now be linked."
|
echo "${dst} will now be linked."
|
||||||
|
@ -5,6 +5,6 @@ set -euo pipefail
|
|||||||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
|
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
|
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
|
fi
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user