Setup script cleanup

Make better use of existing vars, fix wording of some existing comments.
master
Jordan Atwood 2 years ago
parent f6d624b580
commit 9be0ff854e
Signed by: nightfirecat
GPG Key ID: 615A619C2D73A6DF
  1. 6
      setup.sh

@ -3,7 +3,7 @@ set -e
# Accept the `--remove` argument to delete symlinks of the files to be copied
# This is useful for testing a clean installation (eg. `setup.sh --remove && setup.sh`)
# Note: Normal setup overwrites all old symlinks, so re-installation in place is idempotent
# Note: Normal setup overwrites all incorrect symlinks, so re-installation in place is idempotent
if [ "$1" == '--remove' ]; then
remove=1
else
@ -42,14 +42,14 @@ elif [ $remove -eq 0 ]; then
exit 1
fi
# Symlink files to $HOME, overwrite old symlinks
# Symlink files to $HOME, overwrite incorrect symlinks
for file in "${copy_files[@]}"; do
source="${SRC_DIR}/${file}"
target="${HOME}/${file}"
if [[ -h "$target" ]] && [[ "$source" == "$(readlink -f "$target")" ]]; then
echo "Skipping '${source}' -> '${target}' link as it is already linked"
else
ln -sv "${SRC_DIR}/${file}" "${HOME}/${file}"
ln -sv "$source" "$target"
fi
done
fi

Loading…
Cancel
Save