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