Skip to content

Commit

Permalink
[Backup] Restore permissions after data restore
Browse files Browse the repository at this point in the history
  • Loading branch information
MuntashirAkon committed Aug 28, 2020
1 parent 38b3747 commit 3faff88
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,6 @@ public boolean restore() {
Log.e("BSM - Restore", "Data restore is requested but there are no data files for index " + i + ".");
return false;
}
// Fix UID and GID
if (RunnerUtils.fileExists(dataSource) && uidAndGid == null) {
Log.e("BSM - Restore", "Failed to get owner info for index " + i + ".");
return false;
Expand All @@ -427,10 +426,13 @@ public boolean restore() {
// Clear cache if exists: return value is not important for us
RootShellRunner.runCommand(String.format("rm -rf %s/cache %s/code_cache", dataSource, dataSource));
}
// Fix UID and GID
if (uidAndGid != null && !RootShellRunner.runCommand(String.format("chown -R %s:%s \"%s\"", uidAndGid.first, uidAndGid.second, dataSource)).isSuccessful()) {
Log.e("BSM - Restore", "Failed to get restore owner for index " + i + ".");
return false;
}
// Restore permissions
RootShellRunner.runCommand(String.format("restorecon -R \"%s\"", dataSource));
}
}
if ((flags & BACKUP_RULES) != 0) {
Expand Down

0 comments on commit 3faff88

Please sign in to comment.