upgrade version to 0.5.1
This commit is contained in:
parent
d55fadd764
commit
36add77849
@ -1,78 +0,0 @@
|
||||
From e052fac4f325236f88ef225ed3c3cc96a02fbfa8 Mon Sep 17 00:00:00 2001
|
||||
From: zhangyao2022 <zhangyao108@huawei.com>
|
||||
Date: Mon, 14 Aug 2023 18:33:47 +0800
|
||||
Subject: [PATCH] fix: Fixed parsing single quotes error
|
||||
|
||||
---
|
||||
core/libcore/src/exec/cmd.rs | 40 ++++++++++++++++++++++++++++++++++++
|
||||
1 file changed, 40 insertions(+)
|
||||
|
||||
diff --git a/core/libcore/src/exec/cmd.rs b/core/libcore/src/exec/cmd.rs
|
||||
index 8f9c62f9..60427397 100755
|
||||
--- a/core/libcore/src/exec/cmd.rs
|
||||
+++ b/core/libcore/src/exec/cmd.rs
|
||||
@@ -173,8 +173,24 @@ fn parse_exec(s: &str) -> Result<VecDeque<ExecCommand>> {
|
||||
let mut argv: Vec<String> = Vec::new();
|
||||
let mut cur = String::new();
|
||||
let mut found_semicolon_wait_space = false;
|
||||
+ let mut found_single_quote = false;
|
||||
for c in content.chars() {
|
||||
argv_start += 1;
|
||||
+
|
||||
+ if found_single_quote && c != '\'' {
|
||||
+ cur += &c.to_string();
|
||||
+ continue;
|
||||
+ }
|
||||
+ if c == '\'' {
|
||||
+ if found_single_quote {
|
||||
+ argv.push(cur);
|
||||
+ cur = "".to_string();
|
||||
+ found_single_quote = false;
|
||||
+ continue;
|
||||
+ }
|
||||
+ found_single_quote = true;
|
||||
+ continue;
|
||||
+ }
|
||||
if c == ' ' {
|
||||
/* now we find " ; ", break the loop */
|
||||
if found_semicolon_wait_space {
|
||||
@@ -205,6 +221,12 @@ fn parse_exec(s: &str) -> Result<VecDeque<ExecCommand>> {
|
||||
found_semicolon_wait_space = false;
|
||||
cur += &c.to_string();
|
||||
}
|
||||
+
|
||||
+ if found_single_quote {
|
||||
+ return Err(Error::Invalid {
|
||||
+ what: "no valid exec command, wrong single quote".to_string(),
|
||||
+ });
|
||||
+ }
|
||||
/* No more characters after " ;", drop current argv */
|
||||
if found_semicolon_wait_space {
|
||||
cur = String::new();
|
||||
@@ -395,5 +417,23 @@ mod tests {
|
||||
assert!(parse_exec(&path).is_err());
|
||||
|
||||
assert!(parse_exec("/bin/echo good ; ; ; ;").is_err());
|
||||
+ assert!(parse_exec("/bin/echo 'good1 good2").is_err());
|
||||
+ assert!(parse_exec("/bin/echo 'good good1' 'good2").is_err());
|
||||
+ assert_eq!(
|
||||
+ parse_exec("/bin/echo 'good good1' good2").unwrap(),
|
||||
+ VecDeque::from([ExecCommand {
|
||||
+ path: "/bin/echo".to_string(),
|
||||
+ argv: vec!["good good1".to_string(), "good2".to_string()],
|
||||
+ flags: ExecFlag::EXEC_COMMAND_EMPTY
|
||||
+ }])
|
||||
+ );
|
||||
+ assert_eq!(
|
||||
+ parse_exec("/bin/echo 'good good1' 'good2'").unwrap(),
|
||||
+ VecDeque::from([ExecCommand {
|
||||
+ path: "/bin/echo".to_string(),
|
||||
+ argv: vec!["good good1".to_string(), "good2".to_string()],
|
||||
+ flags: ExecFlag::EXEC_COMMAND_EMPTY
|
||||
+ }])
|
||||
+ );
|
||||
}
|
||||
}
|
||||
--
|
||||
2.30.2
|
||||
|
||||
@ -1,29 +0,0 @@
|
||||
From fe0b82ce77d6a825fdcf29099fe8e2f1bec296ec Mon Sep 17 00:00:00 2001
|
||||
From: licunlong <licunlong1@huawei.com>
|
||||
Date: Fri, 25 Aug 2023 10:32:23 +0800
|
||||
Subject: [PATCH] fix: delete and re-add the restart timer to make timer work
|
||||
again
|
||||
|
||||
---
|
||||
core/coms/service/src/mng.rs | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/core/coms/service/src/mng.rs b/core/coms/service/src/mng.rs
|
||||
index 526b6373..f9051f65 100755
|
||||
--- a/core/coms/service/src/mng.rs
|
||||
+++ b/core/coms/service/src/mng.rs
|
||||
@@ -1904,9 +1904,10 @@ impl RunningData {
|
||||
|
||||
if self.armd_timer() {
|
||||
let timer = self.timer();
|
||||
- events.set_enabled(timer.clone(), EventState::Off)?;
|
||||
+ events.del_source(timer.clone())?;
|
||||
|
||||
timer.set_time(usec);
|
||||
+ events.add_source(timer.clone())?;
|
||||
events.set_enabled(timer, EventState::OneShot)?;
|
||||
return Ok(0);
|
||||
}
|
||||
--
|
||||
2.30.2
|
||||
|
||||
@ -0,0 +1,69 @@
|
||||
From 00f3c592cf4d42009fcf15916b944abec4ed3876 Mon Sep 17 00:00:00 2001
|
||||
From: zhangyao2022 <zhangyao108@huawei.com>
|
||||
Date: Sat, 28 Oct 2023 15:56:01 +0800
|
||||
Subject: [PATCH] fix(getty-generator): delelte double quote in the
|
||||
configuration file
|
||||
|
||||
---
|
||||
tools/run_with_vm/getty.target | 4 ++--
|
||||
tools/run_with_vm/getty@.service | 12 ++++++------
|
||||
tools/run_with_vm/serial-getty@.service | 10 +++++-----
|
||||
3 files changed, 13 insertions(+), 13 deletions(-)
|
||||
|
||||
diff --git a/tools/run_with_vm/getty.target b/tools/run_with_vm/getty.target
|
||||
index bd44925e..56261a2b 100644
|
||||
--- a/tools/run_with_vm/getty.target
|
||||
+++ b/tools/run_with_vm/getty.target
|
||||
@@ -1,3 +1,3 @@
|
||||
[Unit]
|
||||
-Description="Login Prompts"
|
||||
-Documentation="man sysmaster secial target"
|
||||
+Description=Login Prompts
|
||||
+Documentation=man sysmaster secial target
|
||||
diff --git a/tools/run_with_vm/getty@.service b/tools/run_with_vm/getty@.service
|
||||
index 0e0d88d4..ae25bd78 100644
|
||||
--- a/tools/run_with_vm/getty@.service
|
||||
+++ b/tools/run_with_vm/getty@.service
|
||||
@@ -1,12 +1,12 @@
|
||||
[Unit]
|
||||
-Description="Getty on %I"
|
||||
-ConditionPathExists="/dev/tty0"
|
||||
+Description=Getty on %I
|
||||
+ConditionPathExists=/dev/tty0
|
||||
|
||||
[Service]
|
||||
-ExecStart="-/sbin/agetty -o '-p -- \\u' --noclear %I"
|
||||
-Type="simple"
|
||||
-Restart="always"
|
||||
+ExecStart=-/sbin/agetty -o '-p -- \\u' --noclear %I
|
||||
+Type=simple
|
||||
+Restart=always
|
||||
RestartSec=0
|
||||
|
||||
[Install]
|
||||
-WantedBy="getty.target"
|
||||
+WantedBy=getty.target
|
||||
diff --git a/tools/run_with_vm/serial-getty@.service b/tools/run_with_vm/serial-getty@.service
|
||||
index a80f7236..01d782a6 100644
|
||||
--- a/tools/run_with_vm/serial-getty@.service
|
||||
+++ b/tools/run_with_vm/serial-getty@.service
|
||||
@@ -1,11 +1,11 @@
|
||||
[Unit]
|
||||
-Description="Serial Getty on %I"
|
||||
+Description=Serial Getty on %I
|
||||
|
||||
[Service]
|
||||
-ExecStart="-/sbin/agetty -o '-p -- \\u' --keep-baud 115200,57600,38400,9600 %I"
|
||||
-Type="simple"
|
||||
-Restart="always"
|
||||
+ExecStart=-/sbin/agetty -o '-p -- \\u' --keep-baud 115200,57600,38400,9600 %I
|
||||
+Type=simple
|
||||
+Restart=always
|
||||
RestartSec=0
|
||||
|
||||
[Install]
|
||||
-WantedBy="getty.target"
|
||||
+WantedBy=getty.target
|
||||
--
|
||||
2.33.0
|
||||
|
||||
@ -1,51 +0,0 @@
|
||||
From 02168f76edce7622dbd72742a45bffa1f9eed5f2 Mon Sep 17 00:00:00 2001
|
||||
From: licunlong <licunlong1@huawei.com>
|
||||
Date: Thu, 31 Aug 2023 16:47:13 +0800
|
||||
Subject: [PATCH] fix: log the status message to stdout
|
||||
|
||||
---
|
||||
core/sctl/src/main.rs | 20 +++++++++++---------
|
||||
1 file changed, 11 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/core/sctl/src/main.rs b/core/sctl/src/main.rs
|
||||
index fb949f39..2a721d89 100755
|
||||
--- a/core/sctl/src/main.rs
|
||||
+++ b/core/sctl/src/main.rs
|
||||
@@ -14,9 +14,12 @@
|
||||
|
||||
#![allow(deprecated)]
|
||||
use clap::Parser;
|
||||
-use cmdproto::proto::{
|
||||
- abi::{sys_comm, unit_comm, CommandRequest},
|
||||
- mngr_comm, unit_file, ProstClientStream,
|
||||
+use cmdproto::{
|
||||
+ error::ERROR_CODE_MASK_PRINT_STDOUT,
|
||||
+ proto::{
|
||||
+ abi::{sys_comm, unit_comm, CommandRequest},
|
||||
+ mngr_comm, unit_file, ProstClientStream,
|
||||
+ },
|
||||
};
|
||||
use constants::SCTL_SOCKET;
|
||||
use std::process::exit;
|
||||
@@ -251,13 +254,12 @@ fn main() {
|
||||
exit(0);
|
||||
}
|
||||
|
||||
- if data.error_code == 0 {
|
||||
- /* Don't care if we fail to write the error out. */
|
||||
+ if data.error_code == 0 || (data.error_code & ERROR_CODE_MASK_PRINT_STDOUT != 0) {
|
||||
+ /* Don't care if we fail to write the message out. */
|
||||
let _ = writeln!(std::io::stdout(), "{}", data.message);
|
||||
- exit(0);
|
||||
+ } else {
|
||||
+ eprintln!("{}", data.message);
|
||||
}
|
||||
|
||||
- eprintln!("{}", data.message);
|
||||
-
|
||||
- exit(data.error_code as i32);
|
||||
+ exit((data.error_code & !ERROR_CODE_MASK_PRINT_STDOUT) as i32);
|
||||
}
|
||||
--
|
||||
2.30.2
|
||||
|
||||
@ -1,104 +0,0 @@
|
||||
From 948493051d5ebe07267973ab863ebfd8d9f7c94c Mon Sep 17 00:00:00 2001
|
||||
From: licunlong <licunlong1@huawei.com>
|
||||
Date: Tue, 22 Aug 2023 11:51:00 +0800
|
||||
Subject: [PATCH] fix: make control command accept -
|
||||
|
||||
---
|
||||
core/coms/service/src/mng.rs | 18 ++++++++++++++++++
|
||||
1 file changed, 18 insertions(+)
|
||||
|
||||
diff --git a/core/coms/service/src/mng.rs b/core/coms/service/src/mng.rs
|
||||
index f9051f6..b91806d 100755
|
||||
--- a/core/coms/service/src/mng.rs
|
||||
+++ b/core/coms/service/src/mng.rs
|
||||
@@ -64,6 +64,7 @@ pub(super) struct ServiceMng {
|
||||
rd: Rc<RunningData>,
|
||||
monitor: RefCell<ServiceMonitor>,
|
||||
current_main_command: RefCell<ExecCommand>,
|
||||
+ current_control_command: RefCell<ExecCommand>,
|
||||
}
|
||||
|
||||
impl ReStation for ServiceMng {
|
||||
@@ -164,6 +165,7 @@ impl ServiceMng {
|
||||
rd: rd.clone(),
|
||||
monitor: RefCell::new(ServiceMonitor::new()),
|
||||
current_main_command: RefCell::new(ExecCommand::empty()),
|
||||
+ current_control_command: RefCell::new(ExecCommand::empty()),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -291,6 +293,7 @@ impl ServiceMng {
|
||||
self.control_command_fill(ServiceCommand::Condition);
|
||||
match self.control_command_pop() {
|
||||
Some(cmd) => {
|
||||
+ *self.current_control_command.borrow_mut() = cmd.clone();
|
||||
match self.spawn.start_service(
|
||||
&cmd,
|
||||
self.config.config_data().borrow().Service.TimeoutStartSec,
|
||||
@@ -316,6 +319,7 @@ impl ServiceMng {
|
||||
self.control_command_fill(ServiceCommand::StartPre);
|
||||
match self.control_command_pop() {
|
||||
Some(cmd) => {
|
||||
+ *self.current_control_command.borrow_mut() = cmd.clone();
|
||||
match self.spawn.start_service(
|
||||
&cmd,
|
||||
self.config.config_data().borrow().Service.TimeoutStartSec,
|
||||
@@ -423,6 +427,7 @@ impl ServiceMng {
|
||||
self.control_command_fill(ServiceCommand::StartPost);
|
||||
match self.control_command_pop() {
|
||||
Some(cmd) => {
|
||||
+ *self.current_control_command.borrow_mut() = cmd.clone();
|
||||
match self.spawn.start_service(
|
||||
&cmd,
|
||||
self.config.config_data().borrow().Service.TimeoutStartSec,
|
||||
@@ -484,6 +489,7 @@ impl ServiceMng {
|
||||
self.control_command_fill(ServiceCommand::Stop);
|
||||
match self.control_command_pop() {
|
||||
Some(cmd) => {
|
||||
+ *self.current_control_command.borrow_mut() = cmd.clone();
|
||||
match self.spawn.start_service(&cmd, 0, ExecFlags::CONTROL) {
|
||||
Ok(pid) => self.pid.set_control(pid),
|
||||
Err(_e) => {
|
||||
@@ -532,6 +538,7 @@ impl ServiceMng {
|
||||
self.control_command_fill(ServiceCommand::StopPost);
|
||||
match self.control_command_pop() {
|
||||
Some(cmd) => {
|
||||
+ *self.current_control_command.borrow_mut() = cmd.clone();
|
||||
match self.spawn.start_service(&cmd, 0, ExecFlags::CONTROL) {
|
||||
Ok(pid) => self.pid.set_control(pid),
|
||||
Err(_e) => {
|
||||
@@ -636,6 +643,7 @@ impl ServiceMng {
|
||||
|
||||
match self.control_command_pop() {
|
||||
Some(cmd) => {
|
||||
+ *self.current_control_command.borrow_mut() = cmd.clone();
|
||||
match self.spawn.start_service(
|
||||
&cmd,
|
||||
self.config.config_data().borrow().Service.TimeoutStartSec,
|
||||
@@ -895,6 +903,7 @@ impl ServiceMng {
|
||||
};
|
||||
|
||||
if let Some(cmd) = self.control_command_pop() {
|
||||
+ *self.current_control_command.borrow_mut() = cmd.clone();
|
||||
match self.spawn.start_service(&cmd, time_out, ExecFlags::CONTROL) {
|
||||
Ok(pid) => self.pid.set_control(pid),
|
||||
Err(_e) => {
|
||||
@@ -1490,6 +1499,15 @@ impl ServiceMng {
|
||||
} else if self.pid.control() == Some(pid) {
|
||||
self.pid.reset_control();
|
||||
|
||||
+ if self
|
||||
+ .current_control_command
|
||||
+ .borrow()
|
||||
+ .get_exec_flag()
|
||||
+ .contains(ExecFlag::EXEC_COMMAND_IGNORE_FAILURE)
|
||||
+ {
|
||||
+ res = ServiceResult::Success;
|
||||
+ }
|
||||
+
|
||||
if !self.control_command.borrow().is_empty() && res == ServiceResult::Success {
|
||||
self.run_next_control();
|
||||
return;
|
||||
--
|
||||
2.33.0
|
||||
|
||||
@ -1,33 +0,0 @@
|
||||
From 17ba56f34249a0256009b139ad45c4259e95bae0 Mon Sep 17 00:00:00 2001
|
||||
From: licunlong <licunlong1@huawei.com>
|
||||
Date: Fri, 1 Sep 2023 14:54:42 +0800
|
||||
Subject: [PATCH] fix: return the correct error when condition/assert failed
|
||||
|
||||
---
|
||||
core/sysmaster/src/unit/entry/uentry.rs | 8 ++++----
|
||||
1 file changed, 4 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/core/sysmaster/src/unit/entry/uentry.rs b/core/sysmaster/src/unit/entry/uentry.rs
|
||||
index f44979ec..5f9938e2 100755
|
||||
--- a/core/sysmaster/src/unit/entry/uentry.rs
|
||||
+++ b/core/sysmaster/src/unit/entry/uentry.rs
|
||||
@@ -659,12 +659,12 @@ impl Unit {
|
||||
return Err(Error::UnitActionEInval);
|
||||
}
|
||||
if active_state != UnitActiveState::UnitActivating && !self.conditions().conditions_test() {
|
||||
- log::error!("Starting failed the unit condition test failed");
|
||||
- return Err(Error::UnitActionEInval);
|
||||
+ log::info!("The condition check failed, not starting {}.", self.id());
|
||||
+ return Err(Error::UnitActionEComm);
|
||||
}
|
||||
if active_state != UnitActiveState::UnitActivating && !self.conditions().asserts_test() {
|
||||
- log::error!("Starting failed the unit assert test failed");
|
||||
- return Err(Error::UnitActionEInval);
|
||||
+ log::info!("The assert check failed, not starting {}.", self.id());
|
||||
+ return Err(Error::UnitActionEProto);
|
||||
}
|
||||
|
||||
self.sub.start()
|
||||
--
|
||||
2.30.2
|
||||
|
||||
@ -1,144 +0,0 @@
|
||||
From 23e254fb250b7a6e5f777ae10ce6cd50f9fb1e35 Mon Sep 17 00:00:00 2001
|
||||
From: overweight <hexiaowen@huawei.com>
|
||||
Date: Tue, 22 Aug 2023 09:48:05 +0800
|
||||
Subject: [PATCH] typo: optimizing print statements
|
||||
|
||||
---
|
||||
init/src/main.rs | 43 +++++++++++++++++++++++++++----------------
|
||||
1 file changed, 27 insertions(+), 16 deletions(-)
|
||||
|
||||
diff --git a/init/src/main.rs b/init/src/main.rs
|
||||
index f94b8dad..98290085 100644
|
||||
--- a/init/src/main.rs
|
||||
+++ b/init/src/main.rs
|
||||
@@ -11,6 +11,8 @@
|
||||
// See the Mulan PSL v2 for more details.
|
||||
|
||||
//! The init daemon
|
||||
+use core::panic;
|
||||
+use kernlog::KernelLog;
|
||||
use mio::unix::SourceFd;
|
||||
use mio::Events;
|
||||
use mio::Interest;
|
||||
@@ -86,15 +88,21 @@ impl InitConfig {
|
||||
|
||||
pub fn load(path: Option<String>) -> std::io::Result<Self> {
|
||||
let mut config = Self::default();
|
||||
- let default_config_file = INIT_CONFIG.to_string();
|
||||
- let path = path.unwrap_or(default_config_file);
|
||||
+ let path = path.unwrap_or_else(|| INIT_CONFIG.to_string());
|
||||
let file = Path::new(&path);
|
||||
if file.exists() {
|
||||
let mut content = String::new();
|
||||
let file = File::open(file);
|
||||
match file.map(|mut f| f.read_to_string(&mut content)) {
|
||||
Ok(_) => (),
|
||||
- Err(_) => return Ok(config),
|
||||
+ Err(e) => {
|
||||
+ log::info!(
|
||||
+ "failed to read config file {}: {}, use default value",
|
||||
+ path,
|
||||
+ e
|
||||
+ );
|
||||
+ return Ok(config);
|
||||
+ }
|
||||
};
|
||||
|
||||
for (_, line) in content.lines().enumerate() {
|
||||
@@ -138,7 +146,7 @@ impl InitConfig {
|
||||
}
|
||||
}
|
||||
}
|
||||
- log::debug!("{:?}", config);
|
||||
+ log::debug!("loaded configuration: {:?}", config);
|
||||
}
|
||||
|
||||
Ok(config)
|
||||
@@ -196,7 +204,7 @@ impl Runtime {
|
||||
Err(e) => panic!("Invalid value: {:?}", e),
|
||||
};
|
||||
} else {
|
||||
- panic!("Missing value for option --deserialize.");
|
||||
+ panic!("Missing value for option --pid.");
|
||||
}
|
||||
}
|
||||
_ => {
|
||||
@@ -361,7 +369,6 @@ impl Runtime {
|
||||
let (pid, _, _) = match si {
|
||||
Some((pid, code, sig)) => (pid, code, sig),
|
||||
None => {
|
||||
- log::debug!("ignored child signal: {:?}!", wait_status);
|
||||
return;
|
||||
}
|
||||
};
|
||||
@@ -374,8 +381,6 @@ impl Runtime {
|
||||
// pop: recycle the zombie
|
||||
if let Err(e) = waitid(Id::Pid(pid), WaitPidFlag::WEXITED) {
|
||||
log::error!("error when reap the zombie({:?}), ignored: {:?}!", pid, e);
|
||||
- } else {
|
||||
- log::debug!("reap the zombie: {:?}.", pid);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -456,7 +461,6 @@ impl Runtime {
|
||||
// do not refresh the status.
|
||||
self.online = true;
|
||||
self.pid = pid;
|
||||
- log::debug!("keepalive: receive a heartbeat from pid({})!", pid);
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
@@ -623,13 +627,14 @@ impl Drop for Runtime {
|
||||
fn prepare_init() {
|
||||
// version
|
||||
let version = env!("CARGO_PKG_VERSION");
|
||||
- log::info!("sysMaster init version: {}", version);
|
||||
let args: Vec<String> = std::env::args().collect();
|
||||
if args.contains(&String::from("--version")) || args.contains(&String::from("-V")) {
|
||||
- println!("sysMaster init version: {}!", version);
|
||||
+ println!("sysMaster-init version: {}!", version);
|
||||
std::process::exit(0);
|
||||
}
|
||||
|
||||
+ log::info!("sysMaster-init version: {}", version);
|
||||
+
|
||||
// common umask
|
||||
let mode = Mode::from_bits_truncate(0o77);
|
||||
umask(umask(mode) | Mode::from_bits_truncate(0o22));
|
||||
@@ -668,7 +673,7 @@ fn reset_all_signal_handlers() {
|
||||
}
|
||||
|
||||
extern "C" fn crash_handler(_signal: i32) {
|
||||
- log::error!("crash_handler");
|
||||
+ panic!("crash_handler");
|
||||
}
|
||||
|
||||
fn install_crash_handler() {
|
||||
@@ -694,14 +699,20 @@ fn install_crash_handler() {
|
||||
|
||||
fn shutdown_init() {
|
||||
nix::unistd::sync();
|
||||
- log::info!("shutdowning init");
|
||||
+ log::info!("shutdowning...");
|
||||
}
|
||||
|
||||
-fn main() -> std::io::Result<()> {
|
||||
- match kernlog::init() {
|
||||
- Ok(_) => (),
|
||||
+fn set_logger(loglevel: log::LevelFilter) {
|
||||
+ let klog = match KernelLog::with_level(loglevel) {
|
||||
+ Ok(v) => v,
|
||||
Err(e) => panic!("Unsupported when cannot log into /dev/kmsg : {:?}!", e),
|
||||
};
|
||||
+ log::set_boxed_logger(Box::new(klog)).expect("Failed to set logger!");
|
||||
+ log::set_max_level(loglevel);
|
||||
+}
|
||||
+
|
||||
+fn main() -> std::io::Result<()> {
|
||||
+ set_logger(log::LevelFilter::Info);
|
||||
|
||||
prepare_init();
|
||||
|
||||
--
|
||||
2.30.2
|
||||
|
||||
Binary file not shown.
BIN
sysmaster-0.5.1.tar.xz
Normal file
BIN
sysmaster-0.5.1.tar.xz
Normal file
Binary file not shown.
139
sysmaster.spec
139
sysmaster.spec
@ -5,38 +5,42 @@
|
||||
%global sysmaster_install_source target/release
|
||||
%global sysmaster_install_target %{buildroot}/usr/lib/sysmaster
|
||||
%global unit_install_source units
|
||||
%global unit_install_target %{sysmaster_install_target}/system
|
||||
%global conf_install_source config/conf
|
||||
%global devmaster_install_source target/release
|
||||
%global devmaster_install_target %{buildroot}/usr/lib/devmaster
|
||||
%global devmaster_conf_install_source exts/devmaster/config
|
||||
%global devmaster_conf_install_target %{buildroot}/etc/devmaster
|
||||
%global __cargo_common_opts %{?__cargo_common_opts} --all
|
||||
%global _cargo_build /usr/bin/env CARGO_HOME=.cargo RUSTC_BOOTSTRAP=1 %{_bindir}/cargo build %__cargo_common_opts
|
||||
|
||||
Name: sysmaster
|
||||
Version: 0.2.5
|
||||
Release: 4
|
||||
Version: 0.5.1
|
||||
Release: 1
|
||||
Summary: redesign and reimplement process1.
|
||||
|
||||
License: Mulan PSL v2
|
||||
URL: https://gitee.com/openeuler/sysmaster
|
||||
Source0: %{name}-%{version}.tar.gz
|
||||
Source0: %{name}-%{version}.tar.xz
|
||||
|
||||
Patch6001: backport-fix-delete-and-re-add-the-restart-timer-to-make-time.patch
|
||||
Patch6002: backport-fix-log-the-status-message-to-stdout.patch
|
||||
Patch6003: backport-fix-Fixed-parsing-single-quotes-error.patch
|
||||
Patch6004: backport-typo-optimizing-print-statements.patch
|
||||
Patch6005: backport-fix-make-control-command-accept.patch
|
||||
Patch6006: backport-fix-return-the-correct-error-when-condition-assert-f.patch
|
||||
Patch0: backport-fix-getty-generator-delelte-double-quote-in-the-conf.patch
|
||||
|
||||
ExclusiveArch: x86_64 aarch64
|
||||
|
||||
BuildRequires: rust
|
||||
BuildRequires: cargo
|
||||
BuildRequires: rust-packaging
|
||||
BuildRequires: gcc clang util-linux-devel
|
||||
BuildRequires: rust cargo rust-packaging
|
||||
BuildRequires: gcc clang openssl-libs
|
||||
|
||||
%description
|
||||
redesign and reimplement process1.
|
||||
|
||||
Summary: %{summary}
|
||||
|
||||
%package -n devmaster
|
||||
Summary: Infrastructure of device management in userspace.
|
||||
BuildRequires: util-linux-devel kmod-devel
|
||||
|
||||
%description -n devmaster
|
||||
This package provides the infrastructure of device management in userspace.
|
||||
|
||||
%prep
|
||||
%autosetup -p1
|
||||
@ -44,6 +48,16 @@ Summary: %{summary}
|
||||
%cargo_generate_buildrequires
|
||||
|
||||
%build
|
||||
cat << EOF >> ./.cargo/config
|
||||
|
||||
[source.crates-io]
|
||||
replace-with = "vendored-sources"
|
||||
|
||||
[source.vendored-sources]
|
||||
directory = "vendor"
|
||||
EOF
|
||||
|
||||
|
||||
%{_cargo_build} --profile release
|
||||
|
||||
%install
|
||||
@ -52,30 +66,109 @@ Summary: %{summary}
|
||||
install -Dm0750 -t %{buildroot}/usr/bin %{sysmaster_install_source}/sctl
|
||||
install -Dm0750 -t %{sysmaster_install_target} %{sysmaster_install_source}/init
|
||||
install -Dm0750 -t %{sysmaster_install_target} %{sysmaster_install_source}/sysmaster
|
||||
install -Dm0750 -t %{sysmaster_install_target} %{sysmaster_install_source}/fstab
|
||||
install -Dm0750 -t %{sysmaster_install_target} %{sysmaster_install_source}/sysmonitor
|
||||
install -Dm0750 -t %{sysmaster_install_target} %{sysmaster_install_source}/random_seed
|
||||
install -Dm0750 -t %{sysmaster_install_target} %{sysmaster_install_source}/rc-local-generator
|
||||
install -Dm0750 -t %{sysmaster_install_target} %{sysmaster_install_source}/hostname_setup
|
||||
install -Dm0750 -t %{sysmaster_install_target}/system-generators %{sysmaster_install_source}/getty-generator
|
||||
|
||||
install -Dm0640 -t %{sysmaster_install_target}/system %{unit_install_source}/*
|
||||
install -Dm0640 -t %{unit_install_target} %{unit_install_source}/*
|
||||
|
||||
install -Dm0640 -t %{buildroot}/etc/sysmaster %{conf_install_source}/system.conf
|
||||
|
||||
install -Dm0750 -t %{buildroot}/usr/bin %{devmaster_install_source}/devctl
|
||||
install -Dm0640 -t %{devmaster_conf_install_target} %{devmaster_conf_install_source}/config.toml
|
||||
install -Dm0640 -t %{devmaster_conf_install_target}/rules.d %{devmaster_conf_install_source}/rules.d/*
|
||||
install -Dm0640 -t %{devmaster_conf_install_target}/network.d %{devmaster_conf_install_source}/network.d/*
|
||||
|
||||
mkdir -p %{buildroot}/etc/sysmaster/system/multi-user.target.wants
|
||||
mkdir -p %{buildroot}/etc/sysmaster/system/sysinit.target.wants
|
||||
mkdir -p %{devmaster_install_target}
|
||||
|
||||
ln -s /usr/bin/devctl %{devmaster_install_target}/devmaster
|
||||
for unit in NetworkManager.service dbus.service dbus.socket fstab.service hostname-setup.service udevd-control.socket udevd-kernel.socket; do
|
||||
install -Dm0640 -t %{unit_install_target} tools/run_with_vm/$unit
|
||||
# enble service for booting
|
||||
if [[ "$unit" == *".service" ]]; then
|
||||
ln -s /usr/lib/sysmaster/system/$unit %{buildroot}/etc/sysmaster/system/multi-user.target.wants/$unit
|
||||
fi
|
||||
done
|
||||
|
||||
for unit in udevd.service udev-trigger.service; do
|
||||
install -Dm0640 -t %{unit_install_target} tools/run_with_vm/$unit
|
||||
if [[ "$unit" == *".service" ]]; then
|
||||
ln -s /usr/lib/sysmaster/system/$unit %{buildroot}/etc/sysmaster/system/sysinit.target.wants/$unit
|
||||
fi
|
||||
done
|
||||
|
||||
install -Dm0640 -t %{unit_install_target} tools/run_with_devmaster/service/*.service
|
||||
install -Dm0640 -t %{unit_install_target} tools/run_with_vm/getty.target
|
||||
ln -s /usr/lib/sysmaster/system//getty.target %{buildroot}/etc/sysmaster/system/multi-user.target.wants/getty.target
|
||||
install -Dm0640 -t %{unit_install_target} tools/run_with_vm/getty@.service
|
||||
install -Dm0640 -t %{unit_install_target} tools/run_with_vm/serial-getty@.service
|
||||
|
||||
# Install compatible rules for lvm
|
||||
install -Dm444 -t %{buildroot}/usr/lib/udev/rules.d rules/99-sysmaster.rules
|
||||
|
||||
# Install configurations under /etc.
|
||||
install -Dm0640 -t %{devmaster_conf_install_target} %{devmaster_conf_install_source}/config.toml
|
||||
sed -i 's/\"\/lib\/devmaster\/rules.d\"/&, \"\/etc\/udev\/rules.d\", \"\/run\/udev\/rules.d\", \"\/lib\/udev\/rules.d\"/' %{devmaster_conf_install_target}/config.toml
|
||||
|
||||
# enable sshd service by default
|
||||
ln -s /usr/lib/sysmaster/system/sshd.service %{buildroot}/etc/sysmaster/system/multi-user.target.wants/sshd.service
|
||||
|
||||
%files
|
||||
%attr(0550,-,-) /usr/bin/sctl
|
||||
%dir %attr(0550,-,-) /usr/lib/sysmaster
|
||||
%dir %attr(0750,-,-) /usr/lib/sysmaster/system
|
||||
/usr/lib/sysmaster/system/basic.target
|
||||
/usr/lib/sysmaster/system/*
|
||||
%attr(0550,-,-) /usr/lib/sysmaster/init
|
||||
/usr/lib/sysmaster/system/multi-user.target
|
||||
/usr/lib/sysmaster/system/shutdown.target
|
||||
/usr/lib/sysmaster/system/sshd-keygen.target
|
||||
/usr/lib/sysmaster/system/sshd-keygen@ecdsa.service
|
||||
/usr/lib/sysmaster/system/sshd-keygen@ed25519.service
|
||||
/usr/lib/sysmaster/system/sshd-keygen@rsa.service
|
||||
/usr/lib/sysmaster/system/sshd.service
|
||||
/usr/lib/sysmaster/system/sysinit.target
|
||||
%attr(0550,-,-) /usr/lib/sysmaster/fstab
|
||||
%attr(0550,-,-) /usr/lib/sysmaster/sysmonitor
|
||||
%attr(0550,-,-) /usr/lib/sysmaster/random_seed
|
||||
%attr(0550,-,-) /usr/lib/sysmaster/rc-local-generator
|
||||
%attr(0550,-,-) /usr/lib/sysmaster/system-generators/getty-generator
|
||||
%attr(0550,-,-) /usr/lib/sysmaster/hostname_setup
|
||||
%attr(0550,-,-) /usr/lib/sysmaster/sysmaster
|
||||
%dir %attr(0750,-,-) /etc/sysmaster
|
||||
%dir %attr(0750,-,-) /etc/sysmaster/system
|
||||
%dir %attr(0750,-,-) /etc/sysmaster/system/multi-user.target.wants
|
||||
%dir %attr(0750,-,-) /etc/sysmaster/system/sysinit.target.wants
|
||||
/etc/sysmaster/system/multi-user.target.wants/*
|
||||
/etc/sysmaster/system/sysinit.target.wants/*
|
||||
/etc/sysmaster/system.conf
|
||||
/usr/lib/udev/rules.d/99-sysmaster.rules
|
||||
%exclude /usr/lib/sysmaster/system/devctl-trigger.service
|
||||
%exclude /usr/lib/sysmaster/system/devmaster-simu-udev.service
|
||||
%exclude /usr/lib/sysmaster/system/devmaster.service
|
||||
|
||||
%files -n devmaster
|
||||
%dir %attr(0550,-,-) /usr/lib/devmaster
|
||||
%dir %attr(0750,-,-) /etc/devmaster
|
||||
/etc/devmaster/config.toml
|
||||
%dir %attr(0750,-,-) /etc/devmaster/rules.d
|
||||
/etc/devmaster/rules.d/99-default.rules
|
||||
%dir %attr(0750,-,-) /etc/devmaster/network.d
|
||||
/etc/devmaster/network.d/99-default.link
|
||||
%attr(0550,-,-) /usr/bin/devctl
|
||||
%attr(0550,-,-) /usr/lib/devmaster/devmaster
|
||||
/usr/lib/sysmaster/system/devctl-trigger.service
|
||||
/usr/lib/sysmaster/system/devmaster-simu-udev.service
|
||||
/usr/lib/sysmaster/system/devmaster.service
|
||||
|
||||
%post -n devmaster
|
||||
ln -sf /usr/lib/sysmaster/system/devmaster.service /etc/sysmaster/system/sysinit.target.wants/udevd.service
|
||||
ln -sf /usr/lib/sysmaster/system/devctl-trigger.service /etc/sysmaster/system/multi-user.target.wants/udev-trigger.service
|
||||
|
||||
%postun -n devmaster
|
||||
test -f /usr/lib/sysmaster/system/udevd.service && ln -sf /usr/lib/sysmaster/system/udevd.service /etc/sysmaster/system/sysinit.target.wants/udevd.service
|
||||
test -f /usr/lib/sysmaster/system/udev-trigger.service && ln -sf /usr/lib/sysmaster/system/udev-trigger.service /etc/sysmaster/system/multi-user.target.wants/udev-trigger.service
|
||||
|
||||
%changelog
|
||||
* Mon Oct 30 2023 zhangyao<zhangyao108@huawei.com> - 0.5.1-1
|
||||
- upgrade version to 0.5.1
|
||||
|
||||
* Fri Sep 01 2023 licunlong<licunlong1@huawei.com> - 0.2.5-4
|
||||
- sync patchs from upstream
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user