Simplify handling of permissions of dotfiles directory
This commit is contained in:
17
playbook.yml
17
playbook.yml
@@ -138,22 +138,11 @@
|
|||||||
|
|
||||||
- name: fix permissions for dotfiles directory
|
- name: fix permissions for dotfiles directory
|
||||||
shell: |
|
shell: |
|
||||||
cd /var/lib/dotfiles
|
chown --changes --recursive dotfiles:dotfiles .
|
||||||
if [[ -e .git ]] ; then
|
chmod --changes --recursive g+rwX .
|
||||||
# There is no sane way to specify the global .gitconfig to use, so we
|
|
||||||
# actually have to override HOME so git looks into ~/.gitconfig
|
|
||||||
export HOME="$(mktemp -d)"
|
|
||||||
set -o pipefail
|
|
||||||
set -o errexit
|
|
||||||
git config --global --add safe.directory /var/lib/dotfiles
|
|
||||||
git ls-tree -z --name-only HEAD | xargs --null chown --changes --recursive dotfiles:dotfiles
|
|
||||||
git ls-tree -z --name-only HEAD | xargs --null chmod --changes --recursive g+wX
|
|
||||||
else
|
|
||||||
chown --changes --recursive dotfiles:dotfiles .
|
|
||||||
chmod --changes --recursive g+wX .
|
|
||||||
fi
|
|
||||||
args:
|
args:
|
||||||
executable: /bin/bash
|
executable: /bin/bash
|
||||||
|
chdir: /var/lib/dotfiles
|
||||||
register: dotfiles_permission_change
|
register: dotfiles_permission_change
|
||||||
become: true
|
become: true
|
||||||
become_user: root
|
become_user: root
|
||||||
|
|||||||
Reference in New Issue
Block a user