Update linkFiles.sh (fix warnings and use flags)
This commit is contained in:
parent
4dfcda7827
commit
53e397ded8
|
@ -10,11 +10,11 @@ linkFile() {
|
||||||
mv "$2" "${2}.backup"
|
mv "$2" "${2}.backup"
|
||||||
ln -s "$1" "$2"
|
ln -s "$1" "$2"
|
||||||
else
|
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?"
|
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")
|
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
|
if [ $? -eq 1 ]; then
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
@ -90,12 +90,15 @@ loopThroughFiles() {
|
||||||
files=()
|
files=()
|
||||||
while read -r -d '' srcFile; do
|
while read -r -d '' srcFile; do
|
||||||
file=$(echo "$srcFile" | awk '{ sub(/.*dotfiles\/other\//, ""); print }')
|
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)
|
done < <(find -H "$DOTFILES/other" -mindepth 1 -type f -print0)
|
||||||
|
|
||||||
msg="\nSelect the files that you want to install."
|
if [ $installAll = false ]; then
|
||||||
files=("$(displayDialogBox --checklist "$msg" VALUES "${files[@]}" 3>&1 1>&2 2>&3)")
|
msg="\nSelect the files that you want to install."
|
||||||
files=(${files[@]//$'\n'/ })
|
files=("$(displayDialogBox --checklist "$msg" VALUES "${files[@]}" 3>&1 1>&2 2>&3)")
|
||||||
|
[ "${files[0]}" = '' ] && exit
|
||||||
|
files=("${files[@]//$'\n'/ }")
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
password=$(displayDialogBox --passwordbox "\nEnter your password." VALUES 3>&1 1>&2 2>&3)
|
password=$(displayDialogBox --passwordbox "\nEnter your password." VALUES 3>&1 1>&2 2>&3)
|
||||||
|
|
Loading…
Reference in New Issue