mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-30 12:11:56 +00:00
cleanup assets and scripts on uninstall
This commit is contained in:
@@ -6,19 +6,20 @@ use sqlx::{Executor, Sqlite};
|
|||||||
use tracing::instrument;
|
use tracing::instrument;
|
||||||
|
|
||||||
use super::{PKG_ARCHIVE_DIR, PKG_DOCKER_DIR};
|
use super::{PKG_ARCHIVE_DIR, PKG_DOCKER_DIR};
|
||||||
use crate::db::model::{InstalledPackageDataEntry, PackageDataEntry};
|
use crate::config::{not_found, ConfigReceipts};
|
||||||
use crate::{config::not_found, dependencies::reconfigure_dependents_with_live_pointers};
|
use crate::context::RpcContext;
|
||||||
use crate::{config::ConfigReceipts, context::RpcContext};
|
use crate::db::model::{
|
||||||
use crate::{
|
AllPackageData, CurrentDependencyInfo, CurrentDependencyInfo, InstalledPackageDataEntry,
|
||||||
db::model::AllPackageData,
|
InstalledPackageDataEntry, PackageDataEntry, PackageDataEntry,
|
||||||
s9pk::manifest::{Manifest, PackageId},
|
|
||||||
};
|
};
|
||||||
use crate::{db::model::CurrentDependencyInfo, error::ErrorCollection};
|
use crate::dependencies::{
|
||||||
use crate::{
|
reconfigure_dependents_with_live_pointers, DependencyErrors, TryHealReceipts,
|
||||||
dependencies::DependencyErrors,
|
|
||||||
util::{Apply, Version},
|
|
||||||
};
|
};
|
||||||
use crate::{dependencies::TryHealReceipts, Error};
|
use crate::error::ErrorCollection;
|
||||||
|
use crate::s9pk::manifest::{Manifest, PackageId, PackageId};
|
||||||
|
use crate::util::{Apply, Version, Version};
|
||||||
|
use crate::volume::PKG_VOLUME_DIR;
|
||||||
|
use crate::Error;
|
||||||
|
|
||||||
pub struct UpdateDependencyReceipts {
|
pub struct UpdateDependencyReceipts {
|
||||||
try_heal: TryHealReceipts,
|
try_heal: TryHealReceipts,
|
||||||
@@ -148,6 +149,28 @@ pub async fn cleanup(ctx: &RpcContext, id: &PackageId, version: &Version) -> Res
|
|||||||
.await
|
.await
|
||||||
.apply(|res| errors.handle(res));
|
.apply(|res| errors.handle(res));
|
||||||
}
|
}
|
||||||
|
let assets_path = ctx
|
||||||
|
.datadir
|
||||||
|
.join(PKG_VOLUME_DIR)
|
||||||
|
.join(id)
|
||||||
|
.join("assets")
|
||||||
|
.join(version.as_str());
|
||||||
|
if tokio::fs::metadata(&assets_path).await.is_ok() {
|
||||||
|
tokio::fs::remove_dir_all(&assets_path)
|
||||||
|
.await
|
||||||
|
.apply(|res| errors.handle(res));
|
||||||
|
}
|
||||||
|
let scripts_path = ctx
|
||||||
|
.datadir
|
||||||
|
.join(PKG_VOLUME_DIR)
|
||||||
|
.join(id)
|
||||||
|
.join("scripts")
|
||||||
|
.join(version.as_str());
|
||||||
|
if tokio::fs::metadata(&scripts_path).await.is_ok() {
|
||||||
|
tokio::fs::remove_dir_all(&scripts_path)
|
||||||
|
.await
|
||||||
|
.apply(|res| errors.handle(res));
|
||||||
|
}
|
||||||
|
|
||||||
errors.into_result()
|
errors.into_result()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user