Skip to content
Snippets Groups Projects
Commit 3e38406b authored by jipem's avatar jipem
Browse files

Borg - Allow setting files ownership in case of local backup

Set file ownership after creating backup (for whole depot). Assuming that group name is same name as user.
parent 5cc80402
No related branches found
No related tags found
No related merge requests found
......@@ -200,6 +200,25 @@ if [ $test = 0 ]; then
fi
fi
# in case of local backup, setting reop files to correct user, if user is set
if [ "$host" == "localhost" ] && [ -n "$user" ]; then
chownstr="chown -Rf $user:$user $directory"
debug "Setting appropriate files ownership"
debug "$nice $chownstr"
if [ $test = 0 ]; then
output=`$nice su -c "$chownstr" 2>&1`
if [ $? = 0 ]; then
debug $output
info "Successfully changed repo user to $user"
else
error $output
warning "Failed to change repo user. Files ownership may be stuck to root"
fi
fi
fi
### REMOVE OLD BACKUPS ###
# borg prune
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment