Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
1df4b5c
Add menuitems: remove and add a minion
isbm Jun 9, 2026
cc1de52
Implement new sysmaster configuration setup via TUI
isbm Jun 10, 2026
a1104b0
Implement a simple file picker
isbm Jun 10, 2026
4f2c7fe
Add sysmaster binary
isbm Jun 10, 2026
eae6375
Implement Master provisioning/setup
isbm Jun 10, 2026
636170c
Autofind config
isbm Jun 10, 2026
f0402a9
Add master log viewer
isbm Jun 10, 2026
27b9b16
Add physical logs view, start/stop/restart master
isbm Jun 10, 2026
421f224
Add package picker
isbm Jun 11, 2026
69665dd
Lintfixes
isbm Jun 11, 2026
818bd54
Fix tests
isbm Jun 11, 2026
56c9c79
Add shortcuts to the popup menu, add filter to the repomanager list
isbm Jun 12, 2026
4e5f9bd
Render colorful manuals
isbm Jun 12, 2026
dcd9fc7
Update dependencies, refine file picker, add library support
isbm Jun 12, 2026
e16f77d
Add current path, change selector style in file picker
isbm Jun 12, 2026
116b0cf
Implement profiles manager
isbm Jun 12, 2026
fe6f27e
Finalise profiles support in the repo manager
isbm Jun 12, 2026
02c9d37
Add platforms support in repo manager
isbm Jun 12, 2026
e8448fb
Fix musl build, causing SIGSEGV on release optimised
isbm Jun 13, 2026
0169ca3
Add supported minion platform label helper and change the static ELF …
isbm Jun 13, 2026
de76ce2
Update artefact manager UI
isbm Jun 13, 2026
22fb95a
Add os/platform/arch groups to modules
isbm Jun 13, 2026
49e7edc
Cleanup TUI, lintfixes
isbm Jun 13, 2026
3f7686a
Fix test build on GNU
isbm Jun 13, 2026
454fac9
Fix journal integration test
isbm Jun 13, 2026
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
545 changes: 320 additions & 225 deletions Cargo.lock

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,20 @@ edition = "2024"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
chrono = "0.4.44"
chrono = "=0.4.44"
clap = { version = "4.6.1", features = ["unstable-styles"] }
colored = "3.1.1"
libsysinspect = { path = "./libsysinspect" }
libeventreg = { path = "./libeventreg" }
libmodpak = { path = "./libmodpak" }
libmodcore = { path = "./libmodcore" }
libcommon = { path = "./libcommon" }
libsysproto = { path = "./libsysproto" }
libsetup = { path = "./libsetup" }
log = "0.4.29"
sysinfo = { version = "0.33.1", features = ["linux-tmpfs"] }
tokio = { version = "1.52.3", features = ["full"] }
ratatui = { version = "0.30.0", features = [
ratatui = { version = "0.30.1", features = [
"all-widgets",
"serde",
"unstable",
Expand All @@ -27,6 +28,7 @@ crossterm = "0.28.1"
rand = "0.9.4"
indexmap = "2.14.0"
serde_json = "1.0.150"
serde_yaml = "0.9"
jsonpath_lib = "0.3.0"
openssl = { version = "0.10.80", features = ["vendored"] }
ratatui-cheese = "0.7.0"
Expand Down
44 changes: 40 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,22 @@ help:
@printf ' $(C_MX)%-20s$(C_OFF) %s\n' "modules-refresh" "Rebuild Linux musl module repo and refresh current minion slot."
ifeq ($(UNAME_S),Linux)
@printf '\n$(C_GRN)%s$(C_OFF)\n' "Cross Build"
@printf ' $(C_BLD)%-20s$(C_OFF) %s\n' "musl-x86_64" "Build static x86_64 Linux release artifacts."
@printf ' $(C_BLD)%-20s$(C_OFF) %s\n' "musl-x86_64-dev" "Build static x86_64 Linux debug artifacts."
@printf ' $(C_BLD)%-20s$(C_OFF) %s\n' "musl-aarch64" "Build static AArch64 Linux release artifacts."
@printf ' $(C_BLD)%-20s$(C_OFF) %s\n' "musl-aarch64-dev" "Build static AArch64 Linux debug artifacts."
@printf ' $(C_BLD)%-30s$(C_OFF) %s\n' "musl-x86_64" "Build static x86_64 Linux release artifacts."
@printf ' $(C_BLD)%-30s$(C_OFF) %s\n' "musl-x86_64-dev" "Build static x86_64 Linux debug artifacts."
@printf ' $(C_BLD)%-30s$(C_OFF) %s\n' "musl-aarch64" "Build static AArch64 Linux release artifacts."
@printf ' $(C_BLD)%-30s$(C_OFF) %s\n' "musl-aarch64-dev" "Build static AArch64 Linux debug artifacts."
@printf ' $(C_BLD)%-30s$(C_OFF) %s\n' "musl-x86_64-modules-dist" "Build static x86_64 Linux release modules distribution."
@printf ' $(C_BLD)%-30s$(C_OFF) %s\n' "musl-x86_64-modules-dist-dev" "Build static x86_64 Linux debug modules distribution."
@printf ' $(C_BLD)%-30s$(C_OFF) %s\n' "musl-aarch64-modules-dist" "Build static AArch64 Linux release modules distribution."
@printf ' $(C_BLD)%-30s$(C_OFF) %s\n' "musl-aarch64-modules-dist-dev" "Build static AArch64 Linux debug modules distribution."
@printf ' $(C_BLD)%-30s$(C_OFF) %s\n' "musl-x86_64" "Build static x86_64 Linux release artifacts."
@printf ' $(C_BLD)%-30s$(C_OFF) %s\n' "musl-x86_64-dev" "Build static x86_64 Linux debug artifacts."
@printf ' $(C_BLD)%-30s$(C_OFF) %s\n' "musl-aarch64" "Build static AArch64 Linux release artifacts."
@printf ' $(C_BLD)%-30s$(C_OFF) %s\n' "musl-aarch64-dev" "Build static AArch64 Linux debug artifacts."
@printf ' $(C_BLD)%-30s$(C_OFF) %s\n' "musl-x86_64-modules-dist" "Build static x86_64 Linux release modules distribution."
@printf ' $(C_BLD)%-30s$(C_OFF) %s\n' "musl-x86_64-modules-dist-dev" "Build static x86_64 Linux debug modules distribution."
@printf ' $(C_BLD)%-30s$(C_OFF) %s\n' "musl-aarch64-modules-dist" "Build static AArch64 Linux release modules distribution."
@printf ' $(C_BLD)%-30s$(C_OFF) %s\n' "musl-aarch64-modules-dist-dev" "Build static AArch64 Linux debug modules distribution."
endif
@printf '\n$(C_GRN)%s$(C_OFF)\n' "Testing"
@printf ' $(C_MX)%-20s$(C_OFF) %s\n' "test" "Run the full nextest suite for this platform."
Expand Down Expand Up @@ -152,6 +164,30 @@ musl-x86_64:
$(call stage_profile_minion,release,x86_64-unknown-linux-musl)
endif

musl-x86_64-modules-dist-dev:
$(call check_present,x86_64-linux-musl-gcc)
cargo build -v --workspace $(MUSL_WORKSPACE_EXCLUDES) --target x86_64-unknown-linux-musl
$(call stage_profile_modules,debug,x86_64-unknown-linux-musl)
$(call stage_modules_dist_from,debug,x86_64-unknown-linux-musl,$(MUSL_MODULE_PACKAGE_SPECS),$(call musl_modules_dist_dir,x86_64,debug))

musl-x86_64-modules-dist:
$(call check_present,x86_64-linux-musl-gcc)
cargo build --release --workspace $(MUSL_WORKSPACE_EXCLUDES) --target x86_64-unknown-linux-musl
$(call stage_profile_modules,release,x86_64-unknown-linux-musl)
$(call stage_modules_dist_from,release,x86_64-unknown-linux-musl,$(MUSL_MODULE_PACKAGE_SPECS),$(call musl_modules_dist_dir,x86_64,release))

musl-aarch64-modules-dist-dev:
$(call check_present,aarch64-linux-musl-gcc)
cargo build -v --workspace $(MUSL_WORKSPACE_EXCLUDES) --target aarch64-unknown-linux-musl
$(call stage_profile_modules,debug,aarch64-unknown-linux-musl)
$(call stage_modules_dist_from,debug,aarch64-unknown-linux-musl,$(MUSL_MODULE_PACKAGE_SPECS),$(call musl_modules_dist_dir,aarch64,debug))

musl-aarch64-modules-dist:
$(call check_present,aarch64-linux-musl-gcc)
cargo build --release --workspace $(MUSL_WORKSPACE_EXCLUDES) --target aarch64-unknown-linux-musl
$(call stage_profile_modules,release,aarch64-unknown-linux-musl)
$(call stage_modules_dist_from,release,aarch64-unknown-linux-musl,$(MUSL_MODULE_PACKAGE_SPECS),$(call musl_modules_dist_dir,aarch64,release))

all-dev:
@scripts/maybe-mxrun.sh all-dev || $(MAKE) _all_dev

Expand Down
14 changes: 10 additions & 4 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -152,14 +152,15 @@ define stage_profile_modules
if [ -f "$$build_dir/service" ]; then cp -f "$$build_dir/service" "$$stage_dir/sys/service" && chmod +x "$$stage_dir/sys/service"; fi; \
if [ -f "$$build_dir/pkg" ]; then cp -f "$$build_dir/pkg" "$$stage_dir/sys/pkg" && chmod +x "$$stage_dir/sys/pkg"; fi; \
if [ -f "$$build_dir/ipfw" ]; then cp -f "$$build_dir/ipfw" "$$stage_dir/net/ipfw" && chmod +x "$$stage_dir/net/ipfw"; fi; \
if [ -f "$build_dir/http-mod" ]; then cp -f "$build_dir/http-mod" "$stage_dir/net/http" && chmod +x "$stage_dir/net/http"; fi; \

if [ -f "$$build_dir/http-mod" ]; then cp -f "$$build_dir/http-mod" "$$stage_dir/net/http" && chmod +x "$$stage_dir/net/http"; fi; \
if [ -f "$$build_dir/file" ]; then cp -f "$$build_dir/file" "$$stage_dir/fs/file" && chmod +x "$$stage_dir/fs/file"; fi; \
if [ -f "$$build_dir/dir" ]; then cp -f "$$build_dir/dir" "$$stage_dir/fs/dir" && chmod +x "$$stage_dir/fs/dir"; fi; \
if [ -f "$$build_dir/lua-runtime" ]; then cp -f "$$build_dir/lua-runtime" "$$stage_dir/runtime/lua-runtime" && chmod +x "$$stage_dir/runtime/lua-runtime"; fi; \
if [ -f "$$build_dir/py3-runtime" ]; then cp -f "$$build_dir/py3-runtime" "$$stage_dir/runtime/py3-runtime" && chmod +x "$$stage_dir/runtime/py3-runtime"; fi; \
if [ -f "$$build_dir/wasm-runtime" ]; then cp -f "$$build_dir/wasm-runtime" "$$stage_dir/runtime/wasm-runtime" && chmod +x "$$stage_dir/runtime/wasm-runtime"; fi; \
if [ -f "$$build_dir/resource" ]; then cp -f "$$build_dir/resource" "$$stage_dir/cfg/resource" && chmod +x "$$stage_dir/cfg/resource"; fi
if [ -f "$$build_dir/resource" ]; then cp -f "$$build_dir/resource" "$$stage_dir/cfg/resource" && chmod +x "$$stage_dir/cfg/resource"; fi; \
if [ -f "$$build_dir/facts" ]; then cp -f "$$build_dir/facts" "$$stage_dir/facts" && chmod +x "$$stage_dir/facts"; fi; \
if [ -f "$$build_dir/kernel" ]; then cp -f "$$build_dir/kernel" "$$stage_dir/kernel" && chmod +x "$$stage_dir/kernel"; fi
endef

define stage_profile_minion
Expand Down Expand Up @@ -215,7 +216,7 @@ service) rel=sys/service ;; \
endef

define stage_modules_dist_from
@dist=$(MODULES_DIST_DIR); \
@dist=$$(if [ -n "$(4)" ]; then echo $(4); else echo $(MODULES_DIST_DIR); fi); \
stage_dir=$$(if [ -n "$(2)" ]; then echo $(STAGE_ROOT)/$(2)/$(1); else echo $(STAGE_ROOT)/native/$(1); fi); \
rm -rf "$$dist"; \
mkdir -p "$$dist"; \
Expand All @@ -230,6 +231,7 @@ define stage_modules_dist_from
net) rel=sys/net ;; \
run) rel=sys/run ;; \
ssrun) rel=sys/ssrun ;; \
pkg) rel=sys/pkg ;; \
user) rel=sys/user ;; \
service) rel=sys/service ;; \
http-mod) rel=net/http ;; \
Expand Down Expand Up @@ -269,6 +271,7 @@ define stage_native_modules_dist
net) rel=sys/net ;; \
run) rel=sys/run ;; \
ssrun) rel=sys/ssrun ;; \
pkg) rel=sys/pkg ;; \
user) rel=sys/user ;; \
service) rel=sys/service ;; \
http-mod) rel=net/http ;; \
Expand Down Expand Up @@ -349,3 +352,6 @@ define refresh_current_minion_repo
"$$sysbin" module -R -t --name $(CURRENT_MINION_SLOT) || true; \
"$$sysbin" module -A -t -p "$$minion"
endef
define musl_modules_dist_dir
build/musl-$(1)-modules-dist$(if $(filter debug,$(2)),-dev,)
endef
5 changes: 5 additions & 0 deletions libmodcore/src/modinit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,11 @@ impl ModInterface {
pub fn arguments(&self) -> &[ModArgument] {
&self.arguments
}

/// Get optional manpage
pub fn manpage(&self) -> Option<&str> {
self.manpage.as_deref()
}
}

