[package]
name = "sdme"
version = "0.2.5"
edition = "2021"
description = "Lightweight systemd-nspawn containers with overlayfs"
license = "MIT"
repository = "https://github.com/fiorix/sdme"
homepage = "https://fiorix.github.io/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"

[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"

[package.metadata.deb]
maintainer = "Alexandre Fiori"
depends = "systemd (>= 252), systemd-container"
suggests = "qemu-utils, apparmor"
section = "admin"
priority = "optional"
maintainer-scripts = "packaging/deb"
assets = [
    ["target/release/sdme", "usr/bin/", "755"],
    ["docs/sdme.1", "usr/share/man/man1/sdme.1", "644"],
    ["dist/completions/sdme.bash", "usr/share/bash-completion/completions/sdme", "644"],
    ["dist/completions/_sdme", "usr/share/zsh/vendor-completions/_sdme", "644"],
    ["dist/completions/sdme.fish", "usr/share/fish/vendor_completions.d/sdme.fish", "644"],
    ["dist/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 = "docs/sdme.1", dest = "/usr/share/man/man1/sdme.1", mode = "644", doc = true },
    { source = "dist/completions/sdme.bash", dest = "/usr/share/bash-completion/completions/sdme", mode = "644" },
    { source = "dist/completions/_sdme", dest = "/usr/share/zsh/site-functions/_sdme", mode = "644" },
    { source = "dist/completions/sdme.fish", dest = "/usr/share/fish/vendor_completions.d/sdme.fish", mode = "644" },
    { source = "dist/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 = "*"
