From c947b6f0ae5304c2f5edace7201df62e85290b20 Mon Sep 17 00:00:00 2001 From: wangyueliang Date: Wed, 27 Dec 2023 16:32:37 +0800 Subject: [PATCH] unify adapt to NestOS patches --- 0001-adapt-to-NestOS-patch.patch | 334 +++++++++++++++++++ fix-nestos-installer-iso-command-error.patch | 12 - nestos-installer.spec | 15 +- 3 files changed, 345 insertions(+), 16 deletions(-) create mode 100644 0001-adapt-to-NestOS-patch.patch delete mode 100644 fix-nestos-installer-iso-command-error.patch diff --git a/0001-adapt-to-NestOS-patch.patch b/0001-adapt-to-NestOS-patch.patch new file mode 100644 index 0000000..876d465 --- /dev/null +++ b/0001-adapt-to-NestOS-patch.patch @@ -0,0 +1,334 @@ +From 3d3049e055cd56b4e72f44e212d7b2c5392975d4 Mon Sep 17 00:00:00 2001 +From: wangyueliang +Date: Wed, 27 Dec 2023 11:28:19 +0800 +Subject: [PATCH] adapt to NestOS patch + +--- + src/bin/rdcore/rootmap.rs | 2 +- + src/cmdline/install.rs | 15 +++++------ + src/cmdline/mod.rs | 54 ++++++++++++++++++++------------------- + src/install.rs | 3 +++ + src/iso9660.rs | 3 +++ + src/live/customize.rs | 2 +- + src/live/embed.rs | 2 +- + src/live/mod.rs | 2 +- + src/main.rs | 5 ++-- + src/source.rs | 2 +- + 10 files changed, 49 insertions(+), 41 deletions(-) + +diff --git a/src/bin/rdcore/rootmap.rs b/src/bin/rdcore/rootmap.rs +index fbe85b3..c305f16 100644 +--- a/src/bin/rdcore/rootmap.rs ++++ b/src/bin/rdcore/rootmap.rs +@@ -52,7 +52,7 @@ pub fn rootmap(config: RootmapConfig) -> Result<()> { + // systemd-fstab-generator, and it defaults to read-only otherwise + kargs.push("rw".into()); + +- let rootflags = runcmd_output!("coreos-rootflags", &config.root_mount)?; ++ let rootflags = runcmd_output!("nestos-rootflags", &config.root_mount)?; + let rootflags = rootflags.trim(); + if !rootflags.is_empty() { + kargs.push(format!("rootflags={}", rootflags)); +diff --git a/src/cmdline/install.rs b/src/cmdline/install.rs +index e04901e..f0eed2e 100644 +--- a/src/cmdline/install.rs ++++ b/src/cmdline/install.rs +@@ -74,10 +74,10 @@ pub struct InstallConfig { + pub config_file: Vec, + + // ways to specify the image source +- /// Fedora CoreOS stream ++ /// NestOS release stream + /// +- /// The name of the Fedora CoreOS stream to install, such as "stable", +- /// "testing", or "next". ++ /// The name of the NestOS release stream to install, ++ /// temporarily closed before NestOS Stream is ready. + #[clap(short, long, value_name = "name")] + #[clap(conflicts_with = "image-file", conflicts_with = "image-url")] + pub stream: Option, +@@ -134,7 +134,7 @@ pub struct InstallConfig { + /// Additional kernel args for the first boot + // This used to be for configuring networking from the cmdline, but it has + // been obsoleted by the nicer `--copy-network` approach. We still need it +- // for now though. It's used at least by `coreos-installer.service`. ++ // for now though. It's used at least by `nestos-installer.service`. + #[serde(skip)] + #[clap(long, hide = true, value_name = "args")] + pub firstboot_args: Option, +@@ -200,16 +200,15 @@ pub struct InstallConfig { + #[serde(skip_serializing_if = "is_default")] + #[clap(long, help_heading = ADVANCED)] + pub insecure_ignition: bool, +- /// Base URL for CoreOS stream metadata ++ /// Base URL for NestOS release stream metadata + /// +- /// Override the base URL for fetching CoreOS stream metadata. +- /// The default is "https://builds.coreos.fedoraproject.org/streams/". ++ /// Temporarily closed before NestOS Stream is ready. + #[serde_as(as = "Option")] + #[clap(long, value_name = "URL", help_heading = ADVANCED)] + pub stream_base_url: Option, + /// Don't clear partition table on error + /// +- /// If installation fails, coreos-installer normally clears the ++ /// If installation fails, nestos-installer normally clears the + /// destination's partition table to prevent booting from invalid + /// boot media. Skip clearing the partition table as a debugging aid. + #[serde(skip_serializing_if = "is_default")] +diff --git a/src/cmdline/mod.rs b/src/cmdline/mod.rs +index 6fcfe8f..b990232 100644 +--- a/src/cmdline/mod.rs ++++ b/src/cmdline/mod.rs +@@ -34,7 +34,9 @@ pub use self::types::*; + // Args are listed in --help in the order declared in these structs/enums. + // Please keep the entire help text to 80 columns. + +-/// Installer for Fedora CoreOS and RHEL CoreOS ++/// Installer for NestOS. ++/// ++/// NestOS is a Variant in openEuler from Fedora CoreOS. + #[derive(Debug, Parser)] + #[clap(version)] + #[clap(global_setting(AppSettings::DeriveDisplayOrder))] +@@ -42,16 +44,16 @@ pub use self::types::*; + #[clap(disable_help_subcommand = true)] + #[clap(help_expected = true)] + pub enum Cmd { +- /// Install Fedora CoreOS or RHEL CoreOS ++ /// Install NestOS + Install(InstallConfig), +- /// Download a CoreOS image +- Download(DownloadConfig), +- /// List available images in a Fedora CoreOS stream +- ListStream(ListStreamConfig), +- /// Commands to manage a CoreOS live ISO image ++ /// Download a NestOS image ++ //Download(DownloadConfig), ++ /// List available images in a NestOS release stream ++ //ListStream(ListStreamConfig), ++ /// Commands to manage a NestOS live ISO image + #[clap(subcommand)] + Iso(IsoCmd), +- /// Commands to manage a CoreOS live PXE image ++ /// Commands to manage a NestOS live PXE image + #[clap(subcommand)] + Pxe(PxeCmd), + /// Metadata packing commands used when building an OS image +@@ -76,21 +78,21 @@ pub enum IsoCmd { + // deprecated + #[clap(hide = true)] + Remove(IsoRemoveConfig), +- /// Customize a CoreOS live ISO image ++ /// Customize a NestOS live ISO image + Customize(IsoCustomizeConfig), +- /// Embed an Ignition config in a CoreOS live ISO image ++ /// Embed an Ignition config in a NestOS live ISO image + #[clap(subcommand)] + Ignition(IsoIgnitionCmd), +- /// Embed network settings in a CoreOS live ISO image ++ /// Embed network settings in a NestOS live ISO image + #[clap(subcommand)] + Network(IsoNetworkCmd), +- /// Modify kernel args in a CoreOS live ISO image ++ /// Modify kernel args in a NestOS live ISO image + #[clap(subcommand)] + Kargs(IsoKargsCmd), +- /// Commands to extract files from a CoreOS live ISO image ++ /// Commands to extract files from a NestOS live ISO image + #[clap(subcommand)] + Extract(IsoExtractCmd), +- /// Restore a CoreOS live ISO image to default settings ++ /// Restore a NestOS live ISO image to default settings + Reset(IsoResetConfig), + } + +@@ -128,7 +130,7 @@ pub enum IsoKargsCmd { + pub enum IsoExtractCmd { + /// Extract PXE files from an ISO image + Pxe(IsoExtractPxeConfig), +- /// Extract a minimal ISO from a CoreOS live ISO image ++ /// Extract a minimal ISO from a NestOS live ISO image + MinimalIso(IsoExtractMinimalIsoConfig), + } + +@@ -164,11 +166,11 @@ pub enum PxeNetworkCmd { + // users shouldn't be interacting with this command normally + #[clap(hide = true)] + pub enum PackCmd { +- /// Create osmet file from CoreOS block device ++ /// Create osmet file from NestOS block device + Osmet(PackOsmetConfig), +- /// Pack a minimal ISO into a CoreOS live ISO image ++ /// Pack a minimal ISO into a NestOS live ISO image + MinimalIso(PackMinimalIsoConfig), +- /// Generate man pages for coreos-installer ++ /// Generate man pages for nestos-installer + #[cfg(feature = "docgen")] + Man(PackManConfig), + /// Generate example config file for install subcommand +@@ -190,7 +192,7 @@ pub enum DevCmd { + + #[derive(Debug, Parser)] + pub enum DevShowCmd { +- /// Inspect the CoreOS live ISO image ++ /// Inspect the NestOS live ISO image + Iso(DevShowIsoConfig), + /// Show the contents of an initrd image + Initrd(DevShowInitrdConfig), +@@ -208,13 +210,13 @@ pub enum DevExtractCmd { + + #[derive(Debug, Parser)] + pub struct DownloadConfig { +- /// Fedora CoreOS stream ++ /// NestOS release stream + #[clap(short, long, value_name = "name", default_value = "stable")] + pub stream: String, + /// Target CPU architecture + #[clap(short, long, value_name = "name", default_value_t)] + pub architecture: DefaultedString, +- /// Fedora CoreOS platform name ++ /// NestOS platform name + #[clap(short, long, value_name = "name", default_value = "metal")] + pub platform: String, + /// Image format +@@ -232,7 +234,7 @@ pub struct DownloadConfig { + /// Skip signature verification + #[clap(long)] + pub insecure: bool, +- /// Base URL for Fedora CoreOS stream metadata ++ /// Base URL for NestOS release stream metadata + #[clap(long, value_name = "URL")] + pub stream_base_url: Option, + /// Fetch retries, or "infinite" +@@ -242,10 +244,10 @@ pub struct DownloadConfig { + + #[derive(Debug, Parser)] + pub struct ListStreamConfig { +- /// Fedora CoreOS stream ++ /// NestOS release stream + #[clap(short, long, value_name = "name", default_value = "stable")] + pub stream: String, +- /// Base URL for Fedora CoreOS stream metadata ++ /// Base URL for NestOS release stream metadata + #[clap(long, value_name = "URL")] + pub stream_base_url: Option, + } +@@ -326,7 +328,7 @@ pub struct CommonCustomizeConfig { + pub post_install: Vec, + /// Installer config file + /// +- /// Automatically run coreos-installer and apply the specified installer ++ /// Automatically run nestos-installer and apply the specified installer + /// config file. Config files are applied in the order that they are + /// specified. + #[clap(long, value_name = "path")] +@@ -634,7 +636,7 @@ pub struct PxeCustomizeConfig { + /// Output file + #[clap(short, long, value_name = "path")] + pub output: String, +- /// CoreOS live initramfs image ++ /// NestOS live initramfs image + #[clap(value_name = "path")] + pub input: String, + } +diff --git a/src/install.rs b/src/install.rs +index 745651d..42363a0 100644 +--- a/src/install.rs ++++ b/src/install.rs +@@ -122,6 +122,9 @@ pub fn install(config: InstallConfig) -> Result<()> { + None => bail!("cannot perform offline install; metadata missing"), + } + } else { ++ //Temporarily closed before NestOS Stream is ready. ++ bail!("The --stream is not currently supported until NestOS release stream is ready."); ++ + // For now, using --stream automatically will cause a download. In the future, we could + // opportunistically use osmet if the version and stream match an osmet file/the live ISO. + +diff --git a/src/iso9660.rs b/src/iso9660.rs +index 531d133..01e347a 100644 +--- a/src/iso9660.rs ++++ b/src/iso9660.rs +@@ -127,6 +127,9 @@ impl IsoFs { + .with_context(|| format!("listing directory {}", dir.name))? + { + let record = record?; ++ if name == "OPENEULER"{ ++ return Ok(Some(record)) ++ } + match &record { + DirectoryRecord::Directory(d) if d.name == name => return Ok(Some(record)), + DirectoryRecord::File(f) if f.name == name => return Ok(Some(record)), +diff --git a/src/live/customize.rs b/src/live/customize.rs +index 5aee32b..04ed919 100644 +--- a/src/live/customize.rs ++++ b/src/live/customize.rs +@@ -30,7 +30,7 @@ use super::util::filename; + + pub(super) const INITRD_FEATURES_PATH: &str = "etc/nestos/features.json"; + +-const COREOS_ISO_FEATURES_PATH: &str = "COREOS/FEATURES.JSO"; ++const COREOS_ISO_FEATURES_PATH: &str = "NESTOS/FEATURES.JSO"; + + /// CoreOS feature flags in /etc/coreos/features.json in the live initramfs + /// and /coreos/features.json in the live ISO. Written by +diff --git a/src/live/embed.rs b/src/live/embed.rs +index cbfdf95..334e860 100644 +--- a/src/live/embed.rs ++++ b/src/live/embed.rs +@@ -42,7 +42,7 @@ const COREOS_KARG_EMBED_AREA_HEADER_MAGIC: &[u8] = b"coreKarg"; + const COREOS_KARG_EMBED_AREA_HEADER_SIZE: u64 = 72; + const COREOS_KARG_EMBED_AREA_HEADER_MAX_OFFSETS: usize = 6; + const COREOS_KARG_EMBED_AREA_MAX_SIZE: usize = 2048; +-const COREOS_KARG_EMBED_INFO_PATH: &str = "COREOS/KARGS.JSO"; ++const COREOS_KARG_EMBED_INFO_PATH: &str = "NESTOS/KARGS.JSO"; + + pub(super) struct IsoConfig { + initrd: InitrdEmbedArea, +diff --git a/src/live/mod.rs b/src/live/mod.rs +index f80dcbc..051dae7 100644 +--- a/src/live/mod.rs ++++ b/src/live/mod.rs +@@ -39,7 +39,7 @@ use self::util::*; + const INITRD_LIVE_STAMP_PATH: &str = "etc/nestos-live-initramfs"; + const COREOS_ISO_PXEBOOT_DIR: &str = "IMAGES/PXEBOOT"; + const COREOS_ISO_ROOTFS_IMG: &str = "IMAGES/PXEBOOT/ROOTFS.IMG"; +-const COREOS_ISO_MINISO_FILE: &str = "COREOS/MINISO.DAT"; ++const COREOS_ISO_MINISO_FILE: &str = "NESTOS/MINISO.DAT"; + + lazy_static! { + static ref ALL_GLOB: GlobMatcher = GlobMatcher::new(&["*"]).unwrap(); +diff --git a/src/main.rs b/src/main.rs +index 539b121..09849f8 100644 +--- a/src/main.rs ++++ b/src/main.rs +@@ -21,9 +21,10 @@ use cmdline::*; + + fn main() -> Result<()> { + match Cmd::parse() { +- Cmd::Download(c) => download::download(c), ++ //Temporarily closed Download and ListStream before NestOS Stream is ready. ++ //Cmd::Download(c) => download::download(c), + Cmd::Install(c) => install::install(c), +- Cmd::ListStream(c) => source::list_stream(c), ++ //Cmd::ListStream(c) => source::list_stream(c), + Cmd::Iso(c) => match c { + IsoCmd::Customize(c) => live::iso_customize(c), + IsoCmd::Embed(c) => live::iso_embed(c), +diff --git a/src/source.rs b/src/source.rs +index cef04ff..a7d08f6 100644 +--- a/src/source.rs ++++ b/src/source.rs +@@ -33,7 +33,7 @@ use crate::util::set_die_on_sigpipe; + const HTTP_COMPLETION_TIMEOUT: Duration = Duration::from_secs(4 * 60 * 60); + + /// Default base URL to Fedora CoreOS streams metadata. +-const DEFAULT_STREAM_BASE_URL: &str = "https://builds.coreos.fedoraproject.org/streams/"; ++const DEFAULT_STREAM_BASE_URL: &str = "https://nestos.org.cn/NestOS-release/streams/"; + + /// Directory in which we look for osmet files. + const OSMET_FILES_DIR: &str = "/run/nestos-installer/osmet"; +-- +2.25.1 + diff --git a/fix-nestos-installer-iso-command-error.patch b/fix-nestos-installer-iso-command-error.patch deleted file mode 100644 index d6c8fa5..0000000 --- a/fix-nestos-installer-iso-command-error.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- nestos-installer-v0.14.0/src/iso9660.rs 2022-06-14 16:41:41.000000000 +0800 -+++ nestos-installer-v0.14.0-new/src/iso9660.rs 2022-08-23 13:42:03.469259308 +0800 -@@ -120,6 +120,9 @@ impl IsoFs { - .with_context(|| format!("listing directory {}", dir.name))? - { - let record = record?; -+ if name == "OPENEULER"{ -+ return Ok(Some(record)) -+ } - match &record { - DirectoryRecord::Directory(d) if d.name == name => return Ok(Some(record)), - DirectoryRecord::File(f) if f.name == name => return Ok(Some(record)), diff --git a/nestos-installer.spec b/nestos-installer.spec index 80c27bf..76b3fe2 100644 --- a/nestos-installer.spec +++ b/nestos-installer.spec @@ -9,15 +9,14 @@ Name: rust-nestos-installer Version: 0.16.0 -Release: 3 +Release: 5 Summary: Installer for NestOS -# Upstream license specification: Apache-2.0 License: Apache-2.0 URL: https://gitee.com/openeuler/nestos-installer Source0: https://gitee.com/openeuler/nestos-installer/repository/archive/v%{version}.tar.gz Source1: %{crate}-%{version}-vendor.tar.gz -Patch01: fix-nestos-installer-iso-command-error.patch +Patch01: 0001-adapt-to-NestOS-patch.patch BuildRequires: rust-packaging openssl-devel zstd-devel BuildRequires: systemd @@ -25,6 +24,8 @@ BuildRequires: systemd %global _description %{expand: nestos-installer installs NestOS to bare-metal machines (or, occasionally, to virtual machines). + +NestOS is a Variant in openEuler from Fedora CoreOS. } %description %{_description} @@ -110,7 +111,13 @@ This subpackage contains boot-time infrastructure for NestOS. It is not needed %changelog -* Fri Dec 09 2022 liukuo - 0.16.0-3 +* Wed Dec 27 2023 wangyueliang - 0.16.0-5 +- unify adapt to NestOS patches + +* Fri Sep 22 2023 duyiwei7w - 0.16.0-4 +- modify-coreos-rootflags-to-fix-nestos-install-problem + +* Thu Dec 15 2022 dingdingaaaaa - 0.16.0-3 - License compliance rectification * Thu Dec 08 2022 fushanqing - 0.16.0-2