[package]
name = "sdme"
version = "0.5.2"
edition = "2021"
description = "The systemd machine editor"
license = "MIT"
repository = "https://github.com/fiorix/sdme"
homepage = "https://fiorix.github.io/sdme"
documentation = "https://docs.rs/sdme"
readme = "README.md"
keywords = ["systemd", "nspawn", "containers", "overlayfs"]
categories = ["command-line-utilities"]

[lib]
name = "sdme"
path = "src/lib.rs"

[[bin]]
name = "sdme"
path = "src/main.rs"

[[bin]]
name = "sdme-kube-probe"
path = "src/kube/probe/main.rs"
required-features = ["probe"]

[features]
default = []
probe = ["dep:tonic", "dep:prost", "dep:tokio"]

[dependencies]
anyhow = "1"
clap = { version = "4", features = ["derive"] }
clap_complete = "4"
libc = "0.2"
serde = { version = "1", features = ["derive"] }
toml = "0.8"
tar = { version = "0.4", features = ["xattr"] }
flate2 = "1"
bzip2 = "0.5"
xz2 = "0.1"
serde_json = "1"
ureq = "3"
zbus = { version = "5", default-features = false, features = ["async-io", "blocking-api"] }
zstd = "0.13"
sha2 = "0.10"
serde_yml = "0.0.12"
tonic = { version = "0.12", optional = true }
prost = { version = "0.13", optional = true }
tokio = { version = "1", features = ["rt", "net", "time"], optional = true }

[package.metadata.deb]
maintainer = "Alexandre Fiori"
depends = "systemd (>= 252), systemd-container"
suggests = "qemu-utils, apparmor"
section = "admin"
priority = "optional"
maintainer-scripts = "dist/deb"
assets = [
    ["target/release/sdme", "usr/bin/", "755"],
    ["dist/out/completions/sdme.bash", "usr/share/bash-completion/completions/sdme", "644"],
    ["dist/out/completions/_sdme", "usr/share/zsh/vendor-completions/_sdme", "644"],
    ["dist/out/completions/sdme.fish", "usr/share/fish/vendor_completions.d/sdme.fish", "644"],
    ["dist/out/apparmor/sdme-default", "etc/apparmor.d/sdme-default", "644"],
]

[package.metadata.generate-rpm]
assets = [
    { source = "target/release/sdme", dest = "/usr/bin/sdme", mode = "755" },
    { source = "dist/out/completions/sdme.bash", dest = "/usr/share/bash-completion/completions/sdme", mode = "644" },
    { source = "dist/out/completions/_sdme", dest = "/usr/share/zsh/site-functions/_sdme", mode = "644" },
    { source = "dist/out/completions/sdme.fish", dest = "/usr/share/fish/vendor_completions.d/sdme.fish", mode = "644" },
    { source = "dist/out/apparmor/sdme-default", dest = "/etc/apparmor.d/sdme-default", mode = "644", config = true },
]
post_install_script = "if command -v apparmor_parser >/dev/null 2>&1; then apparmor_parser -r /etc/apparmor.d/sdme-default 2>/dev/null || true; fi"

[package.metadata.generate-rpm.requires]
systemd = ">= 252"
systemd-container = "*"
