mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-26 10:21:52 +00:00
create script dirs on install
This commit is contained in:
@@ -25,6 +25,9 @@ use tokio_stream::wrappers::ReadDirStream;
|
||||
use tracing::instrument;
|
||||
|
||||
use self::cleanup::{cleanup_failed, remove_from_current_dependents_lists};
|
||||
use crate::config::ConfigReceipts;
|
||||
use crate::context::{CliContext, RpcContext};
|
||||
use crate::core::rpc_continuations::{RequestGuid, RpcContinuation};
|
||||
use crate::db::model::{
|
||||
CurrentDependencyInfo, InstalledPackageDataEntry, PackageDataEntry, RecoveredPackageInfo,
|
||||
StaticDependencyInfo, StaticFiles,
|
||||
@@ -32,7 +35,8 @@ use crate::db::model::{
|
||||
use crate::db::util::WithRevision;
|
||||
use crate::dependencies::{
|
||||
add_dependent_to_current_dependents_lists, break_all_dependents_transitive,
|
||||
reconfigure_dependents_with_live_pointers, BreakageRes, DependencyError, DependencyErrors,
|
||||
reconfigure_dependents_with_live_pointers, BreakTransitiveReceipts, BreakageRes,
|
||||
DependencyError, DependencyErrors,
|
||||
};
|
||||
use crate::install::cleanup::{cleanup, update_dependency_errors_of_dependents};
|
||||
use crate::install::progress::{InstallProgress, InstallProgressTracker};
|
||||
@@ -44,15 +48,7 @@ use crate::util::io::{copy_and_shutdown, response_to_reader};
|
||||
use crate::util::serde::{display_serializable, IoFormat, Port};
|
||||
use crate::util::{display_none, AsyncFileExt, Version};
|
||||
use crate::version::{Current, VersionT};
|
||||
use crate::volume::asset_dir;
|
||||
use crate::{
|
||||
config::ConfigReceipts,
|
||||
context::{CliContext, RpcContext},
|
||||
};
|
||||
use crate::{
|
||||
core::rpc_continuations::{RequestGuid, RpcContinuation},
|
||||
dependencies::BreakTransitiveReceipts,
|
||||
};
|
||||
use crate::volume::{asset_dir, script_dir};
|
||||
use crate::{Error, ErrorKind, ResultExt};
|
||||
|
||||
pub mod cleanup;
|
||||
@@ -1123,6 +1119,13 @@ pub async fn install_s9pk<R: AsyncRead + AsyncSeek + Unpin>(
|
||||
let mut tar = tokio_tar::Archive::new(rdr.assets().await?);
|
||||
tar.unpack(asset_dir).await?;
|
||||
|
||||
let script_dir = script_dir(&ctx.datadir, pkg_id, version);
|
||||
if tokio::fs::metadata(&script_dir).await.is_err() {
|
||||
tokio::fs::create_dir_all(&script_dir).await?;
|
||||
}
|
||||
let mut tar = tokio_tar::Archive::new(rdr.scripts().await?);
|
||||
tar.unpack(script_dir).await?;
|
||||
|
||||
Ok(())
|
||||
})
|
||||
.await?;
|
||||
|
||||
@@ -84,7 +84,8 @@ impl TableOfContents {
|
||||
+ (1 + "instructions".len() + 16)
|
||||
+ (1 + "icon".len() + 16)
|
||||
+ (1 + "docker_images".len() + 16)
|
||||
+ (1 + "assets".len() + 16)) as u32;
|
||||
+ (1 + "assets".len() + 16)
|
||||
+ (1 + "scripts".len() + 16)) as u32;
|
||||
writer.write_all(&u32::to_be_bytes(len))?;
|
||||
self.manifest.serialize_entry("manifest", &mut writer)?;
|
||||
self.license.serialize_entry("license", &mut writer)?;
|
||||
|
||||
@@ -305,4 +305,8 @@ impl<R: AsyncRead + AsyncSeek + Unpin> S9pkReader<R> {
|
||||
pub async fn assets<'a>(&'a mut self) -> Result<ReadHandle<'a, R>, Error> {
|
||||
Ok(self.read_handle(self.toc.assets).await?)
|
||||
}
|
||||
|
||||
pub async fn scripts<'a>(&'a mut self) -> Result<ReadHandle<'a, R>, Error> {
|
||||
Ok(self.read_handle(self.toc.scripts).await?)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user