175 lines
7.2 KiB
Diff
175 lines
7.2 KiB
Diff
From 0209dce6484c29d2ac8408192c14d5490074809c Mon Sep 17 00:00:00 2001
|
|
From: duyiwei <duyiwei@kylinos.cn>
|
|
Date: Fri, 24 May 2024 10:40:49 +0800
|
|
Subject: [PATCH] Block unsupported functions and modify the coreos to nestos
|
|
|
|
Signed-off-by: duyiwei <duyiwei@kylinos.cn>
|
|
---
|
|
src/cmdline/install.rs | 8 ++++----
|
|
src/cmdline/mod.rs | 8 ++++----
|
|
src/install.rs | 11 +++++++++--
|
|
src/main.rs | 16 ++++++++--------
|
|
src/s390x/zipl.rs | 2 +-
|
|
src/source.rs | 4 ++--
|
|
6 files changed, 28 insertions(+), 21 deletions(-)
|
|
|
|
diff --git a/src/cmdline/install.rs b/src/cmdline/install.rs
|
|
index 459c7c5..1945590 100644
|
|
--- a/src/cmdline/install.rs
|
|
+++ b/src/cmdline/install.rs
|
|
@@ -78,12 +78,12 @@ pub struct InstallConfig {
|
|
///
|
|
/// The name of the NestOS release stream to install,
|
|
/// temporarily closed before NestOS Stream is ready.
|
|
- #[arg(short, long, value_name = "name")]
|
|
+ #[arg(short, long, hide = true, value_name = "name")]
|
|
#[arg(conflicts_with_all = ["image_file", "image_url"])]
|
|
pub stream: Option<String>,
|
|
/// Manually specify the image URL
|
|
///
|
|
- /// coreos-installer appends ".sig" to find the GPG signature for the
|
|
+ /// nestos-installer appends ".sig" to find the GPG signature for the
|
|
/// image, which must exist and be valid. A missing signature can be
|
|
/// ignored with --insecure.
|
|
#[serde_as(as = "Option<DisplayFromStr>")]
|
|
@@ -92,7 +92,7 @@ pub struct InstallConfig {
|
|
pub image_url: Option<Url>,
|
|
/// Manually specify a local image file
|
|
///
|
|
- /// coreos-installer appends ".sig" to find the GPG signature for the
|
|
+ /// nestos-installer appends ".sig" to find the GPG signature for the
|
|
/// image, which must exist and be valid. A missing signature can be
|
|
/// ignored with --insecure.
|
|
#[arg(short = 'f', long, value_name = "path")]
|
|
@@ -234,7 +234,7 @@ pub struct InstallConfig {
|
|
///
|
|
/// Temporarily closed before NestOS Stream is ready.
|
|
#[serde_as(as = "Option<DisplayFromStr>")]
|
|
- #[arg(long, value_name = "URL", help_heading = ADVANCED)]
|
|
+ #[arg(long, hide = true, value_name = "URL", help_heading = ADVANCED)]
|
|
pub stream_base_url: Option<Url>,
|
|
/// Don't clear partition table on error
|
|
///
|
|
diff --git a/src/cmdline/mod.rs b/src/cmdline/mod.rs
|
|
index b78b54b..88efdc8 100644
|
|
--- a/src/cmdline/mod.rs
|
|
+++ b/src/cmdline/mod.rs
|
|
@@ -45,10 +45,10 @@ pub use self::types::*;
|
|
pub enum Cmd {
|
|
/// Install NestOS
|
|
Install(InstallConfig),
|
|
- /// Download a NestOS image
|
|
- Download(DownloadConfig),
|
|
- /// List available images in a NestOS release stream
|
|
- ListStream(ListStreamConfig),
|
|
+ // Download a NestOS image
|
|
+ //Download(DownloadConfig),
|
|
+ // List available images in a NestOS release stream
|
|
+ //ListStream(ListStreamConfig),
|
|
/// Commands to manage a NestOS live ISO image
|
|
#[command(subcommand)]
|
|
Iso(IsoCmd),
|
|
diff --git a/src/install.rs b/src/install.rs
|
|
index 2182117..904ddd8 100644
|
|
--- a/src/install.rs
|
|
+++ b/src/install.rs
|
|
@@ -36,6 +36,13 @@ use crate::source::*;
|
|
const GRUB_CFG_CONSOLE_SETTINGS_RE: &str = r"(?P<prefix>\n# CONSOLE-SETTINGS-START\n)(?P<commands>([^\n]*\n)*)(?P<suffix># CONSOLE-SETTINGS-END\n)";
|
|
|
|
pub fn install(config: InstallConfig) -> Result<()> {
|
|
+ if config.stream.is_some() {
|
|
+ bail!("The --stream is not currently supported until NestOS release stream is ready.");
|
|
+ }
|
|
+
|
|
+ if config.stream_base_url.is_some() {
|
|
+ bail!("The --stream-base-url is not currently supported until NestOS release stream is ready.");
|
|
+ }
|
|
// evaluate config files
|
|
let config = config.expand_config_files()?;
|
|
|
|
@@ -149,8 +156,6 @@ 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.
|
|
|
|
@@ -162,6 +167,8 @@ pub fn install(config: InstallConfig) -> Result<()> {
|
|
if let Some(osmet) = maybe_osmet {
|
|
Box::new(osmet)
|
|
} else {
|
|
+ //Temporarily unsupported before NestOS Stream is ready.
|
|
+ bail!("Stream fetching of images is not supported. Ensure you are in a NestOS live environment or provide a valid image source.");
|
|
let format = match sector_size {
|
|
4096 => "4k.raw.xz",
|
|
512 => "raw.xz",
|
|
diff --git a/src/main.rs b/src/main.rs
|
|
index 32e1040..9c1d5bc 100644
|
|
--- a/src/main.rs
|
|
+++ b/src/main.rs
|
|
@@ -22,16 +22,16 @@ use cmdline::*;
|
|
fn main() -> Result<()> {
|
|
match Cmd::parse() {
|
|
//Temporarily closed Download and ListStream before NestOS Stream is ready.
|
|
- Cmd::Download(_) => {
|
|
+ //Cmd::Download(_) => {
|
|
// download::download(c);
|
|
- println!("Download is temporarily closed before NestOS Stream is ready.");
|
|
- Ok(())
|
|
- },
|
|
- Cmd::ListStream(_) => {
|
|
+ //println!("Download is temporarily closed before NestOS Stream is ready.");
|
|
+ //Ok(())
|
|
+ //},
|
|
+ //Cmd::ListStream(_) => {
|
|
// source::list_stream(c);
|
|
- println!("ListStream is temporarily closed before NestOS Stream is ready.");
|
|
- Ok(())
|
|
- },
|
|
+ // println!("ListStream is temporarily closed before NestOS Stream is ready.");
|
|
+ // Ok(())
|
|
+ //},
|
|
Cmd::Install(c) => install::install(c),
|
|
Cmd::Iso(c) => match c {
|
|
IsoCmd::Customize(c) => live::iso_customize(c),
|
|
diff --git a/src/s390x/zipl.rs b/src/s390x/zipl.rs
|
|
index 5fc2026..963c8ee 100644
|
|
--- a/src/s390x/zipl.rs
|
|
+++ b/src/s390x/zipl.rs
|
|
@@ -403,7 +403,7 @@ pub fn zipl<P: AsRef<Path>>(
|
|
/// Returns the first-boot kargs embedded in the contents `s` of a firstboot file.
|
|
///
|
|
/// Note this isn't intended to be a general purpose GRUB config language parser. Only the exact
|
|
-/// format used by coreos-installer is recognized. Any other format triggers an error.
|
|
+/// format used by nestos-installer is recognized. Any other format triggers an error.
|
|
fn extract_firstboot_kargs(s: &str) -> Result<Option<String>> {
|
|
let s = s.trim();
|
|
if s.is_empty() {
|
|
diff --git a/src/source.rs b/src/source.rs
|
|
index f293d29..fb65929 100644
|
|
--- a/src/source.rs
|
|
+++ b/src/source.rs
|
|
@@ -30,7 +30,7 @@ use crate::util::set_die_on_sigpipe;
|
|
/// Completion timeout for HTTP requests (4 hours).
|
|
const HTTP_COMPLETION_TIMEOUT: Duration = Duration::from_secs(4 * 60 * 60);
|
|
|
|
-/// Default base URL to Fedora CoreOS streams metadata.
|
|
+/// Default base URL to NestOS streams metadata.
|
|
const DEFAULT_STREAM_BASE_URL: &str = "https://nestos.org.cn/NestOS-release/streams/";
|
|
|
|
/// Directory in which we look for osmet files.
|
|
@@ -70,7 +70,7 @@ pub struct UrlLocation {
|
|
retries: FetchRetries,
|
|
}
|
|
|
|
-// Remote image source specified by Fedora CoreOS stream metadata
|
|
+// Remote image source specified by NestOS stream metadata
|
|
#[derive(Debug)]
|
|
pub struct StreamLocation {
|
|
stream_base_url: Option<Url>,
|
|
--
|
|
2.33.0
|
|
|