mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-26 10:21:52 +00:00
make scripts optional
This commit is contained in:
@@ -29,7 +29,7 @@ pub struct S9pkPacker<
|
||||
icon: RIcon,
|
||||
docker_images: RDockerImages,
|
||||
assets: RAssets,
|
||||
scripts: RScripts,
|
||||
scripts: Option<RScripts>,
|
||||
}
|
||||
impl<
|
||||
'a,
|
||||
@@ -118,14 +118,16 @@ impl<
|
||||
};
|
||||
position = new_pos;
|
||||
// scripts
|
||||
std::io::copy(&mut self.scripts, &mut writer)
|
||||
.with_ctx(|_| (crate::ErrorKind::Filesystem, "Copying Scripts"))?;
|
||||
let new_pos = writer.inner_mut().stream_position()?;
|
||||
header.table_of_contents.scripts = Some(FileSection {
|
||||
position,
|
||||
length: new_pos - position,
|
||||
});
|
||||
position = new_pos;
|
||||
if let Some(mut scripts) = self.scripts {
|
||||
std::io::copy(&mut scripts, &mut writer)
|
||||
.with_ctx(|_| (crate::ErrorKind::Filesystem, "Copying Scripts"))?;
|
||||
let new_pos = writer.inner_mut().stream_position()?;
|
||||
header.table_of_contents.scripts = Some(FileSection {
|
||||
position,
|
||||
length: new_pos - position,
|
||||
});
|
||||
position = new_pos;
|
||||
}
|
||||
|
||||
// header
|
||||
let (hash, _) = writer.finish();
|
||||
|
||||
@@ -107,7 +107,11 @@ pub fn pack(#[context] ctx: SdkContext, #[arg] path: Option<PathBuf>) -> Result<
|
||||
})
|
||||
.scripts({
|
||||
let script_path = path.join(manifest.assets.scripts_path()).join("embassy.js");
|
||||
File::open(script_path)?
|
||||
if script_path.exists() {
|
||||
Some(File::open(script_path)?)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
})
|
||||
.build()
|
||||
.pack(&ctx.developer_key()?)?;
|
||||
|
||||
Reference in New Issue
Block a user