forked from brl/citadel-tools
add kernel-version field to metainfo
This commit is contained in:
parent
27758b9a1a
commit
011a4b80ea
@ -148,6 +148,7 @@ impl UpdateBuilder {
|
||||
hdr.set_flag(ImageHeader::FLAG_DATA_COMPRESSED);
|
||||
|
||||
let metainfo = self.generate_metainfo();
|
||||
fs::write(self.config.workdir_path("metainfo"), &metainfo)?;
|
||||
hdr.set_metainfo_bytes(&metainfo);
|
||||
Ok(hdr)
|
||||
}
|
||||
@ -163,6 +164,9 @@ impl UpdateBuilder {
|
||||
|
||||
let mut v = Vec::new();
|
||||
writeln!(v, "image-type = \"{}\"", self.config.image_type())?;
|
||||
if let Some(kv) = self.config.kernel_version() {
|
||||
writeln!(v, "kernel-version = \"{}\"", kv)?;
|
||||
}
|
||||
writeln!(v, "channel = \"{}\"", self.config.channel())?;
|
||||
writeln!(v, "version = {}", self.config.version())?;
|
||||
writeln!(v, "nblocks = {}", self.nblocks.unwrap())?;
|
||||
|
@ -86,6 +86,10 @@ impl BuildConfig {
|
||||
&self.img_name
|
||||
}
|
||||
|
||||
pub fn kernel_version(&self) -> Option<&str> {
|
||||
self.kernel_version.as_ref().map(|s| s.as_str())
|
||||
}
|
||||
|
||||
pub fn version(&self) -> usize {
|
||||
self.version
|
||||
}
|
||||
|
@ -291,6 +291,8 @@ struct MetaInfoToml {
|
||||
#[serde(rename = "image-type")]
|
||||
image_type: String,
|
||||
channel: String,
|
||||
#[serde(rename = "kernel-version")]
|
||||
kernel_version: Option<String>,
|
||||
version: u32,
|
||||
#[serde(rename = "base-version")]
|
||||
base_version: Option<u32>,
|
||||
@ -351,6 +353,8 @@ impl MetaInfo {
|
||||
self.toml().channel.as_str()
|
||||
}
|
||||
|
||||
pub fn kernel_version(&self) -> Option<&str> { self.toml().kernel_version.as_ref().map(|s| s.as_str()) }
|
||||
|
||||
pub fn version(&self) -> u32 {
|
||||
self.toml().version
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user