!16 [sync] PR-14: upgrade to 0.2.3
From: @openeuler-sync-bot Reviewed-by: @xuxiaozhou1, @jiayi0118 Signed-off-by: @jiayi0118
This commit is contained in:
commit
995ae7bcc5
@ -1,29 +0,0 @@
|
|||||||
From 4683b40fd9a8ed9ae747b7b7add1de963cc80c4e Mon Sep 17 00:00:00 2001
|
|
||||||
From: zhangyao <zhangyao108@huawei.com>
|
|
||||||
Date: Tue, 6 Sep 2022 09:21:15 +0800
|
|
||||||
Subject: [PATCH 2/4] fix dropin: get real file name
|
|
||||||
|
|
||||||
---
|
|
||||||
process1/src/manager/unit/uload_util/unit_file.rs | 6 +++++-
|
|
||||||
1 file changed, 5 insertions(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/process1/src/manager/unit/uload_util/unit_file.rs b/process1/src/manager/unit/uload_util/unit_file.rs
|
|
||||||
index 9fae099..928ff20 100755
|
|
||||||
--- a/process1/src/manager/unit/uload_util/unit_file.rs
|
|
||||||
+++ b/process1/src/manager/unit/uload_util/unit_file.rs
|
|
||||||
@@ -139,7 +139,11 @@ impl UnitFileData {
|
|
||||||
for entry in dir.read_dir().unwrap() {
|
|
||||||
let dropin = entry.unwrap().path();
|
|
||||||
if dropin.is_symlink() {
|
|
||||||
- pathbuf_dropin.push(dropin);
|
|
||||||
+ if let Ok(abs_path) = dropin.canonicalize() {
|
|
||||||
+ let mut file_name = PathBuf::new();
|
|
||||||
+ file_name.push(abs_path.file_name().unwrap());
|
|
||||||
+ pathbuf_dropin.push(file_name);
|
|
||||||
+ }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
--
|
|
||||||
2.30.2
|
|
||||||
|
|
||||||
@ -1,276 +0,0 @@
|
|||||||
From 8974d82867d2ebc5fef178514eae7422b8a5fa47 Mon Sep 17 00:00:00 2001
|
|
||||||
From: l00346806 <lixiaoguang2@huawei.com>
|
|
||||||
Date: Thu, 8 Sep 2022 22:07:27 +0800
|
|
||||||
Subject: [PATCH 4/4] fix start and stop repeatly, if the unit is already in
|
|
||||||
process, just return before do action.
|
|
||||||
|
|
||||||
Signed-off-by: Xiaoguang Li <lixiaoguang2@huawei.com>
|
|
||||||
---
|
|
||||||
components/service/src/service_mng.rs | 40 ++++++++++++++-----
|
|
||||||
components/service/src/service_pid.rs | 14 +++++++
|
|
||||||
components/service/src/service_unit.rs | 6 ++-
|
|
||||||
components/socket/src/socket_mng.rs | 12 +++---
|
|
||||||
components/socket/src/socket_unit.rs | 15 ++++++-
|
|
||||||
.../src/manager/unit/unit_entry/u_entry.rs | 10 +++++
|
|
||||||
6 files changed, 77 insertions(+), 20 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/components/service/src/service_mng.rs b/components/service/src/service_mng.rs
|
|
||||||
index b8ac9f2..f11c23c 100755
|
|
||||||
--- a/components/service/src/service_mng.rs
|
|
||||||
+++ b/components/service/src/service_mng.rs
|
|
||||||
@@ -115,7 +115,7 @@ impl ServiceMng {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
- pub(super) fn start_check(&self) -> Result<(), UnitActionError> {
|
|
||||||
+ pub(super) fn start_check(&self) -> Result<bool, UnitActionError> {
|
|
||||||
if IN_SET!(
|
|
||||||
self.state(),
|
|
||||||
ServiceState::Stop,
|
|
||||||
@@ -131,7 +131,18 @@ impl ServiceMng {
|
|
||||||
return Err(UnitActionError::UnitActionEAgain);
|
|
||||||
}
|
|
||||||
|
|
||||||
- Ok(())
|
|
||||||
+ // service is in starting
|
|
||||||
+ if IN_SET!(
|
|
||||||
+ self.state(),
|
|
||||||
+ ServiceState::Condition,
|
|
||||||
+ ServiceState::StartPre,
|
|
||||||
+ ServiceState::Start,
|
|
||||||
+ ServiceState::StartPost
|
|
||||||
+ ) {
|
|
||||||
+ return Ok(true);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ Ok(false)
|
|
||||||
}
|
|
||||||
|
|
||||||
pub(super) fn start_action(&self) {
|
|
||||||
@@ -140,15 +151,16 @@ impl ServiceMng {
|
|
||||||
}
|
|
||||||
|
|
||||||
pub(super) fn stop_check(&self) -> Result<(), UnitActionError> {
|
|
||||||
- let stop_state = vec![
|
|
||||||
+ if IN_SET!(
|
|
||||||
+ self.state(),
|
|
||||||
ServiceState::Stop,
|
|
||||||
ServiceState::StopSigterm,
|
|
||||||
ServiceState::StopSigkill,
|
|
||||||
ServiceState::StopPost,
|
|
||||||
- ];
|
|
||||||
-
|
|
||||||
- if stop_state.contains(&self.state()) {
|
|
||||||
- return Err(UnitActionError::UnitActionEAlready);
|
|
||||||
+ ServiceState::FinalSigterm,
|
|
||||||
+ ServiceState::FinalSigkill
|
|
||||||
+ ) {
|
|
||||||
+ return Ok(());
|
|
||||||
}
|
|
||||||
|
|
||||||
Ok(())
|
|
||||||
@@ -306,7 +318,11 @@ impl ServiceMng {
|
|
||||||
if self.result() != ServiceResult::Success {
|
|
||||||
self.enter_signal(ServiceState::StopSigterm, sr);
|
|
||||||
} else if self.service_alive() {
|
|
||||||
- self.set_state(ServiceState::Runing);
|
|
||||||
+ if self.rd.notify_state() == NotifyState::Stoping {
|
|
||||||
+ self.enter_stop_by_notify();
|
|
||||||
+ } else {
|
|
||||||
+ self.set_state(ServiceState::Runing);
|
|
||||||
+ }
|
|
||||||
} else if let Some(remain_after_exit) =
|
|
||||||
self.config.config_data().borrow().Service.RemainAfterExit
|
|
||||||
{
|
|
||||||
@@ -514,8 +530,11 @@ impl ServiceMng {
|
|
||||||
}
|
|
||||||
|
|
||||||
fn service_alive(&self) -> bool {
|
|
||||||
- // todo!()
|
|
||||||
- true
|
|
||||||
+ if let Ok(v) = self.pid.main_alive() {
|
|
||||||
+ return v;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ self.cgroup_good()
|
|
||||||
}
|
|
||||||
|
|
||||||
fn run_next_control(&self) {
|
|
||||||
@@ -660,7 +679,6 @@ impl ServiceMng {
|
|
||||||
msg: "main pid is not alive",
|
|
||||||
});
|
|
||||||
}
|
|
||||||
-
|
|
||||||
if self
|
|
||||||
.comm
|
|
||||||
.um()
|
|
||||||
diff --git a/components/service/src/service_pid.rs b/components/service/src/service_pid.rs
|
|
||||||
index b976c5e..b2841ef 100755
|
|
||||||
--- a/components/service/src/service_pid.rs
|
|
||||||
+++ b/components/service/src/service_pid.rs
|
|
||||||
@@ -1,7 +1,9 @@
|
|
||||||
use super::service_comm::ServiceComm;
|
|
||||||
use nix::unistd::Pid;
|
|
||||||
+use process1::manager::UnitActionError;
|
|
||||||
use std::cell::RefCell;
|
|
||||||
use std::rc::Rc;
|
|
||||||
+use utils::process_util;
|
|
||||||
|
|
||||||
pub(super) struct ServicePid {
|
|
||||||
comm: Rc<ServiceComm>,
|
|
||||||
@@ -59,6 +61,10 @@ impl ServicePid {
|
|
||||||
pub(super) fn control(&self) -> Option<Pid> {
|
|
||||||
self.data.borrow().control()
|
|
||||||
}
|
|
||||||
+
|
|
||||||
+ pub(super) fn main_alive(&self) -> Result<bool, UnitActionError> {
|
|
||||||
+ self.data.borrow().main_alive()
|
|
||||||
+ }
|
|
||||||
}
|
|
||||||
|
|
||||||
struct ServicePidData {
|
|
||||||
@@ -98,4 +104,12 @@ impl ServicePidData {
|
|
||||||
pub(self) fn control(&self) -> Option<Pid> {
|
|
||||||
self.control.as_ref().cloned()
|
|
||||||
}
|
|
||||||
+
|
|
||||||
+ pub(self) fn main_alive(&self) -> Result<bool, UnitActionError> {
|
|
||||||
+ if self.main.is_none() {
|
|
||||||
+ return Err(UnitActionError::UnitActionEAgain);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ Ok(process_util::alive(self.main.unwrap()))
|
|
||||||
+ }
|
|
||||||
}
|
|
||||||
diff --git a/components/service/src/service_unit.rs b/components/service/src/service_unit.rs
|
|
||||||
index d9826f8..9ab1679 100755
|
|
||||||
--- a/components/service/src/service_unit.rs
|
|
||||||
+++ b/components/service/src/service_unit.rs
|
|
||||||
@@ -55,7 +55,11 @@ impl UnitObj for ServiceUnit {
|
|
||||||
|
|
||||||
fn start(&self) -> Result<(), UnitActionError> {
|
|
||||||
log::debug!("begin to start the service unit");
|
|
||||||
- self.mng.start_check()?;
|
|
||||||
+ let started = self.mng.start_check()?;
|
|
||||||
+ if started {
|
|
||||||
+ log::debug!("service already in starting, just return immediately");
|
|
||||||
+ return Ok(());
|
|
||||||
+ }
|
|
||||||
|
|
||||||
self.monitor.start_action();
|
|
||||||
self.mng.start_action();
|
|
||||||
diff --git a/components/socket/src/socket_mng.rs b/components/socket/src/socket_mng.rs
|
|
||||||
index 9cca6f3..596fc12 100644
|
|
||||||
--- a/components/socket/src/socket_mng.rs
|
|
||||||
+++ b/components/socket/src/socket_mng.rs
|
|
||||||
@@ -150,7 +150,7 @@ impl SocketMng {
|
|
||||||
.map_or(None, |v| Some(v.to_string()))
|
|
||||||
}
|
|
||||||
|
|
||||||
- pub(super) fn start_check(&self) -> Result<(), UnitActionError> {
|
|
||||||
+ pub(super) fn start_check(&self) -> Result<bool, UnitActionError> {
|
|
||||||
if IN_SET!(
|
|
||||||
self.state(),
|
|
||||||
SocketState::StopPre,
|
|
||||||
@@ -170,7 +170,7 @@ impl SocketMng {
|
|
||||||
SocketState::StartChown,
|
|
||||||
SocketState::StartPost
|
|
||||||
) {
|
|
||||||
- return Ok(());
|
|
||||||
+ return Ok(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
self.unit_ref_target()
|
|
||||||
@@ -179,7 +179,7 @@ impl SocketMng {
|
|
||||||
Err(e) => Err(e),
|
|
||||||
})?;
|
|
||||||
|
|
||||||
- Ok(())
|
|
||||||
+ Ok(false)
|
|
||||||
}
|
|
||||||
|
|
||||||
pub(super) fn start_action(&self) {
|
|
||||||
@@ -190,7 +190,7 @@ impl SocketMng {
|
|
||||||
self.enter_stop_pre(SocketResult::Success)
|
|
||||||
}
|
|
||||||
|
|
||||||
- pub(super) fn stop_check(&self) -> Result<(), UnitActionError> {
|
|
||||||
+ pub(super) fn stop_check(&self) -> Result<bool, UnitActionError> {
|
|
||||||
if IN_SET!(
|
|
||||||
self.state(),
|
|
||||||
SocketState::StopPre,
|
|
||||||
@@ -200,7 +200,7 @@ impl SocketMng {
|
|
||||||
SocketState::FinalSigterm,
|
|
||||||
SocketState::FinalSigkill
|
|
||||||
) {
|
|
||||||
- return Ok(());
|
|
||||||
+ return Ok(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
if IN_SET!(
|
|
||||||
@@ -213,7 +213,7 @@ impl SocketMng {
|
|
||||||
return Err(UnitActionError::UnitActionEAgain);
|
|
||||||
}
|
|
||||||
|
|
||||||
- Ok(())
|
|
||||||
+ Ok(false)
|
|
||||||
}
|
|
||||||
|
|
||||||
pub(super) fn current_active_state(&self) -> UnitActiveState {
|
|
||||||
diff --git a/components/socket/src/socket_unit.rs b/components/socket/src/socket_unit.rs
|
|
||||||
index 0e25ed0..2db7154 100644
|
|
||||||
--- a/components/socket/src/socket_unit.rs
|
|
||||||
+++ b/components/socket/src/socket_unit.rs
|
|
||||||
@@ -53,7 +53,13 @@ impl UnitObj for SocketUnit {
|
|
||||||
// the function entrance to start the unit
|
|
||||||
fn start(&self) -> Result<(), UnitActionError> {
|
|
||||||
self.ports.attach(self.mng.clone());
|
|
||||||
- self.mng.start_check()?;
|
|
||||||
+
|
|
||||||
+ let starting = self.mng.start_check()?;
|
|
||||||
+ if starting {
|
|
||||||
+ log::debug!("socket already in start");
|
|
||||||
+ return Ok(());
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
self.mng.start_action();
|
|
||||||
|
|
||||||
Ok(())
|
|
||||||
@@ -64,7 +70,12 @@ impl UnitObj for SocketUnit {
|
|
||||||
}
|
|
||||||
|
|
||||||
fn stop(&self) -> Result<(), UnitActionError> {
|
|
||||||
- self.mng.stop_check()?;
|
|
||||||
+ let stoping = self.mng.stop_check()?;
|
|
||||||
+ if stoping {
|
|
||||||
+ log::debug!("socket already in stop, return immediretly");
|
|
||||||
+ return Ok(());
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
self.mng.stop_action();
|
|
||||||
|
|
||||||
Ok(())
|
|
||||||
diff --git a/process1/src/manager/unit/unit_entry/u_entry.rs b/process1/src/manager/unit/unit_entry/u_entry.rs
|
|
||||||
index 904ade1..9653dd8 100644
|
|
||||||
--- a/process1/src/manager/unit/unit_entry/u_entry.rs
|
|
||||||
+++ b/process1/src/manager/unit/unit_entry/u_entry.rs
|
|
||||||
@@ -458,6 +458,16 @@ impl Unit {
|
|
||||||
}
|
|
||||||
|
|
||||||
pub(super) fn stop(&self) -> Result<(), UnitActionError> {
|
|
||||||
+ let active_state = self.current_active_state();
|
|
||||||
+ let inactive_or_failed = match active_state {
|
|
||||||
+ UnitActiveState::UnitInActive | UnitActiveState::UnitFailed => true,
|
|
||||||
+ _ => false,
|
|
||||||
+ };
|
|
||||||
+
|
|
||||||
+ if inactive_or_failed {
|
|
||||||
+ return Err(UnitActionError::UnitActionEAlready);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
self.sub.stop()
|
|
||||||
}
|
|
||||||
|
|
||||||
--
|
|
||||||
2.30.2
|
|
||||||
|
|
||||||
@ -1,95 +0,0 @@
|
|||||||
From c696bc4257355f2e06275900fd1e1c6d4756f9ca Mon Sep 17 00:00:00 2001
|
|
||||||
From: Xiaoguang Li <lixiaoguang2@huawei.com>
|
|
||||||
Date: Thu, 25 Aug 2022 20:45:55 +0800
|
|
||||||
Subject: [PATCH 3/4] if Type item is not configured, set it to default Simple
|
|
||||||
|
|
||||||
Signed-off-by: Xiaoguang Li <lixiaoguang2@huawei.com>
|
|
||||||
---
|
|
||||||
components/service/src/service_base.rs | 20 +++++++++++++++++++-
|
|
||||||
components/service/src/service_config.rs | 10 ++++------
|
|
||||||
components/service/src/service_mng.rs | 6 +-----
|
|
||||||
3 files changed, 24 insertions(+), 12 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/components/service/src/service_base.rs b/components/service/src/service_base.rs
|
|
||||||
index 529334c..8f79ca6 100755
|
|
||||||
--- a/components/service/src/service_base.rs
|
|
||||||
+++ b/components/service/src/service_base.rs
|
|
||||||
@@ -1,4 +1,5 @@
|
|
||||||
-use serde::{Deserialize, Serialize};
|
|
||||||
+use process1::manager::DeserializeWith;
|
|
||||||
+use serde::{Deserialize, Deserializer, Serialize};
|
|
||||||
|
|
||||||
#[derive(PartialEq, EnumString, Display, Debug)]
|
|
||||||
pub(super) enum ServiceTimeoutFailureMode {
|
|
||||||
@@ -73,6 +74,23 @@ impl Default for ServiceType {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
+impl DeserializeWith for ServiceType {
|
|
||||||
+ fn deserialize_with<'de, D>(de: D) -> Result<Self, D::Error>
|
|
||||||
+ where
|
|
||||||
+ D: Deserializer<'de>,
|
|
||||||
+ {
|
|
||||||
+ let s = String::deserialize(de)?;
|
|
||||||
+
|
|
||||||
+ match s.as_ref() {
|
|
||||||
+ "simple" => Ok(ServiceType::Simple),
|
|
||||||
+ "forking" => Ok(ServiceType::Forking),
|
|
||||||
+ "oneshot" => Ok(ServiceType::Oneshot),
|
|
||||||
+ "notify" => Ok(ServiceType::Notify),
|
|
||||||
+ &_ => Ok(ServiceType::Simple),
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
#[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Copy, Clone)]
|
|
||||||
pub(super) enum ServiceCommand {
|
|
||||||
Condition,
|
|
||||||
diff --git a/components/service/src/service_config.rs b/components/service/src/service_config.rs
|
|
||||||
index 9932fe8..0c740e6 100755
|
|
||||||
--- a/components/service/src/service_config.rs
|
|
||||||
+++ b/components/service/src/service_config.rs
|
|
||||||
@@ -44,11 +44,7 @@ impl ServiceConfig {
|
|
||||||
}
|
|
||||||
|
|
||||||
pub(super) fn service_type(&self) -> ServiceType {
|
|
||||||
- self.data
|
|
||||||
- .borrow()
|
|
||||||
- .Service
|
|
||||||
- .Type
|
|
||||||
- .map_or(ServiceType::Simple, |e| e)
|
|
||||||
+ self.data.borrow().Service.Type
|
|
||||||
}
|
|
||||||
|
|
||||||
pub(super) fn set_notify_access(&self, v: NotifyAccess) {
|
|
||||||
@@ -84,7 +80,9 @@ impl ServiceConfigData {
|
|
||||||
|
|
||||||
#[derive(Config, Default, Debug)]
|
|
||||||
pub(super) struct SectionService {
|
|
||||||
- pub Type: Option<ServiceType>,
|
|
||||||
+ #[config(deserialize_with = ServiceType::deserialize_with)]
|
|
||||||
+ #[config(default = "simple")]
|
|
||||||
+ pub Type: ServiceType,
|
|
||||||
#[config(deserialize_with = Vec::<ExecCommand>::deserialize_with)]
|
|
||||||
pub ExecStart: Option<Vec<ExecCommand>>,
|
|
||||||
#[config(deserialize_with = Vec::<ExecCommand>::deserialize_with)]
|
|
||||||
diff --git a/components/service/src/service_mng.rs b/components/service/src/service_mng.rs
|
|
||||||
index 0a42cfa..b8ac9f2 100755
|
|
||||||
--- a/components/service/src/service_mng.rs
|
|
||||||
+++ b/components/service/src/service_mng.rs
|
|
||||||
@@ -176,11 +176,7 @@ impl ServiceMng {
|
|
||||||
}
|
|
||||||
|
|
||||||
pub(super) fn current_active_state(&self) -> UnitActiveState {
|
|
||||||
- if let Some(service_type) = self.config.config_data().borrow().Service.Type {
|
|
||||||
- service_state_to_unit_state(service_type, self.state())
|
|
||||||
- } else {
|
|
||||||
- UnitActiveState::UnitFailed
|
|
||||||
- }
|
|
||||||
+ service_state_to_unit_state(self.config.service_type(), self.state())
|
|
||||||
}
|
|
||||||
|
|
||||||
fn enter_contion(&self) {
|
|
||||||
--
|
|
||||||
2.30.2
|
|
||||||
|
|
||||||
@ -1,42 +0,0 @@
|
|||||||
From fcc12481bd9240489cd21c71df50fb1dfdbe9ad5 Mon Sep 17 00:00:00 2001
|
|
||||||
From: overweight <hexiaowen@huawei.com>
|
|
||||||
Date: Mon, 19 Sep 2022 21:48:31 +0800
|
|
||||||
Subject: [PATCH] rename to sysmaster
|
|
||||||
|
|
||||||
---
|
|
||||||
Cargo.toml | 11 +++++------
|
|
||||||
src/{process1 => sysmaster}/main.rs | 0
|
|
||||||
2 files changed, 5 insertions(+), 6 deletions(-)
|
|
||||||
rename src/{process1 => sysmaster}/main.rs (100%)
|
|
||||||
|
|
||||||
diff --git a/Cargo.toml b/Cargo.toml
|
|
||||||
index c1d3f70..804feee 100644
|
|
||||||
--- a/Cargo.toml
|
|
||||||
+++ b/Cargo.toml
|
|
||||||
@@ -1,14 +1,13 @@
|
|
||||||
[package]
|
|
||||||
-name = "Process1"
|
|
||||||
-version = "0.1.0"
|
|
||||||
-authors = ["overweight <hexiaowen@huawei.com>"]
|
|
||||||
+name = "sysmaster"
|
|
||||||
+version = "0.2.2"
|
|
||||||
+authors = ["sysmaster"]
|
|
||||||
edition = "2018"
|
|
||||||
-default-run = "process1"
|
|
||||||
|
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
|
||||||
[[bin]]
|
|
||||||
-name = "process1"
|
|
||||||
-path = "src/process1/main.rs"
|
|
||||||
+name = "sysmaster"
|
|
||||||
+path = "src/sysmaster/main.rs"
|
|
||||||
|
|
||||||
[[bin]]
|
|
||||||
name = "pctrl"
|
|
||||||
diff --git a/src/process1/main.rs b/src/sysmaster/main.rs
|
|
||||||
similarity index 100%
|
|
||||||
rename from src/process1/main.rs
|
|
||||||
rename to src/sysmaster/main.rs
|
|
||||||
--
|
|
||||||
2.33.0
|
|
||||||
|
|
||||||
@ -1,30 +0,0 @@
|
|||||||
From cbe3cc5daf87c605548d46800fd6c719d8582f95 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Xiaoguang Li <lixiaoguang2@huawei.com>
|
|
||||||
Date: Mon, 5 Sep 2022 23:54:03 +0800
|
|
||||||
Subject: [PATCH 1/4] replaced argv0 with the absolute path
|
|
||||||
|
|
||||||
---
|
|
||||||
process1/src/manager/unit/execute/exec_spawn.rs | 6 +-----
|
|
||||||
1 file changed, 1 insertion(+), 5 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/process1/src/manager/unit/execute/exec_spawn.rs b/process1/src/manager/unit/execute/exec_spawn.rs
|
|
||||||
index 303e363..d41af93 100755
|
|
||||||
--- a/process1/src/manager/unit/execute/exec_spawn.rs
|
|
||||||
+++ b/process1/src/manager/unit/execute/exec_spawn.rs
|
|
||||||
@@ -111,12 +111,8 @@ fn build_run_args(
|
|
||||||
cmdline: &ExecCommand,
|
|
||||||
env: &ExecParameters,
|
|
||||||
) -> (std::ffi::CString, Vec<std::ffi::CString>) {
|
|
||||||
- // let command = cmdline.borrow();
|
|
||||||
let cmd = std::ffi::CString::new(cmdline.path().clone()).unwrap();
|
|
||||||
-
|
|
||||||
- let exec_name = std::path::PathBuf::from(cmdline.path());
|
|
||||||
- let exec_name = exec_name.file_name().unwrap().to_str().unwrap();
|
|
||||||
- let exec_name = std::ffi::CString::new::<Vec<u8>>(exec_name.bytes().collect()).unwrap();
|
|
||||||
+ let exec_name = std::ffi::CString::new(cmdline.path().clone()).unwrap();
|
|
||||||
|
|
||||||
let mut args = Vec::new();
|
|
||||||
args.push(exec_name);
|
|
||||||
--
|
|
||||||
2.30.2
|
|
||||||
|
|
||||||
Binary file not shown.
@ -4,39 +4,32 @@
|
|||||||
%global _debuginfo_subpackages 1
|
%global _debuginfo_subpackages 1
|
||||||
%define _unpackaged_files_terminate_build 0
|
%define _unpackaged_files_terminate_build 0
|
||||||
%global sysmaster_install_source target/release
|
%global sysmaster_install_source target/release
|
||||||
%global sysmaster_install_target %{buildroot}/usr/lib/process1
|
%global sysmaster_install_target %{buildroot}/usr/lib/sysmaster
|
||||||
|
%global unit_install_source units
|
||||||
|
%global conf_install_source config/conf
|
||||||
%global __cargo_common_opts %{?__cargo_common_opts} --all
|
%global __cargo_common_opts %{?__cargo_common_opts} --all
|
||||||
|
|
||||||
Name: sysmaster
|
Name: sysmaster
|
||||||
Version: 0.2.1
|
Version: 0.2.3
|
||||||
Release: 2
|
Release: 1
|
||||||
Summary: redesign and reimplement process1.
|
Summary: redesign and reimplement process1.
|
||||||
|
|
||||||
License: Mulan PSL v2
|
License: Mulan PSL v2
|
||||||
URL: https://gitee.com/openeuler/sysmaster
|
URL: https://gitee.com/openeuler/sysmaster
|
||||||
Source0: %{name}-%{version}.tar.gz
|
Source0: %{name}-%{version}.tar.gz
|
||||||
|
|
||||||
Patch0001: backport-replaced-argv0-with-the-absolute-path.patch
|
|
||||||
Patch0002: backport-fix-dropin-get-real-file-name.patch
|
|
||||||
Patch0003: backport-if-Type-item-is-not-configured-set-it-to-default-Sim.patch
|
|
||||||
Patch0004: backport-fix-start-and-stop-repeatly-if-the-unit-is-already-i.patch
|
|
||||||
Patch0005: backport-rename-to-sysmaster.patch
|
|
||||||
|
|
||||||
ExclusiveArch: x86_64 aarch64
|
ExclusiveArch: x86_64 aarch64
|
||||||
|
|
||||||
BuildRequires: rust
|
BuildRequires: rust
|
||||||
BuildRequires: cargo
|
BuildRequires: cargo
|
||||||
BuildRequires: rust-packaging
|
BuildRequires: rust-packaging
|
||||||
BuildRequires: gcc
|
BuildRequires: gcc clang util-linux-devel
|
||||||
|
|
||||||
%description
|
%description
|
||||||
redesign and reimplement process1.
|
redesign and reimplement process1.
|
||||||
|
|
||||||
Summary: %{summary}
|
Summary: %{summary}
|
||||||
|
|
||||||
%files
|
|
||||||
/usr/bin/pctrl
|
|
||||||
/usr/lib/process1/*
|
|
||||||
|
|
||||||
%prep
|
%prep
|
||||||
%autosetup -p1
|
%autosetup -p1
|
||||||
@ -46,35 +39,41 @@ Summary: %{summary}
|
|||||||
%cargo_generate_buildrequires
|
%cargo_generate_buildrequires
|
||||||
|
|
||||||
%build
|
%build
|
||||||
|
|
||||||
sed -i '/\[source.crates-io\]/{n;d}' ./.cargo/config
|
sed -i '/\[source.crates-io\]/{n;d}' ./.cargo/config
|
||||||
sed -i '/\[source.local-registry\]/{n;d}' ./.cargo/config
|
sed -i '/\[source.local-registry\]/{n;d}' ./.cargo/config
|
||||||
sed -i '/\[source.local-registry\]/a directory = "vendor"' ./.cargo/config
|
sed -i '/\[source.local-registry\]/a directory = "vendor"' ./.cargo/config
|
||||||
%ifarch aarch64
|
|
||||||
sed -i 's/rustflags = \[/rustflags = \["-Clink-arg=-lgcc", /g' ./.cargo/config
|
|
||||||
%endif
|
|
||||||
|
|
||||||
%cargo_build -a
|
%cargo_build
|
||||||
|
|
||||||
%install
|
%install
|
||||||
install -Dm0755 -t %{buildroot}/usr/bin %{sysmaster_install_source}/pctrl
|
install -Dm0550 -t %{buildroot}/usr/bin %{sysmaster_install_source}/sctl
|
||||||
install -Dm0755 -t %{sysmaster_install_target} %{sysmaster_install_source}/init
|
install -Dm0550 -t %{sysmaster_install_target} %{sysmaster_install_source}/init
|
||||||
install -Dm0755 -t %{sysmaster_install_target} %{sysmaster_install_source}/sysmaster
|
install -Dm0550 -t %{sysmaster_install_target} %{sysmaster_install_source}/sysmaster
|
||||||
install -Dm0755 -t %{sysmaster_install_target} %{sysmaster_install_source}/fstab
|
install -Dm0550 -t %{sysmaster_install_target} %{sysmaster_install_source}/fstab
|
||||||
install -Dm0755 -t %{sysmaster_install_target} %{sysmaster_install_source}/sysmonitor
|
install -Dm0550 -t %{sysmaster_install_target} %{sysmaster_install_source}/sysmonitor
|
||||||
install -Dm0755 -t %{sysmaster_install_target} %{sysmaster_install_source}/random_seed
|
install -Dm0550 -t %{sysmaster_install_target} %{sysmaster_install_source}/random_seed
|
||||||
install -Dm0755 -t %{sysmaster_install_target} %{sysmaster_install_source}/rc-local-generator
|
install -Dm0550 -t %{sysmaster_install_target} %{sysmaster_install_source}/rc-local-generator
|
||||||
|
|
||||||
strip %{sysmaster_install_source}/lib*.so
|
#install -Dm0640 -t %{sysmaster_install_target} %{unit_install_source}/basic.target
|
||||||
|
#install -Dm0640 -t %{sysmaster_install_target} %{unit_install_source}/Multi-user.target
|
||||||
|
#install -Dm0640 -t %{sysmaster_install_target} %{unit_install_source}/shutdown.target
|
||||||
|
#install -Dm0640 -t %{sysmaster_install_target} %{unit_install_source}/sysinit.target
|
||||||
|
install -Dm0640 -t %{sysmaster_install_target} %{unit_install_source}/*
|
||||||
|
|
||||||
install -Dm0644 -t %{sysmaster_install_target}/plugin %{sysmaster_install_source}/libmount.so
|
install -Dm0550 -t %{sysmaster_install_target}/plugin %{sysmaster_install_source}/libmount.so
|
||||||
install -Dm0644 -t %{sysmaster_install_target}/plugin %{sysmaster_install_source}/libservice.so
|
install -Dm0550 -t %{sysmaster_install_target}/plugin %{sysmaster_install_source}/libservice.so
|
||||||
install -Dm0644 -t %{sysmaster_install_target}/plugin %{sysmaster_install_source}/libsocket.so
|
install -Dm0550 -t %{sysmaster_install_target}/plugin %{sysmaster_install_source}/libsocket.so
|
||||||
install -Dm0644 -t %{sysmaster_install_target}/plugin %{sysmaster_install_source}/libtarget.so
|
install -Dm0550 -t %{sysmaster_install_target}/plugin %{sysmaster_install_source}/libtarget.so
|
||||||
install -Dm0644 -t %{sysmaster_install_target}/plugin config/plugin.conf
|
install -Dm0640 -t %{sysmaster_install_target}/plugin %{conf_install_source}/plugin.conf
|
||||||
|
|
||||||
|
%files
|
||||||
|
/usr/bin/sctl
|
||||||
|
/usr/lib/sysmaster/*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Sat May 6 2023 shenyangyang<shenyangyang4@huawei.com> - 0.2.3-1
|
||||||
|
- update version to 0.2.3
|
||||||
|
|
||||||
* Tue Sep 20 2022 licunlong<licunlong1@huawei.com> - 0.2.1-2
|
* Tue Sep 20 2022 licunlong<licunlong1@huawei.com> - 0.2.1-2
|
||||||
- rename process1 to sysmaster, and remove pctrl to /usr/bin
|
- rename process1 to sysmaster, and remove pctrl to /usr/bin
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user