pkg download command and patches
This commit is contained in:
@ -23,7 +23,7 @@ pub fn download(repo: &String, pkgname: &String) {
|
||||
|
||||
let src = pkgpath.join("src");
|
||||
if src.exists() {
|
||||
let src_url = fs::read_to_string(src.join("aeropkg.download-url")).unwrap_or("".to_string());
|
||||
let src_url = fs::read_to_string(src.join(".aeropkg.download-url")).unwrap_or("".to_string());
|
||||
if url == src_url { return }
|
||||
else {
|
||||
fs::remove_dir_all(&src).unwrap()
|
||||
@ -137,7 +137,10 @@ pub fn download(repo: &String, pkgname: &String) {
|
||||
.collect();
|
||||
|
||||
if dirs.len() == 1 {
|
||||
let single_dir = dirs[0].path();
|
||||
let old_path = dirs[0].path();
|
||||
let single_dir = old_path.parent().unwrap()
|
||||
.join(format!("{}.aeropkg.bkp", old_path.file_name().unwrap().to_string_lossy()));
|
||||
fs::rename(&old_path, &single_dir).unwrap();
|
||||
|
||||
for entry in fs::read_dir(&single_dir).unwrap() {
|
||||
let entry = entry.unwrap();
|
||||
@ -149,7 +152,7 @@ pub fn download(repo: &String, pkgname: &String) {
|
||||
}
|
||||
}
|
||||
|
||||
fs::write(src.join("aeropkg.download-url"), &url).unwrap();
|
||||
fs::write(src.join(".aeropkg.download-url"), &url).unwrap();
|
||||
|
||||
run_install_script_hook(repo, "download", &full_env)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user