diff --git a/scripts/linkFiles.sh b/scripts/linkFiles.sh index e753d89..fac279e 100755 --- a/scripts/linkFiles.sh +++ b/scripts/linkFiles.sh @@ -10,11 +10,11 @@ linkFile() { mv "$2" "${2}.backup" ln -s "$1" "$2" else - [ -h "$2" ] && [ "$1" = $(realpath "$2") ] && return + [ -h "$2" ] && [ "$1" = "$(realpath "$2")" ] && return msg="\nFile already exists: '${2//$HOME\//}', what would you like to do?" options=(1 "Skip" 2 "Skip all" 3 "Overwrite" 4 "Overwrite all" 5 "Backup" 6 "Backup all") - selectedOption=$(displayDialogBox --menu "$msg" VALUES 0 "${options[@]}" 3>&1 1>&2 2>&3) + selectedOption=$(displayDialogBox --menu "$msg" VALUES "${options[@]}" 3>&1 1>&2 2>&3) if [ $? -eq 1 ]; then exit 0 fi @@ -90,12 +90,15 @@ loopThroughFiles() { files=() while read -r -d '' srcFile; do file=$(echo "$srcFile" | awk '{ sub(/.*dotfiles\/other\//, ""); print }') - files+=("$srcFile" "$file" "OFF") + [ $installAll = true ] && files+=("$srcFile" " ") || files+=("$srcFile" "$file" "OFF") done < <(find -H "$DOTFILES/other" -mindepth 1 -type f -print0) - msg="\nSelect the files that you want to install." - files=("$(displayDialogBox --checklist "$msg" VALUES "${files[@]}" 3>&1 1>&2 2>&3)") - files=(${files[@]//$'\n'/ }) + if [ $installAll = false ]; then + msg="\nSelect the files that you want to install." + files=("$(displayDialogBox --checklist "$msg" VALUES "${files[@]}" 3>&1 1>&2 2>&3)") + [ "${files[0]}" = '' ] && exit + files=("${files[@]//$'\n'/ }") + fi fi password=$(displayDialogBox --passwordbox "\nEnter your password." VALUES 3>&1 1>&2 2>&3)