Fix created dotfile directory permissions

This ensures that nested directories each have 0700 permissions applied
to them.
master
Jordan Atwood 2 years ago
parent bccd85ccb4
commit 08efa815ab
Signed by: nightfirecat
GPG Key ID: 615A619C2D73A6DF
  1. 12
      setup.sh

@ -51,9 +51,15 @@ elif [ $remove -eq 0 ]; then
if [[ -h "$target" ]] && [[ "$source" == "$(readlink -f "$target")" ]]; then if [[ -h "$target" ]] && [[ "$source" == "$(readlink -f "$target")" ]]; then
echo "Skipping '${source}' -> '${target}' link as it is already linked" echo "Skipping '${source}' -> '${target}' link as it is already linked"
else else
# NOTE: This applies 0700 permissions only to the deepest directory target_dir="$(dirname "$target")"
# shellcheck disable=SC2174 while [ ! -d "$target_dir" ]; do
mkdir -m 0700 -p "$(dirname "$target")" target_parent="$target_dir"
while [ ! -d "$(dirname "$target_parent")" ]; do
target_parent="$(dirname "$target_parent")"
done
mkdir -vm 0700 "$target_parent"
done
ln -sv "$source" "$target" ln -sv "$source" "$target"
fi fi
done done

Loading…
Cancel
Save