Fix home files owned by root after provision

This commit is contained in:
Marty Oehme 2019-03-12 14:42:48 +01:00
parent 1c975dc1aa
commit 5935b8884a

View file

@ -157,16 +157,16 @@ putgitrepo() { # Downlods a gitrepo $1 and places the files in $2 only overwriti
sudo -u "$name" git clone --bare "$1" "$dir/gitrepo" >/dev/null 2>&1 && sudo -u "$name" git clone --bare "$1" "$dir/gitrepo" >/dev/null 2>&1 &&
sudo -u "$name" cp -rfT "$dir/gitrepo" $dfdir/.dotfiles sudo -u "$name" cp -rfT "$dir/gitrepo" $dfdir/.dotfiles
dotfiles $dfdir checkout sudo -u "$name" dotfiles $dfdir checkout
if [ $? = 0 ]; then if [ $? = 0 ]; then
echo "Checked out dotfiles."; echo "Checked out dotfiles.";
else else
echo "Backing up existing dotfiles."; echo "Backing up existing dotfiles.";
mkdir -p $2/.dotfiles-backup mkdir -p $2/.dotfiles-backup
dotfiles $dfdir checkout 2>&1 | egrep "\s+\." | awk {'print $1'} | xargs -I{} mv {} $2/.dotfiles-backup/{} sudo -u "$name" dotfiles $dfdir checkout 2>&1 | egrep "\s+\." | awk {'print $1'} | xargs -I{} mv {} $2/.dotfiles-backup/{}
fi; fi;
dotfiles $dfdir checkout sudo -u "$name" dotfiles $dfdir checkout
dotfiles $dfdir config status.showUntrackedFiles no sudo -u "$name" dotfiles $dfdir config status.showUntrackedFiles no
} }
serviceinit() { for service in "$@"; do serviceinit() { for service in "$@"; do