/// Include `mod_doc.yaml` from the project and embed it.
Expand Down
30 changes: 27 additions & 3 deletions libmodpak/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -815,16 +815,30 @@ impl SysInspectModPak {
Ok(())
}

/// Add one statically linked sysminion build to the repository.
fn requires_static_minion(os: &str) -> bool {
matches!(os, "linux")
}

fn minion_platform_label(os: &str) -> &str {
match os {
"linux" => "Linux",
"freebsd" => "FreeBSD",
"netbsd" => "NetBSD",
"openbsd" => "OpenBSD",
_ => os,
}
}

/// Add one sysminion build to the repository.
pub fn add_minion_build(&mut self, p: PathBuf) -> Result<(), SysinspectError> {
let path = fs::canonicalize(p)?;
let buff = fs::read(&path)?;
let (_, arch, os) = Self::parse_obj(&buff)?;
if !buff.starts_with(b"\x7FELF") {
return Err(SysinspectError::MasterGeneralError("Minion build must be an ELF executable".to_string()));
}
if !Self::is_static_elf(&buff)? {
return Err(SysinspectError::MasterGeneralError("Minion build must be a static ELF".to_string()));
if Self::requires_static_minion(os) && !Self::is_static_elf(&buff)? {
return Err(SysinspectError::MasterGeneralError(format!("{} minion build must be a static ELF", Self::minion_platform_label(os))));
}
let version = Self::get_minion_version(&buff)
.ok_or_else(|| SysinspectError::MasterGeneralError("Minion build must be a sysminion executable".to_string()))?;
Expand Down Expand Up @@ -899,6 +913,9 @@ impl SysInspectModPak {
&checksum,
if meta.get_args().is_empty() { None } else { Some(meta.get_args().clone()) },
if meta.get_opts().is_empty() { None } else { Some(meta.get_opts().clone()) },
meta.get_version().map(|s| s.to_string()),
meta.get_author().map(|s| s.to_string()),
meta.get_manpage().map(|s| s.to_string()),
)
.map_err(|e| SysinspectError::MasterGeneralError(format!("Failed to add module to index: {e}")))?;
log::debug!("Writing index to {}", self.root.join(REPO_MOD_INDEX).display().to_string().bright_yellow());
Expand Down Expand Up @@ -1358,4 +1375,11 @@ impl SysInspectModPak {

Ok(())
}

/// Remove a single module entry for a specific platform and architecture.
pub fn remove_module_single(&mut self, name: &str, platform: &str, arch: &str) -> Result<(), SysinspectError> {
self.idx.remove_module(name, platform, arch)?;
fs::write(self.root.join(REPO_MOD_INDEX), self.idx.to_yaml()?)?;
Ok(())
}
}
12 changes: 11 additions & 1 deletion libmodpak/src/lib_ut.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ mod tests {
let dst = repo.root.join("script").join(platform).join(arch).join(subpath);
fs::create_dir_all(dst.parent().expect("module parent should exist")).expect("module parent should be created");
fs::write(&dst, format!("content for {name}")).expect("module file should be written");
repo.idx.index_module(name, subpath, platform, arch, "demo module", false, "deadbeef", None, None).expect("module should be indexed");
repo.idx
.index_module(name, subpath, platform, arch, "demo module", false, "deadbeef", None, None, None, None, None)
.expect("module should be indexed");
fs::write(repo.root.join("mod.index"), repo.idx.to_yaml().expect("index should serialize")).expect("index file should be written");
}

Expand Down Expand Up @@ -277,6 +279,14 @@ mod tests {
assert!(repo.add_minion_build(file).is_err());
}

#[test]
fn minion_static_requirement_is_linux_only() {
assert!(SysInspectModPak::requires_static_minion("linux"));
assert!(!SysInspectModPak::requires_static_minion("freebsd"));
assert!(!SysInspectModPak::requires_static_minion("netbsd"));
assert!(!SysInspectModPak::requires_static_minion("openbsd"));
}

#[test]
fn add_minion_build_rejects_non_sysminion_static_elf() {
let Some(src) = std::env::current_dir().ok().map(|p| p.join("target/x86_64-unknown-linux-musl/debug/sysinspect")).filter(|p| p.exists())
Expand Down
Loading
Loading