Merge pull request #381 from kinode-dao/dr/wipe-pkg-on-install

fix: delete old /pkg when new one is unzipped to there
This commit is contained in:
doria 2024-06-07 03:43:21 +09:00 committed by GitHub
commit c4ea60f12a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 0 deletions

View File

@ -253,6 +253,15 @@ pub fn create_package_drive(
})?)
.send_and_await_response(VFS_TIMEOUT)??;
// DELETE the /pkg folder in the package drive
// in order to replace with the fresh one
Request::to(("our", "vfs", "distro", "sys"))
.body(serde_json::to_vec(&vfs::VfsRequest {
path: drive_name.clone(),
action: vfs::VfsAction::RemoveDirAll,
})?)
.send_and_await_response(VFS_TIMEOUT)??;
// convert the zip to a new package drive
let response = Request::to(("our", "vfs", "distro", "sys"))
.body(serde_json::to_vec(&vfs::VfsRequest {

View File

@ -403,6 +403,8 @@ async fn bootstrap(
// create a new package in VFS
let our_drive_name = [package_name, package_publisher].join(":");
let pkg_path = format!("{}/vfs/{}/pkg", &home_directory_path, &our_drive_name);
// delete anything currently residing in the pkg folder
fs::remove_dir_all(&pkg_path).await?;
fs::create_dir_all(&pkg_path)
.await
.expect("bootstrap vfs dir pkg creation failed!");