Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ members = [
]

[workspace.package]
version = "0.1.0"
edition = "2021"
rust-version = "1.95"
license = "MIT OR Apache-2.0"
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ A service manager and PID 1 for Linux, written in Rust.
[![Status](https://img.shields.io/badge/status-pre--alpha-orange)](ROADMAP.md)
[![CI](https://github.com/youhide/oxinit/actions/workflows/ci.yml/badge.svg)](https://github.com/youhide/oxinit/actions/workflows/ci.yml)

**Pre-alpha. Nothing is stable.** See [ROADMAP.md](ROADMAP.md) for what works.
**Pre-alpha. Nothing is stable**, and the unit format may change between any
two releases. See [ROADMAP.md](ROADMAP.md) for what works and what each
milestone was verified against.

## What this is, in one picture

Expand Down
2 changes: 1 addition & 1 deletion crates/listen-probe/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "listen-probe"
version = "0.0.0"
version.workspace = true
description = "Test fixture: a socket-activated service, and a client to poke it"
edition.workspace = true
rust-version.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion crates/notify-probe/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "notify-probe"
version = "0.0.0"
version.workspace = true
description = "Test fixture: a service that speaks sd_notify"
edition.workspace = true
rust-version.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion crates/oxctl/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "oxctl"
version = "0.0.0"
version.workspace = true
description = "Command-line client for oxinit"
edition.workspace = true
rust-version.workspace = true
Expand Down
6 changes: 6 additions & 0 deletions crates/oxctl/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ commands:
restart <unit> stop, then start once it is down
logs <unit> what the unit has written, from /var/log/oxinit
reload re-read the unit directories
--version which build this is

`logs` reads the file directly. It does not go through oxinit: the control
socket has to stay responsive, and bulk data is what would stop it being.
Expand Down Expand Up @@ -70,6 +71,11 @@ fn run(args: &[String]) -> Result<(), String> {
return Err(format!("{command} needs a unit name\n\n{USAGE}"))
}

("--version" | "-V", _) => {
println!("oxctl {}", env!("CARGO_PKG_VERSION"));
return Ok(());
}

("" | "help" | "--help" | "-h", _) => {
println!("{USAGE}");
return Ok(());
Expand Down
2 changes: 1 addition & 1 deletion crates/oxinit-cgroup/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "oxinit-cgroup"
version = "0.0.0"
version.workspace = true
description = "cgroup v2 hierarchy, limits, accounting, and emptiness"
edition.workspace = true
rust-version.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion crates/oxinit-graph/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "oxinit-graph"
version = "0.0.0"
version.workspace = true
description = "Dependency resolution and start ordering"
edition.workspace = true
rust-version.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion crates/oxinit-ipc/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "oxinit-ipc"
version = "0.0.0"
version.workspace = true
description = "Control protocol types, shared by oxinit and oxctl"
edition.workspace = true
rust-version.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion crates/oxinit-log/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "oxinit-log"
version = "0.0.0"
version.workspace = true
description = "Log record format, line splitting, and rotation policy"
edition.workspace = true
rust-version.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion crates/oxinit-service/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "oxinit-service"
version = "0.0.0"
version.workspace = true
description = "Service state machine and restart policy"
edition.workspace = true
rust-version.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion crates/oxinit-timer/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "oxinit-timer"
version = "0.0.0"
version.workspace = true
description = "Timer schedules and the calendar arithmetic behind them"
edition.workspace = true
rust-version.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion crates/oxinit-unit/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "oxinit-unit"
version = "0.0.0"
version.workspace = true
description = "Unit file parsing and validation"
edition.workspace = true
rust-version.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion crates/oxinit-user/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "oxinit-user"
version = "0.0.0"
version.workspace = true
description = "Resolving a username against /etc/passwd and /etc/group"
edition.workspace = true
rust-version.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion crates/oxinit/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "oxinit"
version = "0.0.0"
version.workspace = true
description = "PID 1 and service manager"
edition.workspace = true
rust-version.workspace = true
Expand Down
8 changes: 8 additions & 0 deletions crates/oxinit/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,14 @@ const SIGUSR2: u32 = libc::SIGUSR2 as u32;
const SIGPWR: u32 = libc::SIGPWR as u32;

fn main() -> ExitCode {
// Before the pid check, deliberately. `oxinit --version` has to work for
// somebody holding a binary and asking what it is, and that person is
// exactly the one who cannot run it as PID 1 to find out.
if std::env::args().any(|arg| arg == "--version" || arg == "-V") {
println!("oxinit {}", env!("CARGO_PKG_VERSION"));
return ExitCode::SUCCESS;
}

if !rustix::process::getpid().is_init() {
eprintln!(
"oxinit: running as pid {}, not 1. oxinit is an init system; \
Expand Down
2 changes: 1 addition & 1 deletion crates/oxlogd/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "oxlogd"
version = "0.0.0"
version.workspace = true
description = "Reads service output and writes it"
edition.workspace = true
rust-version.workspace = true
Expand Down
5 changes: 5 additions & 0 deletions crates/oxlogd/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ fn main() -> ExitCode {
}

fn run() -> Result<(), String> {
if std::env::args().any(|arg| arg == "--version" || arg == "-V") {
println!("oxlogd {}", env!("CARGO_PKG_VERSION"));
return Ok(());
}

let dir = std::env::args()
.skip_while(|arg| arg != "--dir")
.nth(1)
Expand Down
2 changes: 1 addition & 1 deletion crates/xtask/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "xtask"
version = "0.0.0"
version.workspace = true
description = "Build and boot automation"
edition.workspace = true
rust-version.workspace = true
Expand Down
Loading