mirror of
https://github.com/edu4rdshl/blackarch-devtools.git
synced 2026-07-17 23:24:47 +00:00
Fix rsync performance issue
It solves the bad habit of recreating the chroot copy everytime that the -c option was specified, a lot of performance is gained in it change.
This commit is contained in:
parent
f4610ee6d6
commit
cc263db1bb
1 changed files with 12 additions and 40 deletions
|
|
@ -239,53 +239,25 @@ pub fn sync_chroot() {
|
|||
.spawn()
|
||||
.expect("Failed to create chroot copy.");
|
||||
} else {
|
||||
let delete_existing_chroot = Command::new("sudo")
|
||||
let make_chroot_copy = Command::new("sudo")
|
||||
.args(&[
|
||||
"rm",
|
||||
"--recursive",
|
||||
"--force",
|
||||
"--one-file-system",
|
||||
"rsync",
|
||||
"-a",
|
||||
"--delete",
|
||||
"-q",
|
||||
"-W",
|
||||
"-x",
|
||||
&chroot_root,
|
||||
&chroot_blackarch,
|
||||
])
|
||||
.status()
|
||||
.expect("Failed to delete chroot copy.");
|
||||
if delete_existing_chroot.success() {
|
||||
let create_chroot_copy = Command::new("sudo")
|
||||
.args(&["mkdir", &chroot_blackarch])
|
||||
.status()
|
||||
.expect("Failed to create working copy of chroot environment.");
|
||||
if create_chroot_copy.success() {
|
||||
let make_chroot_copy = Command::new("sudo")
|
||||
.args(&[
|
||||
"rsync",
|
||||
"-a",
|
||||
"--delete",
|
||||
"-q",
|
||||
"-W",
|
||||
"-x",
|
||||
&chroot_root,
|
||||
&chroot_blackarch,
|
||||
])
|
||||
.status()
|
||||
.expect("Failed to create copy of root chroot environment.");
|
||||
if make_chroot_copy.success() {
|
||||
writeln!(coloring("green"), "Chroot environment is ready!");
|
||||
} else {
|
||||
writeln!(
|
||||
coloring("red"),
|
||||
"Failed to create copy of root chroot environment."
|
||||
);
|
||||
}
|
||||
} else {
|
||||
writeln!(
|
||||
coloring("red"),
|
||||
"Error while trying to create the directory for the chroot copy."
|
||||
);
|
||||
}
|
||||
.expect("Failed to create copy of root chroot environment.");
|
||||
if make_chroot_copy.success() {
|
||||
writeln!(coloring("green"), "Chroot environment is ready!");
|
||||
} else {
|
||||
writeln!(
|
||||
coloring("red"),
|
||||
"Failed while trying to delete the chroot copy."
|
||||
"Failed to create copy of root chroot environment."
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue