add .7z format support

This commit is contained in:
2026-09-10 22:10:46 +03:00
parent 410f4524c2
commit 4a3dff8f98
4 changed files with 22 additions and 6 deletions

View File

@ -94,7 +94,7 @@ pub fn download(repo: &String, pkgname: &String, force: bool, recursive: bool) {
io::stdout().flush().unwrap();
let mut cmd = Command::new("rsync");
cmd.arg("-azHX").arg("--stats").arg("--no-times");
cmd.arg("-azHX").arg("--stats");
if force { cmd.arg("--delete"); }
cmd.arg(&remote_path);
cmd.arg(&local_path_sync);

View File

@ -43,15 +43,17 @@ pub fn download(repo: &String, pkgname: &String) {
}
}
else if url.is_empty() { return }
else if url.ends_with(".zip") {
else if url.ends_with(".zip") || url.ends_with(".7z") {
let ext = if url.ends_with(".zip") { "zip" } else { "7z" };
if let Err(e) = fs::create_dir_all(&src) {
panic!("Failed to create directory {}: {}", &src.display(), e)
}
let zip_path = src.join("archive.zip");
let archive_path = src.join(format!("archive.{}", ext));
let wget_status = Command::new("wget")
.arg("-O")
.arg(&zip_path)
.arg(&archive_path)
.arg("-q")
.arg("--show-progress")
.arg(&url)
@ -65,7 +67,7 @@ pub fn download(repo: &String, pkgname: &String) {
let output_flag = format!("-o{}", src.display());
let sevenz_status = Command::new("7z")
.arg("x")
.arg(&zip_path)
.arg(&archive_path)
.arg(output_flag)
.arg("-y")
.arg("-bd")
@ -79,7 +81,7 @@ pub fn download(repo: &String, pkgname: &String) {
panic!("Failed to extract zip archive from URL: {}", url)
}
fs::remove_file(&zip_path).ok();
fs::remove_file(&archive_path).ok();
}
else {
if let Err(e) = fs::create_dir_all(&src) {