diff --git a/.gitignore b/.gitignore index d78a637..6d22d8f 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,6 @@ config.toml /.direnv/ result result-* + +# Packaging +/assets/completions/ \ No newline at end of file diff --git a/Cargo.toml b/Cargo.toml index 80ea152..c791d78 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,6 +2,16 @@ name = "mysqladm-rs" version = "0.1.0" edition = "2021" +license = "BSD3" +authors = [ + "oysteikt@pvv.ntnu.no", + "felixalb@pvv.ntnu.no", +] +repository = "https://git.pvv.ntnu.no/Projects/mysqladm-rs" +description = "A command-line utility for MySQL administration for non-admin users" +categories = ["command-line-interface", "command-line-utilities"] +keywords = ["mysql", "cli", "administration"] +readme = "README.md" [dependencies] anyhow = "1.0.95" @@ -54,3 +64,37 @@ anyhow = "1.0.95" [dev-dependencies] regex = "1.11.1" + +# TODO: package shell completions +[package.metadata.deb] +maintainer = "Programvareverkstedet " +section = "admin" +assets = [ + [ + "target/release/mysqladm", + "usr/bin/", + "755", + ], + [ + "example-config.toml", + "etc/mysqladm/config.toml", + "644", + ], + [ + "assets/completions/_*", + "usr/share/zsh/site-functions/completions/", + "644", + ], + [ + "assets/completions/*.bash", + "usr/share/bash-completion/completions/", + "644", + ], + [ + "assets/completions/*.fish", + "usr/share/fish/vendor_completions.d/", + "644", + ], +] +conf-files = ["etc/mysqladm/config.toml"] +depends = [] diff --git a/create-deb.sh b/create-deb.sh new file mode 100755 index 0000000..9b3eaa9 --- /dev/null +++ b/create-deb.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash + +cargo build --release + +mkdir -p assets/completions + +./target/release/mysqladm generate-completions --shell bash > assets/completions/mysqladm.bash +./target/release/mysqladm generate-completions --shell zsh > assets/completions/_mysqladm +./target/release/mysqladm generate-completions --shell fish > assets/completions/mysqladm.fish + +./target/release/mysqladm generate-completions --shell bash --command mysql-dbadm > assets/completions/mysql-dbadm.bash +./target/release/mysqladm generate-completions --shell zsh --command mysql-dbadm > assets/completions/_mysql-dbadm +./target/release/mysqladm generate-completions --shell fish --command mysql-dbadm > assets/completions/mysql-dbadm.fish + +./target/release/mysqladm generate-completions --shell bash --command mysql-useradm > assets/completions/mysql-useradm.bash +./target/release/mysqladm generate-completions --shell zsh --command mysql-useradm > assets/completions/_mysql-useradm +./target/release/mysqladm generate-completions --shell fish --command mysql-useradm > assets/completions/mysql-useradm.fish + +cargo deb \ No newline at end of file diff --git a/example-config.toml b/example-config.toml index c2f9e44..47fe97e 100644 --- a/example-config.toml +++ b/example-config.toml @@ -19,4 +19,4 @@ port = 3306 username = "root" password = "secret" -timeout = 2 # seconds \ No newline at end of file +timeout = 2 # seconds diff --git a/flake.nix b/flake.nix index 2b461f6..741e628 100644 --- a/flake.nix +++ b/flake.nix @@ -48,6 +48,7 @@ mysql-client cargo-nextest cargo-deny + cargo-deb ]; RUST_SRC_PATH = "${toolchain}/lib/rustlib/src/rust/library";