diff --git a/backport-fix-Fixed-parsing-single-quotes-error.patch b/backport-fix-Fixed-parsing-single-quotes-error.patch deleted file mode 100644 index 098452f..0000000 --- a/backport-fix-Fixed-parsing-single-quotes-error.patch +++ /dev/null @@ -1,76 +0,0 @@ -From e052fac4f325236f88ef225ed3c3cc96a02fbfa8 Mon Sep 17 00:00:00 2001 -From: zhangyao2022 -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> { - let mut argv: Vec = 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> { - 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 -+ }]) -+ ); - } - } --- diff --git a/backport-fix-device-avoid-inserting-empty-tag.patch b/backport-fix-device-avoid-inserting-empty-tag.patch deleted file mode 100644 index cc3d422..0000000 --- a/backport-fix-device-avoid-inserting-empty-tag.patch +++ /dev/null @@ -1,37 +0,0 @@ -From 3081211857ad265f3c7d1365cc558093ece19586 Mon Sep 17 00:00:00 2001 -From: chenjiayi -Date: Tue, 15 Aug 2023 10:14:43 +0800 -Subject: [PATCH 2/3] fix(device): avoid inserting empty tag - -If a tag is empty, the device id file will be directly created under -/run/devmaster/tags, which is not expected. ---- - libs/device/src/device.rs | 10 ++++++++-- - 1 file changed, 8 insertions(+), 2 deletions(-) - -diff --git a/libs/device/src/device.rs b/libs/device/src/device.rs -index 36607bcb..bf67fce9 100644 ---- a/libs/device/src/device.rs -+++ b/libs/device/src/device.rs -@@ -1325,10 +1325,16 @@ impl Device { - - /// add tag to the device object - pub fn add_tag(&self, tag: &str, both: bool) -> Result<(), Error> { -- self.all_tags.borrow_mut().insert(tag.to_string()); -+ if tag.trim().is_empty() { -+ return Ok(()); -+ } -+ -+ self.all_tags.borrow_mut().insert(tag.trim().to_string()); - - if both { -- self.current_tags.borrow_mut().insert(tag.to_string()); -+ self.current_tags -+ .borrow_mut() -+ .insert(tag.trim().to_string()); - } - self.property_tags_outdated.replace(true); - Ok(()) --- -2.33.0 - diff --git a/backport-fix-devmaster-append-trailing-white-line-in-99-defau.patch b/backport-fix-devmaster-append-trailing-white-line-in-99-defau.patch deleted file mode 100644 index 896d3d7..0000000 --- a/backport-fix-devmaster-append-trailing-white-line-in-99-defau.patch +++ /dev/null @@ -1,21 +0,0 @@ -From 7f32b9bcdce0d6fa2646f2b8a3e1c93c68c5ca1d Mon Sep 17 00:00:00 2001 -From: chenjiayi -Date: Tue, 15 Aug 2023 11:14:55 +0800 -Subject: [PATCH 3/3] fix(devmaster): append trailing white line in - 99-default.rules - ---- - exts/devmaster/config/rules.d/99-default.rules | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/exts/devmaster/config/rules.d/99-default.rules b/exts/devmaster/config/rules.d/99-default.rules -index 78f59f0a..47bb738a 100644 ---- a/exts/devmaster/config/rules.d/99-default.rules -+++ b/exts/devmaster/config/rules.d/99-default.rules -@@ -1 +1 @@ --TAG+="devmaster" -\ No newline at end of file -+TAG+="devmaster" --- -2.33.0 - diff --git a/backport-fix-devmaster-avoid-coredump-when-rules-directory-is.patch b/backport-fix-devmaster-avoid-coredump-when-rules-directory-is.patch deleted file mode 100644 index be02d70..0000000 --- a/backport-fix-devmaster-avoid-coredump-when-rules-directory-is.patch +++ /dev/null @@ -1,159 +0,0 @@ -From 08f37b15eee2bf80604ff07860b6bec99b2d9407 Mon Sep 17 00:00:00 2001 -From: chenjiayi -Date: Tue, 15 Aug 2023 10:06:45 +0800 -Subject: [PATCH 1/3] fix(devmaster): avoid coredump when rules directory is - empty - -Also simplify configuration entry 'netif_cfg_d' into 'network_d'. ---- - exts/devmaster/config/config.toml | 13 +++++++++++++ - exts/devmaster/config/network.d/99-default.link | 5 +++++ - exts/devmaster/config/rules.d/99-default.rules | 1 + - exts/devmaster/src/lib/config/devmaster_conf.rs | 11 +++++++---- - exts/devmaster/src/lib/framework/devmaster.rs | 4 ++-- - exts/devmaster/src/lib/rules/exec_mgr.rs | 5 +---- - exts/devmaster/tests/network/99-default.link | 7 ------- - 7 files changed, 29 insertions(+), 17 deletions(-) - create mode 100644 exts/devmaster/config/config.toml - create mode 100644 exts/devmaster/config/network.d/99-default.link - create mode 100644 exts/devmaster/config/rules.d/99-default.rules - delete mode 100644 exts/devmaster/tests/network/99-default.link - -diff --git a/exts/devmaster/config/config.toml b/exts/devmaster/config/config.toml -new file mode 100644 -index 00000000..35e795c3 ---- /dev/null -+++ b/exts/devmaster/config/config.toml -@@ -0,0 +1,13 @@ -+# Default configuration of devmaster daemon. -+ -+# Support 'info' and 'debug'. -+log_level = "info" -+ -+# Support multiple rules directories. -+rules_d = ["/etc/devmaster/rules.d"] -+ -+# Support multiple network interface configuration directories. -+network_d = ["/etc/devmaster/network.d"] -+ -+# The default value is 3. -+max_workers = 3 -diff --git a/exts/devmaster/config/network.d/99-default.link b/exts/devmaster/config/network.d/99-default.link -new file mode 100644 -index 00000000..831f33ed ---- /dev/null -+++ b/exts/devmaster/config/network.d/99-default.link -@@ -0,0 +1,5 @@ -+[Match] -+OriginalName = "*" -+ -+[Link] -+NamePolicy = ["database", "onboard", "slot", "path"] -diff --git a/exts/devmaster/config/rules.d/99-default.rules b/exts/devmaster/config/rules.d/99-default.rules -new file mode 100644 -index 00000000..78f59f0a ---- /dev/null -+++ b/exts/devmaster/config/rules.d/99-default.rules -@@ -0,0 +1 @@ -+TAG+="devmaster" -\ No newline at end of file -diff --git a/exts/devmaster/src/lib/config/devmaster_conf.rs b/exts/devmaster/src/lib/config/devmaster_conf.rs -index b7fcd00d..645d2e67 100644 ---- a/exts/devmaster/src/lib/config/devmaster_conf.rs -+++ b/exts/devmaster/src/lib/config/devmaster_conf.rs -@@ -44,7 +44,7 @@ pub(crate) struct DevmasterConfigData { - pub(crate) rules_d: Option>, - pub(crate) max_workers: Option, - pub(crate) log_level: Option, -- pub(crate) netif_cfg_d: Option>, -+ pub(crate) network_d: Option>, - } - - impl DevmasterConfig { -@@ -101,7 +101,7 @@ impl DevmasterConfig { - pub fn get_netif_cfg_d(&self) -> Vec { - self.inner - .borrow() -- .netif_cfg_d -+ .network_d - .clone() - .unwrap_or_else(|| DEFAULT_NETIF_CONFIG_DIRS.to_vec()) - } -@@ -116,7 +116,7 @@ mod tests { - fn test_config() { - let config_s = " - rules_d = [\"/root/rules.d\"] --netif_cfg_d = [\"/root/network\"] -+network_d = [\"/root/network.d\"] - "; - fs::write("/tmp/test_config.toml", config_s).unwrap(); - let config: DevmasterConfig = DevmasterConfig::new(); -@@ -125,7 +125,10 @@ netif_cfg_d = [\"/root/network\"] - assert_eq!(config.get_rules_d(), vec!["/root/rules.d".to_string()]); - assert_eq!(config.get_max_workers(), 3); - assert_eq!(config.get_log_level(), LevelFilter::Info); -- assert_eq!(config.get_netif_cfg_d(), vec!["/root/network".to_string()]); -+ assert_eq!( -+ config.get_netif_cfg_d(), -+ vec!["/root/network.d".to_string()] -+ ); - fs::remove_file("/tmp/test_config.toml").unwrap(); - - let default_conf = DevmasterConfig::new(); -diff --git a/exts/devmaster/src/lib/framework/devmaster.rs b/exts/devmaster/src/lib/framework/devmaster.rs -index 2fc00313..b636dc1e 100644 ---- a/exts/devmaster/src/lib/framework/devmaster.rs -+++ b/exts/devmaster/src/lib/framework/devmaster.rs -@@ -56,11 +56,11 @@ pub struct Cache { - - impl Cache { - /// generate the shared cache -- pub fn new(rules_d: Vec, netif_cfg_d: Vec) -> Cache { -+ pub fn new(rules_d: Vec, network_d: Vec) -> Cache { - let rules = Rules::load_rules(rules_d, ResolveNameTime::Early); - - let mut netif_cfg_ctx = NetifConfigCtx::new(); -- netif_cfg_ctx.load(netif_cfg_d); -+ netif_cfg_ctx.load(network_d); - - Cache { - rules, -diff --git a/exts/devmaster/src/lib/rules/exec_mgr.rs b/exts/devmaster/src/lib/rules/exec_mgr.rs -index 7a685e1b..18c38a18 100644 ---- a/exts/devmaster/src/lib/rules/exec_mgr.rs -+++ b/exts/devmaster/src/lib/rules/exec_mgr.rs -@@ -219,7 +219,7 @@ impl ExecuteManager { - .files - .clone(); - -- loop { -+ while self.current_rule_file.is_some() { - let next_file = self - .current_rule_file - .clone() -@@ -233,9 +233,6 @@ impl ExecuteManager { - self.apply_rule_file()?; - - self.current_rule_file = next_file; -- if self.current_rule_file.is_none() { -- break; -- } - } - - Ok(()) -diff --git a/exts/devmaster/tests/network/99-default.link b/exts/devmaster/tests/network/99-default.link -deleted file mode 100644 -index 2c86cdb5..00000000 ---- a/exts/devmaster/tests/network/99-default.link -+++ /dev/null -@@ -1,7 +0,0 @@ --[Match] --OriginalName = "*" -- --[Link] --NamePolicy = ["keep", "kernel", "database", "onboard", "slot", "path"] --AlternativeNamesPolicy = ["database", "onboard", "slot", "path"] --MACAddressPolicy = "persistent" --- -2.33.0 - diff --git a/backport-fix-disable-User-Group-feature-for-hongmeng.patch b/backport-fix-disable-User-Group-feature-for-hongmeng.patch deleted file mode 100644 index 9d18d07..0000000 --- a/backport-fix-disable-User-Group-feature-for-hongmeng.patch +++ /dev/null @@ -1,57 +0,0 @@ -From 749a9ae4f901d2327bc519fd777b5a6c37ae5403 Mon Sep 17 00:00:00 2001 -From: licunlong -Date: Tue, 22 Aug 2023 14:49:56 +0800 -Subject: [PATCH] fix: disable User/Group feature for hongmeng - ---- - core/coms/service/Cargo.toml | 4 +++- - core/coms/service/src/unit.rs | 2 ++ - core/sysmaster/src/unit/execute/spawn.rs | 1 + - 3 files changed, 6 insertions(+), 1 deletion(-) - -diff --git a/core/coms/service/Cargo.toml b/core/coms/service/Cargo.toml -index 99e7d2de..2dc55cd2 100755 ---- a/core/coms/service/Cargo.toml -+++ b/core/coms/service/Cargo.toml -@@ -38,5 +38,7 @@ serde = { version = "1.0.130", default-features = false } - libtests = { path = "../../../libs/libtests" } - - [features] --default = ["noplugin"] -+default = ["linux", "noplugin"] -+hongmeng = [] -+linux = [] - noplugin = [] -diff --git a/core/coms/service/src/unit.rs b/core/coms/service/src/unit.rs -index 3202a062..02b1ecb4 100755 ---- a/core/coms/service/src/unit.rs -+++ b/core/coms/service/src/unit.rs -@@ -260,11 +260,13 @@ impl ServiceUnit { - self.exec_ctx - .set_state_directory(cfg_data.borrow().Service.StateDirectory.clone()); - -+ #[cfg(feature = "linux")] - if let Err(e) = self.exec_ctx.set_user(&cfg_data.borrow().Service.User) { - log::error!("Failed to set user: {}", e); - return Err(e); - } - -+ #[cfg(feature = "linux")] - if let Err(e) = self.exec_ctx.set_group(&cfg_data.borrow().Service.Group) { - log::error!("Failed to set group: {}", e); - return Err(e); -diff --git a/core/sysmaster/src/unit/execute/spawn.rs b/core/sysmaster/src/unit/execute/spawn.rs -index 8f6da742..e27248b3 100755 ---- a/core/sysmaster/src/unit/execute/spawn.rs -+++ b/core/sysmaster/src/unit/execute/spawn.rs -@@ -173,6 +173,7 @@ fn exec_child(unit: &Unit, cmdline: &ExecCommand, params: &ExecParameters, ctx: - - let _ = setup_exec_directory(ctx.clone()); - -+ #[cfg(feature = "linux")] - if let Err(e) = apply_user_and_group(ctx.clone(), params) { - log::error!("Failed to apply user or group: {}", e); - return; --- -2.33.0 - diff --git a/backport-fix-enable-subtree_control-for-sub-cgroup-on-hongmen.patch b/backport-fix-enable-subtree_control-for-sub-cgroup-on-hongmen.patch deleted file mode 100644 index 0002cdc..0000000 --- a/backport-fix-enable-subtree_control-for-sub-cgroup-on-hongmen.patch +++ /dev/null @@ -1,52 +0,0 @@ -From b95071b3d24ef2211b3fed059d31497cd62ccbb6 Mon Sep 17 00:00:00 2001 -From: licunlong -Date: Thu, 24 Aug 2023 16:01:24 +0800 -Subject: [PATCH] fix: enable subtree_control for sub cgroup on hongmeng - ---- - core/sysmaster/src/main.rs | 5 +++++ - core/sysmaster/src/mount/setup.rs | 12 ++++++++++++ - 2 files changed, 17 insertions(+) - -diff --git a/core/sysmaster/src/main.rs b/core/sysmaster/src/main.rs -index 95aea65b..7d30fb64 100755 ---- a/core/sysmaster/src/main.rs -+++ b/core/sysmaster/src/main.rs -@@ -146,6 +146,11 @@ fn initialize_runtime(self_recovery_enable: bool) -> Result<()> { - msg: format!("mount cgroup controllers failed: {}", e), - })?; - -+ #[cfg(feature = "hongmeng")] -+ setup::enable_subtree_control(cgroup::CG_BASE_DIR).map_err(|e| Error::Other { -+ msg: format!("enable hongmeng resmgr subtree_control failed: {}", e), -+ })?; -+ - set_child_reaper(); - - Ok(()) -diff --git a/core/sysmaster/src/mount/setup.rs b/core/sysmaster/src/mount/setup.rs -index 953ff4d9..56efdac4 100755 ---- a/core/sysmaster/src/mount/setup.rs -+++ b/core/sysmaster/src/mount/setup.rs -@@ -460,6 +460,18 @@ pub fn mount_cgroup_controllers() -> Result<()> { - Ok(()) - } - -+#[cfg(feature = "hongmeng")] -+/// enable memory controller for sub cgroup -+pub fn enable_subtree_control(cg_base_dir: &str) -> Result<()> { -+ /* hongmeng doesn't enable cgroup controller for sub cgroup. So when we create a directory under -+ * /run/sysmaster/cgroup, i.e. foo.service, the file /run/sysmaster/cgroup/foo.service/controllers -+ * is empty. If controllers file is empty, we can't migrate our process to this cgroup. To avoid -+ * this problem, we forcely enable memory controller for sub cgroup. */ -+ let sub_tree_control = Path::new(cg_base_dir).join("subtree_control"); -+ fs::write(sub_tree_control, "+memory").context(IoSnafu)?; -+ Ok(()) -+} -+ - // return the pair controller which will join with the original controller - fn pair_controller(controller: &str) -> Option { - let mut pairs = HashMap::new(); --- -2.30.2 - diff --git a/backport-fix-input_event_codes_rs-compatible-with-rustc-1.71..patch b/backport-fix-input_event_codes_rs-compatible-with-rustc-1.71..patch deleted file mode 100644 index 11f8399..0000000 --- a/backport-fix-input_event_codes_rs-compatible-with-rustc-1.71..patch +++ /dev/null @@ -1,25 +0,0 @@ -From bbb18bd619ac58a23a70406335bb447389839e05 Mon Sep 17 00:00:00 2001 -From: chenjiayi -Date: Mon, 14 Aug 2023 19:02:04 +0800 -Subject: [PATCH] fix(input_event_codes_rs): compatible with rustc 1.71.1 - ---- - libs/input_event_codes_rs/src/build.sh | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/libs/input_event_codes_rs/src/build.sh b/libs/input_event_codes_rs/src/build.sh -index 9bcb9358..da51a0f9 100755 ---- a/libs/input_event_codes_rs/src/build.sh -+++ b/libs/input_event_codes_rs/src/build.sh -@@ -4,7 +4,7 @@ echo "use crate::input_event_codes; - use std::collections::HashMap; - - pub fn get_input_event_keycode(key_lookup: &str) -> u32 { -- let input_map = HashMap::from([" -+ let input_map: HashMap<&str, u32> = HashMap::from([" - - cat "$1/input_event_codes.rs" | while read line - do --- -2.33.0 - diff --git a/sysmaster-0.5.0.tar.xz b/sysmaster-0.5.0.tar.xz deleted file mode 100644 index ec77aab..0000000 Binary files a/sysmaster-0.5.0.tar.xz and /dev/null differ diff --git a/sysmaster-1.0.0.tar.xz b/sysmaster-1.0.0.tar.xz new file mode 100644 index 0000000..e46a541 Binary files /dev/null and b/sysmaster-1.0.0.tar.xz differ diff --git a/sysmaster.spec b/sysmaster.spec index 0895bd8..b97ccd1 100644 --- a/sysmaster.spec +++ b/sysmaster.spec @@ -5,32 +5,20 @@ %define _unpackaged_files_terminate_build 0 %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 factory_install_source factory +%global factory_install_target %{buildroot} %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.5.0 -Release: 3 +Name: sysmaster +Version: 1.0.0 +Release: 1 Summary: redesign and reimplement process1. License: Mulan PSL v2 URL: https://gitee.com/openeuler/sysmaster Source0: %{name}-%{version}.tar.xz -Patch0: backport-fix-input_event_codes_rs-compatible-with-rustc-1.71..patch -Patch1: backport-fix-Fixed-parsing-single-quotes-error.patch -Patch2: backport-fix-devmaster-avoid-coredump-when-rules-directory-is.patch -Patch3: backport-fix-device-avoid-inserting-empty-tag.patch -Patch4: backport-fix-devmaster-append-trailing-white-line-in-99-defau.patch -Patch5: backport-fix-disable-User-Group-feature-for-hongmeng.patch -Patch6: backport-fix-enable-subtree_control-for-sub-cgroup-on-hongmen.patch ExclusiveArch: x86_64 aarch64 @@ -45,6 +33,10 @@ Summary: %{summary} %package -n devmaster Summary: Infrastructure of device management in userspace. BuildRequires: util-linux-devel kmod-devel +Requires: %{name}%{?_isa} = %{version}-%{release} +Requires(post): sysmaster +Requires(preun): sysmaster +Requires(postun): sysmaster %description -n devmaster This package provides the infrastructure of device management in userspace. @@ -55,8 +47,6 @@ This package provides the infrastructure of device management in userspace. %cargo_generate_buildrequires %build -for i in $(seq 1 4); do sed -i '$d' ./Cargo.toml; done; - cat << EOF >> ./.cargo/config [source.crates-io] @@ -66,10 +56,11 @@ replace-with = "vendored-sources" directory = "vendor" EOF - -%{_cargo_build} --profile release -vvvv +%{_cargo_build} --profile release %install +# For binary files and .so files, the permission 750 in the install phase to prevent objcopy errors. +# In the files phase, the permission is set back to 550. 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 @@ -78,60 +69,100 @@ install -Dm0750 -t %{sysmaster_install_target} %{sysmaster_install_source}/sysmo 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} %{sysmaster_install_source}/sysmaster-run +install -Dm0750 -t %{sysmaster_install_target}/system-generators %{sysmaster_install_source}/getty-generator -install -Dm0640 -t %{unit_install_target} %{unit_install_source}/* +cp -a %{factory_install_source}/* %{factory_install_target} -install -Dm0640 -t %{buildroot}/etc/sysmaster %{conf_install_source}/system.conf - -install -Dm0750 -t %{buildroot}/usr/bin %{devmaster_install_source}/devctl -install -Dm0750 -t %{devmaster_install_target} %{devmaster_install_source}/devmaster -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/* +install -Dm0750 -t %{buildroot}/usr/bin %{sysmaster_install_source}/devctl +ln -s /usr/bin/devctl %{buildroot}/usr/lib/devmaster/devmaster mkdir -p %{buildroot}/etc/sysmaster/system/multi-user.target.wants - -for unit in NetworkManager.service dbus.service dbus.socket fstab.service getty-tty1.service hostname-setup.service lvm-activate-openeuler.service udev-trigger.service udevd-control.socket udevd-kernel.socket udevd.service; 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 +for unit in NetworkManager.service dbus.service fstab.service hostname-setup.service getty.target sshd.service devctl-trigger.service; do + # enable service for booting + ln -s /usr/lib/sysmaster/system/$unit %{buildroot}/etc/sysmaster/system/multi-user.target.wants/$unit done -# enable sshd service by default -ln -s /usr/lib/sysmaster/system/sshd.service %{buildroot}/etc/sysmaster/system/multi-user.target.wants/sshd.service +mkdir -p %{buildroot}/etc/sysmaster/system/sysinit.target.wants +for unit in udevd.service udev-trigger.service devmaster.service; do + ln -s /usr/lib/sysmaster/system/$unit %{buildroot}/etc/sysmaster/system/sysinit.target.wants/$unit +done + +# Install configurations under /etc. +sed -i 's/\"\/lib\/devmaster\/rules.d\"/&, \"\/etc\/udev\/rules.d\", \"\/run\/udev\/rules.d\", \"\/lib\/udev\/rules.d\"/' %{buildroot}/etc/devmaster/config.toml %files %attr(0550,-,-) /usr/bin/sctl %dir %attr(0550,-,-) /usr/lib/sysmaster %dir %attr(0750,-,-) /usr/lib/sysmaster/system -/usr/lib/sysmaster/system/* +%attr(0640,-,-) /usr/lib/sysmaster/system/* %attr(0550,-,-) /usr/lib/sysmaster/init %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-run %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.conf +/etc/sysmaster/system/sysinit.target.wants/* +%attr(0640,-,-) /etc/sysmaster/system.conf +%attr(0444,-,-) /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 +%exclude /etc/sysmaster/system/sysinit.target.wants/devmaster.service +%exclude /etc/sysmaster/system/multi-user.target.wants/devctl-trigger.service %files -n devmaster %dir %attr(0550,-,-) /usr/lib/devmaster %dir %attr(0750,-,-) /etc/devmaster -/etc/devmaster/config.toml +%attr(0640,-,-) /etc/devmaster/config.toml %dir %attr(0750,-,-) /etc/devmaster/rules.d -/etc/devmaster/rules.d/99-default.rules +%attr(0640,-,-) /etc/devmaster/rules.d/99-default.rules %dir %attr(0750,-,-) /etc/devmaster/network.d -/etc/devmaster/network.d/99-default.link +%attr(0640,-,-) /etc/devmaster/network.d/99-default.link %attr(0550,-,-) /usr/bin/devctl %attr(0550,-,-) /usr/lib/devmaster/devmaster +%attr(0640,-,-) /usr/lib/sysmaster/system/devctl-trigger.service +%attr(0640,-,-) /usr/lib/sysmaster/system/devmaster-simu-udev.service +%attr(0640,-,-) /usr/lib/sysmaster/system/devmaster.service +%attr(0550,-,-) /usr/lib/devmaster/simulate_udev.sh +/etc/sysmaster/system/sysinit.target.wants/devmaster.service +/etc/sysmaster/system/multi-user.target.wants/devctl-trigger.service + +%post -n sysmaster +test -f /usr/bin/sctl && ln -sf ../bin/sctl /usr/sbin/reboot || : +test -f /usr/bin/sctl && ln -sf ../bin/sctl /usr/sbin/shutdown || : +test -f /usr/bin/sctl && ln -sf ../bin/sctl /usr/sbin/poweroff || : +test -f /usr/bin/sctl && ln -sf ../bin/sctl /usr/sbin/halt || : + +%postun -n sysmaster +test -f /usr/bin/systemctl && ln -sf ../bin/systemctl /usr/sbin/reboot || : +test -f /usr/bin/systemctl && ln -sf ../bin/systemctl /usr/sbin/shutdown || : +test -f /usr/bin/systemctl && ln -sf ../bin/systemctl /usr/sbin/poweroff || : +test -f /usr/bin/systemctl && ln -sf ../bin/systemctl /usr/sbin/halt || : + + +%post -n devmaster +test -f /etc/sysmaster/system/sysinit.target.wants/udevd.service && unlink /etc/sysmaster/system/sysinit.target.wants/udevd.service || : +test -f /etc/sysmaster/system/sysinit.target.wants/udev-trigger.service && unlink /etc/sysmaster/system/sysinit.target.wants/udev-trigger.service || : + +%postun -n devmaster +if [ $1 -eq 0 ] ; then + test -f /usr/lib/sysmaster/system/udevd.service && ln -s /usr/lib/sysmaster/system/udevd.service /etc/sysmaster/system/sysinit.target.wants/udevd.service || : + test -f /usr/lib/sysmaster/system/udev-trigger.service && ln -s /usr/lib/sysmaster/system/udev-trigger.service /etc/sysmaster/system/sysinit.target.wants/udev-trigger.service || : +fi %changelog +* Thu Feb 22 2024 zhangyao - 1.0.0-1 +- update version to 1.0.0 + * Fri Aug 25 2023 licunlong - 0.5.0-3 - enable subtree_control for sub cgroup on hongmeng