Skip to content
Snippets Groups Projects
Commit 45ed859b authored by jipem's avatar jipem
Browse files

Update borg.in

Re-apply user modification after prune, not only after backup
parent 3e38406b
Branches master
No related tags found
No related merge requests found
...@@ -200,7 +200,7 @@ if [ $test = 0 ]; then ...@@ -200,7 +200,7 @@ if [ $test = 0 ]; then
fi fi
fi fi
# in case of local backup, setting reop files to correct user, if user is set # in case of local backup, setting repo files to correct user, if user is set
if [ "$host" == "localhost" ] && [ -n "$user" ]; then if [ "$host" == "localhost" ] && [ -n "$user" ]; then
chownstr="chown -Rf $user:$user $directory" chownstr="chown -Rf $user:$user $directory"
debug "Setting appropriate files ownership" debug "Setting appropriate files ownership"
...@@ -243,6 +243,24 @@ if [ "$prune" == "yes" ]; then ...@@ -243,6 +243,24 @@ if [ "$prune" == "yes" ]; then
fatal "Failed removing old backups." fatal "Failed removing old backups."
fi fi
fi fi
# in case of local backup, setting repo 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
fi fi
debug "unset BORG_PASSPHRASE" debug "unset BORG_PASSPHRASE"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment