From 2fc224e47a39c833fc88f37aa744b1a21f70b6da Mon Sep 17 00:00:00 2001 From: sisungo Date: Sat, 30 Dec 2023 13:25:18 +0800 Subject: [PATCH] [Release] Airup v0.6.0 --- CHANGELOG | 13 +++++++++++++ INSTALL.md | 8 +++++--- README.md | 4 ++-- airup-sdk/Cargo.toml | 4 ++-- airup/Cargo.toml | 2 +- airupd/Cargo.toml | 4 ++-- airupfx/Cargo.toml | 4 ++-- airupfx/src/env/mod.rs | 11 ++--------- airupfx/src/env/users.rs | 17 ++++++---------- airupfx/src/lib.rs | 5 ++++- airupfx/src/sys/unix/process.rs | 1 - docs/en-US/api_manual/ipc/system.md | 30 +++++++++++++++++++++++++++++ docs/zh-CN/api_manual/ipc/system.md | 30 +++++++++++++++++++++++++++++ 13 files changed, 99 insertions(+), 34 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 1259b01..d98a313 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,16 @@ +Changes in v0.6.0: + * [Feature] Implement delayed retrying + * [Feature] `airup debug --use-logger` and `airup debug --print-build-manifest` CLI utilities + * [Feature] `airup enable` and `airup disable` CLI utilities + * [Feature] `airup stop --force` CLI utility and `system.kill_service` API + * [Feature] Allow specifying reboot/poweroff/halt timeout + * [Feature] Support `health-check`-kinded watchdogs + * [Internals] Task importance measurement + * [Fix] Potential race condition in Unix process subsystem + * [Fix] Unexpected logging in `reboot` milestone + * [Developer] Move `SystemConf` structure from `airupd` to `airup-sdk` + * ACE performance optimization + Changes in v0.5.0: * [Feature] Gracefully reboot * [Feature] Support of recording of service logs diff --git a/INSTALL.md b/INSTALL.md index 2f69898..2db8654 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -8,10 +8,12 @@ To build Airup, you need to install the few dependencies first: Some build dependencies are optional, as they are only required when the feature is used: - [cbindgen](https://github.com/mozilla/cbindgen): A tool to generated C headers from Rust code. +Airup requires `Rust 1.75.0` or newer to compile. + ## Configuration -Some Airup functions are configured at build time. The build manifest which is located at `build_manifest.rs` stores primitive -configuration items that cannot be set at runtime. Its example is at `docs/resources/build_manifest.rs`. Definitions to its -items: +Some Airup functions are configured at build time. The build manifest which is located at `build_manifest.json` stores primitive +paths that cannot be set at runtime or default values of `system.conf` items. An example file is located +at `docs/resources/build_manifest.json`. There is a list that describes all available configuration items: - `os_name`: Name of the OS build. - `config_dir`: Path of Airup's configuration directory, which stores service/system config files, etc. - `service_dir`: Path of Airup's service directory, which stores service files. diff --git a/README.md b/README.md index 8bbb857..9d14fb9 100644 --- a/README.md +++ b/README.md @@ -8,8 +8,8 @@ supervisor or the `init` daemon (`pid == 1`). ## Project Status Maintained Versions: - - Current Mainline Version: `0.5.0` - - Current Release Version: `0.5.0` + - Current Mainline Version: `0.6.0` + - Current Release Version: `0.6.0` ⚠️ **WARNING**: The project is currently in **unstable** stage and should **NOT** be used in production environments. It may contain errors, bugs or quality issues. Welcome to open an issue to report bugs. diff --git a/airup-sdk/Cargo.toml b/airup-sdk/Cargo.toml index 014afcc..7cafed1 100644 --- a/airup-sdk/Cargo.toml +++ b/airup-sdk/Cargo.toml @@ -4,7 +4,7 @@ authors = ["sisungo "] description = "SDK library of Airup" documentation = "https://docs.rs/airup-sdk" repository = "https://github.com/sisungo/airup" -version = "0.5.0" +version = "0.6.0" edition = "2021" license = "MIT" @@ -23,5 +23,5 @@ json-patch = "1" serde = { version = "1", features = ["derive"] } serde_json = "1" tokio = { version = "1", features = ["net", "fs", "io-util"] } -toml = "0.7" +toml = "0.8" thiserror = "1" \ No newline at end of file diff --git a/airup/Cargo.toml b/airup/Cargo.toml index 7132c08..f76d11e 100644 --- a/airup/Cargo.toml +++ b/airup/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "airup" authors = ["sisungo "] -version = "0.5.0" +version = "0.6.0" edition = "2021" license = "MIT" publish = false diff --git a/airupd/Cargo.toml b/airupd/Cargo.toml index d6a0368..f70debd 100644 --- a/airupd/Cargo.toml +++ b/airupd/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "airupd" authors = ["sisungo "] -version = "0.5.0" +version = "0.6.0" edition = "2021" license = "MIT" publish = false @@ -25,5 +25,5 @@ serde = "1" serde_json = "1" thiserror = "1" tokio = { workspace = true } -toml = "0.7" +toml = "0.8" tracing = "0.1" \ No newline at end of file diff --git a/airupfx/Cargo.toml b/airupfx/Cargo.toml index 2d32fb9..7321eee 100644 --- a/airupfx/Cargo.toml +++ b/airupfx/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "airupfx" authors = ["sisungo "] -version = "0.5.0" +version = "0.6.0" edition = "2021" license = "MIT" publish = false @@ -20,7 +20,7 @@ libc = "0.2" mini-moka = "0.10" once_cell = "1" shlex = "1.2" -sysinfo = { version = "0.29", features = ["serde"] } +sysinfo = { version = "0.30", features = ["serde"] } thiserror = "1" tokio = { workspace = true } tracing = "0.1" diff --git a/airupfx/src/env/mod.rs b/airupfx/src/env/mod.rs index ee849f0..d48d3b3 100644 --- a/airupfx/src/env/mod.rs +++ b/airupfx/src/env/mod.rs @@ -4,14 +4,7 @@ pub mod users; pub use users::{current_uid, with_current_user, with_user_by_id, with_user_by_name}; -use once_cell::sync::Lazy; -use std::{ - ffi::{OsStr, OsString}, - sync::RwLock, -}; -use sysinfo::SystemExt; - -static SYSINFO: Lazy> = Lazy::new(|| RwLock::new(sysinfo::System::new())); +use std::ffi::{OsStr, OsString}; /// Sets environment variables in the iterator for the currently running process, removing environment variables with value /// `None`. @@ -54,5 +47,5 @@ pub async fn refresh() { /// Returns host name of the machine currently running the process. #[inline] pub fn host_name() -> Option { - SYSINFO.read().unwrap().host_name() + sysinfo::System::host_name() } diff --git a/airupfx/src/env/users.rs b/airupfx/src/env/users.rs index a9f306f..860fd31 100644 --- a/airupfx/src/env/users.rs +++ b/airupfx/src/env/users.rs @@ -2,13 +2,10 @@ use once_cell::sync::Lazy; use std::sync::RwLock; -use sysinfo::{SystemExt, Uid, User, UserExt}; +use sysinfo::{Uid, User}; -static USERS: Lazy> = Lazy::new(|| { - let mut instance = sysinfo::System::new(); - instance.refresh_users_list(); - instance.into() -}); +static USERS: Lazy> = + Lazy::new(|| sysinfo::Users::new_with_refreshed_list().into()); static CACHE: Lazy, ahash::RandomState>> = Lazy::new(|| { mini_moka::sync::Cache::builder() @@ -19,7 +16,7 @@ static CACHE: Lazy, ahash::RandomS /// Refreshes users database. pub fn refresh() { - USERS.write().unwrap().refresh_users_list(); + USERS.write().unwrap().refresh_list(); CACHE.invalidate_all(); } @@ -29,7 +26,6 @@ pub fn with_user_by_id T, T>(uid: &Uid, f: F) -> Option { let req = Request::FindUserById(uid.clone()); let numeric = CACHE.get(&req).unwrap_or_else(|| { let value = users - .users() .iter() .enumerate() .find(|(_, u)| u.id() == uid) @@ -37,7 +33,7 @@ pub fn with_user_by_id T, T>(uid: &Uid, f: F) -> Option { CACHE.insert(req, value); value }); - numeric.map(|i| f(users.users().get(i).unwrap())) + numeric.map(|i| f(users.get(i).unwrap())) } /// Finds a user entry by username. @@ -46,7 +42,6 @@ pub fn with_user_by_name T, T>(name: &str, f: F) -> Option T, T>(name: &str, f: F) -> Option