From 027af5c45654c84bf050cabd080c9f95a4aed82d Mon Sep 17 00:00:00 2001 From: h7x4 Date: Wed, 26 Nov 2025 03:38:31 +0900 Subject: [PATCH] Rename project to `muscle` --- Cargo.lock | 2 +- Cargo.toml | 16 ++++---- README.md | 6 +-- .../{mysqladm.service => muscle.service} | 12 +++--- .../{mysqladm.socket => muscle.socket} | 2 +- build.rs | 4 +- create-deb.sh | 20 +++++----- example-config.toml | 6 +-- flake.nix | 34 ++++++++-------- nix/default.nix | 6 +-- nix/module.nix | 40 +++++++++---------- src/client/commands.rs | 6 +-- .../mysql_dbadm.rs | 6 +-- .../mysql_useradm.rs | 4 +- src/core/common.rs | 4 +- src/main.rs | 6 +-- 16 files changed, 87 insertions(+), 87 deletions(-) rename assets/systemd/{mysqladm.service => muscle.service} (84%) rename assets/systemd/{mysqladm.socket => muscle.socket} (76%) diff --git a/Cargo.lock b/Cargo.lock index a6d6ebe..48dbc47 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1086,7 +1086,7 @@ dependencies = [ ] [[package]] -name = "mysqladm-rs" +name = "muscle" version = "0.1.0" dependencies = [ "anyhow", diff --git a/Cargo.toml b/Cargo.toml index 75487c6..8673b25 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "mysqladm-rs" +name = "muscle" version = "0.1.0" edition = "2024" license = "BSD-3-Clause" @@ -7,8 +7,8 @@ authors = [ "oysteikt@pvv.ntnu.no", "felixalb@pvv.ntnu.no", ] -repository = "https://git.pvv.ntnu.no/Projects/mysqladm-rs" -documentation = "https://pages.pvv.ntnu.no/Projects/mysqladm-rs/main/docs/mysqladm/" +repository = "https://git.pvv.ntnu.no/Projects/muscle" +documentation = "https://pages.pvv.ntnu.no/Projects/muscle/main/docs/muscle/" description = "A command-line utility for MySQL administration for non-admin users" categories = ["command-line-interface", "command-line-utilities"] keywords = ["mysql", "cli", "administration"] @@ -51,7 +51,7 @@ mysql-admutils-compatibility = [] suid-sgid-mode = [] [[bin]] -name = "mysqladm" +name = "muscle" bench = false path = "src/main.rs" @@ -67,7 +67,7 @@ anyhow = "1.0.100" regex = "1.12.2" [package.metadata.deb] -name = "mysqladm-rs" +name = "muscle" priority = "optional" section = "databases" depends = "$auto" @@ -76,13 +76,13 @@ maintainer = "Programvareverkstedet " copyright = "Copyright (c) 2025, Programvareverkstedet" assets = [ [ - "target/release/mysqladm", + "target/release/muscle", "usr/bin/", "755", ], [ "example-config.toml", - "etc/mysqladm/config.toml", + "etc/muscle/config.toml", "600", ], [ @@ -107,5 +107,5 @@ assets = [ ], ] systemd-units = [ - { unit-name = "mysqladm", unit-scripts = "assets/systemd", enable = true }, + { unit-name = "muscle", unit-scripts = "assets/systemd", enable = true }, ] diff --git a/README.md b/README.md index 3abd33a..b58ece8 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ -[![Coverage](https://pages.pvv.ntnu.no/Projects/mysqladm-rs/main/coverage/badges/for_the_badge.svg)](https://pages.pvv.ntnu.no/Projects/mysqladm-rs/main/coverage/) -[![Docs](https://img.shields.io/badge/rust_docs-blue?style=for-the-badge&logo=rust)](https://pages.pvv.ntnu.no/Projects/mysqladm-rs/main/docs/mysqladm/) +[![Coverage](https://pages.pvv.ntnu.no/Projects/muscle/main/coverage/badges/for_the_badge.svg)](https://pages.pvv.ntnu.no/Projects/muscle/main/coverage/) +[![Docs](https://img.shields.io/badge/rust_docs-blue?style=for-the-badge&logo=rust)](https://pages.pvv.ntnu.no/Projects/muscle/main/docs/muscle/) -# mysqladm-rs +# muscle Healing mysql spasms since 2024 diff --git a/assets/systemd/mysqladm.service b/assets/systemd/muscle.service similarity index 84% rename from assets/systemd/mysqladm.service rename to assets/systemd/muscle.service index 014894a..05a271f 100644 --- a/assets/systemd/mysqladm.service +++ b/assets/systemd/muscle.service @@ -1,19 +1,19 @@ [Unit] Description=MySQL administration tool for non-admin users -Requires=mysqladm.socket +Requires=muscle.socket [Service] Type=notify -ExecStart=/usr/bin/mysqladm-rs server --systemd socket-activate +ExecStart=/usr/bin/muscle server --systemd socket-activate WatchdogSec=15 -User=mysqladm -Group=mysqladm +User=muscle +Group=muscle DynamicUser=yes -ConfigurationDirectory=mysqladm -RuntimeDirectory=mysqladm +ConfigurationDirectory=muscle +RuntimeDirectory=muscle # This is required to read unix user/group details. PrivateUsers=false diff --git a/assets/systemd/mysqladm.socket b/assets/systemd/muscle.socket similarity index 76% rename from assets/systemd/mysqladm.socket rename to assets/systemd/muscle.socket index 1b2dea9..cdec7e5 100644 --- a/assets/systemd/mysqladm.socket +++ b/assets/systemd/muscle.socket @@ -3,6 +3,6 @@ Description=MySQL administration tool for non-admin users WantedBy=sockets.target [Socket] -ListenStream=/run/mysqladm/mysqladm.sock +ListenStream=/run/muscle/muscle.sock Accept=no PassCredentials=true diff --git a/build.rs b/build.rs index 1507125..1cd65c6 100644 --- a/build.rs +++ b/build.rs @@ -21,7 +21,7 @@ fn generate_mysql_admutils_symlinks() -> anyhow::Result<()> { if !target_profile_dir.join("mysql-useradm").exists() { symlink( - target_profile_dir.join("mysqladm"), + target_profile_dir.join("muscle"), target_profile_dir.join("mysql-useradm"), ) .ok(); @@ -29,7 +29,7 @@ fn generate_mysql_admutils_symlinks() -> anyhow::Result<()> { if !target_profile_dir.join("mysql-dbadm").exists() { symlink( - target_profile_dir.join("mysqladm"), + target_profile_dir.join("muscle"), target_profile_dir.join("mysql-dbadm"), ) .ok(); diff --git a/create-deb.sh b/create-deb.sh index 9b3eaa9..6f5e8dd 100755 --- a/create-deb.sh +++ b/create-deb.sh @@ -4,16 +4,16 @@ 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/muscle generate-completions --shell bash > assets/completions/muscle.bash +./target/release/muscle generate-completions --shell zsh > assets/completions/_muscle +./target/release/muscle generate-completions --shell fish > assets/completions/muscle.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/muscle generate-completions --shell bash --command mysql-dbadm > assets/completions/mysql-dbadm.bash +./target/release/muscle generate-completions --shell zsh --command mysql-dbadm > assets/completions/_mysql-dbadm +./target/release/muscle 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 +./target/release/muscle generate-completions --shell bash --command mysql-useradm > assets/completions/mysql-useradm.bash +./target/release/muscle generate-completions --shell zsh --command mysql-useradm > assets/completions/_mysql-useradm +./target/release/muscle generate-completions --shell fish --command mysql-useradm > assets/completions/mysql-useradm.fish -cargo deb \ No newline at end of file +cargo deb diff --git a/example-config.toml b/example-config.toml index 70c425c..977bb47 100644 --- a/example-config.toml +++ b/example-config.toml @@ -1,11 +1,11 @@ -# This should go to `/etc/mysqladm/config.toml` +# This should go to `/etc/muscle/config.toml` [server] # The path to the socket where users can connect to the daemon. # # Note that this options gets ignored if you are using systemd socket activation -# (see `systemctl status mysqladm.socket`) -socket_path = "/run/mysqladm/mysqladm.sock" +# (see `systemctl status muscle.socket`) +socket_path = "/run/muscle/muscle.sock" [mysql] diff --git a/flake.nix b/flake.nix index fff9559..bde94b0 100644 --- a/flake.nix +++ b/flake.nix @@ -37,8 +37,8 @@ apps = let mkApp = program: { type = "app"; program = toString program; }; in forAllSystems (system: pkgs: _: { - mysqladm-rs = mkApp (lib.getExe self.packages.${system}.mysqladm-rs); - coverage = mkApp (pkgs.writeScript "mysqladm-rs-coverage" '' + muscle = mkApp (lib.getExe self.packages.${system}.muscle); + coverage = mkApp (pkgs.writeScript "muscle-coverage" '' ${lib.getExe pkgs.python3} -m http.server -d "${self.packages.${system}.coverage}/html/src" ''); vm = mkApp "${self.nixosConfigurations.vm.config.system.build.vm}/bin/run-nixos-vm"; @@ -59,18 +59,18 @@ }); overlays = { - default = self.overlays.mysqladm-rs; - mysqladm-rs = final: prev: { - inherit (self.packages.${prev.stdenv.hostPlatform.system}) mysqladm-rs; + default = self.overlays.muscle; + muscle = final: prev: { + inherit (self.packages.${prev.stdenv.hostPlatform.system}) muscle; }; - mysqladm-rs-crane = final: prev: { - mysqladm-rs = self.packages.${prev.stdenv.hostPlatform.system}.mysqladm-rs-crane; + muscle-crane = final: prev: { + muscle = self.packages.${prev.stdenv.hostPlatform.system}.muscle-crane; }; }; nixosModules = { - default = self.nixosModules.mysqladm-rs; - mysqladm-rs = import ./nix/module.nix; + default = self.nixosModules.muscle; + muscle = import ./nix/module.nix; }; packages = forAllSystems (system: pkgs: _: @@ -85,9 +85,9 @@ ]; }; in { - default = self.packages.${system}.mysqladm-rs-crane; - mysqladm-rs = pkgs.callPackage ./nix/default.nix { inherit cargoToml cargoLock src; }; - mysqladm-rs-crane = pkgs.callPackage ./nix/default.nix { + default = self.packages.${system}.muscle-crane; + muscle = pkgs.callPackage ./nix/default.nix { inherit cargoToml cargoLock src; }; + muscle-crane = pkgs.callPackage ./nix/default.nix { useCrane = true; inherit cargoToml cargoLock src craneLib; }; @@ -102,7 +102,7 @@ pkgs = import nixpkgs { system = "x86_64-linux"; overlays = [ - self.overlays.mysqladm-rs-crane + self.overlays.muscle-crane ]; }; modules = [ @@ -133,10 +133,10 @@ users.motd = '' ================================= - Welcome to the mysqladm-rs vm! + Welcome to the muscle vm! Try running: - ${config.services.mysqladm-rs.package.meta.mainProgram} + ${config.services.muscle.package.meta.mainProgram} Password for alice is 'foobar' Password for root is 'root' @@ -149,12 +149,12 @@ enable = true; package = pkgs.mariadb; }; - services.mysqladm-rs = { + services.muscle = { enable = true; createLocalDatabaseUser = true; }; - systemd.services."mysqladm@".environment.RUST_LOG = "debug"; + systemd.services."muscle".environment.RUST_LOG = "debug"; programs.vim = { enable = true; diff --git a/nix/default.nix b/nix/default.nix index 1c02ca6..2a2a4b6 100644 --- a/nix/default.nix +++ b/nix/default.nix @@ -25,11 +25,11 @@ buildFunction { nativeBuildInputs = [ installShellFiles ]; postInstall = let commands = lib.mapCartesianProduct ({ shell, command }: '' - "$out/bin/${mainProgram}" generate-completions --shell "${shell}" --command "${command}" > "$TMP/mysqladm.${shell}" - installShellCompletion "--${shell}" --cmd "${command}" "$TMP/mysqladm.${shell}" + "$out/bin/${mainProgram}" generate-completions --shell "${shell}" --command "${command}" > "$TMP/muscle.${shell}" + installShellCompletion "--${shell}" --cmd "${command}" "$TMP/muscle.${shell}" '') { shell = [ "bash" "zsh" "fish" ]; - command = [ "mysqladm" "mysql-dbadm" "mysql-useradm" ]; + command = [ "muscle" "mysql-dbadm" "mysql-useradm" ]; }; in lib.concatStringsSep "\n" commands; diff --git a/nix/module.nix b/nix/module.nix index 4d6c996..cf30130 100644 --- a/nix/module.nix +++ b/nix/module.nix @@ -1,24 +1,24 @@ { config, pkgs, lib, ... }: let - cfg = config.services.mysqladm-rs; + cfg = config.services.muscle; format = pkgs.formats.toml { }; in { - options.services.mysqladm-rs = { - enable = lib.mkEnableOption "Enable mysqladm-rs"; + options.services.muscle = { + enable = lib.mkEnableOption "Enable muscle"; - package = lib.mkPackageOption pkgs "mysqladm-rs" { }; + package = lib.mkPackageOption pkgs "muscle" { }; createLocalDatabaseUser = lib.mkOption { type = lib.types.bool; default = false; - description = "Create a local database user for mysqladm-rs"; + description = "Create a local database user for muscle"; }; logLevel = lib.mkOption { type = lib.types.enum [ "quiet" "error" "warn" "info" "debug" "trace" ]; default = "debug"; - description = "Log level for mysqladm-rs"; + description = "Log level for muscle"; apply = level: { "quiet" = "-q"; "error" = ""; @@ -37,8 +37,8 @@ in server = { socket_path = lib.mkOption { type = lib.types.path; - default = "/run/mysqladm/mysqladm.sock"; - description = "Path to the mysqladm socket"; + default = "/run/muscle/muscle.sock"; + description = "Path to the muscle socket"; }; }; @@ -60,7 +60,7 @@ in }; username = lib.mkOption { type = lib.types.str; - default = "mysqladm"; + default = "muscle"; description = "MySQL username"; }; passwordFile = lib.mkOption { @@ -79,12 +79,12 @@ in }; }; - config = lib.mkIf config.services.mysqladm-rs.enable { + config = lib.mkIf config.services.muscle.enable { environment.systemPackages = [ cfg.package ]; - environment.etc."mysqladm/config.toml".source = let + environment.etc."muscle/config.toml".source = let nullStrippedConfig = lib.filterAttrsRecursive (_: v: v != null) cfg.settings; - in format.generate "mysqladm-rs.conf" nullStrippedConfig; + in format.generate "muscle.conf" nullStrippedConfig; services.mysql.ensureUsers = lib.mkIf cfg.createLocalDatabaseUser [ { @@ -96,10 +96,10 @@ in } ]; - systemd.services."mysqladm" = { + systemd.services."muscle" = { description = "MySQL administration tool for non-admin users"; - restartTriggers = [ config.environment.etc."mysqladm/config.toml".source ]; - requires = [ "mysqladm.socket" ]; + restartTriggers = [ config.environment.etc."muscle/config.toml".source ]; + requires = [ "muscle.socket" ]; serviceConfig = { Type = "notify"; ExecStart = "${lib.getExe cfg.package} ${cfg.logLevel} server --systemd socket-activate"; @@ -108,12 +108,12 @@ in # Although this is a multi-instance unit, the constant `User` field is needed # for authentication via mysql's auth_socket plugin to work. - User = "mysqladm"; - Group = "mysqladm"; + User = "muscle"; + Group = "muscle"; DynamicUser = true; - ConfigurationDirectory = "mysqladm"; - RuntimeDirectory = "mysqladm"; + ConfigurationDirectory = "muscle"; + RuntimeDirectory = "muscle"; # This is required to read unix user/group details. PrivateUsers = false; @@ -166,7 +166,7 @@ in }; }; - systemd.sockets."mysqladm" = { + systemd.sockets."muscle" = { description = "MySQL administration tool for non-admin users"; wantedBy = [ "sockets.target" ]; socketConfig = { diff --git a/src/client/commands.rs b/src/client/commands.rs index 5de2718..875a865 100644 --- a/src/client/commands.rs +++ b/src/client/commands.rs @@ -88,15 +88,15 @@ pub enum ClientCommand { /// /// Enable privileges `SELECT`, `INSERT`, and `UPDATE` for user `my_user` on database `my_db`: /// - /// `mysqladm edit-db-privs -p my_db:my_user:siu` + /// `muscle edit-db-privs -p my_db:my_user:siu` /// /// Enable all privileges for user `my_other_user` on database `my_other_db`: /// - /// `mysqladm edit-db-privs -p my_other_db:my_other_user:A` + /// `muscle edit-db-privs -p my_other_db:my_other_user:A` /// /// Set miscellaneous privileges for multiple users on database `my_db`: /// - /// `mysqladm edit-db-privs my_db -p my_user:siu my_other_user:ct`` + /// `muscle edit-db-privs my_db -p my_user:siu my_other_user:ct`` /// #[command(verbatim_doc_comment)] EditDbPrivs(EditDbPrivsArgs), diff --git a/src/client/mysql_admutils_compatibility/mysql_dbadm.rs b/src/client/mysql_admutils_compatibility/mysql_dbadm.rs index d19b77c..4c6d0a7 100644 --- a/src/client/mysql_admutils_compatibility/mysql_dbadm.rs +++ b/src/client/mysql_admutils_compatibility/mysql_dbadm.rs @@ -52,8 +52,8 @@ The Y/N-values corresponds to the following mysql privileges: /// Create, drop or edit permissions for the DATABASE(s), /// as determined by the COMMAND. /// -/// This is a compatibility layer for the mysql-dbadm command. -/// Please consider using the newer mysqladm command instead. +/// This is a compatibility layer for the 'mysql-dbadm' command. +/// Please consider using the newer 'muscle' command instead. #[derive(Parser)] #[command( bin_name = "mysql-dbadm", @@ -93,7 +93,7 @@ pub struct Args { // NOTE: mysql-dbadm explicitly calls privileges "permissions". // This is something we're trying to move away from. -// See https://git.pvv.ntnu.no/Projects/mysqladm-rs/issues/29 +// See https://git.pvv.ntnu.no/Projects/muscle/issues/29 #[derive(Parser)] pub enum Command { /// create the DATABASE(s). diff --git a/src/client/mysql_admutils_compatibility/mysql_useradm.rs b/src/client/mysql_admutils_compatibility/mysql_useradm.rs index c17dbc3..02288cb 100644 --- a/src/client/mysql_admutils_compatibility/mysql_useradm.rs +++ b/src/client/mysql_admutils_compatibility/mysql_useradm.rs @@ -28,8 +28,8 @@ use crate::{ /// Create, delete or change password for the USER(s), /// as determined by the COMMAND. /// -/// This is a compatibility layer for the mysql-useradm command. -/// Please consider using the newer mysqladm command instead. +/// This is a compatibility layer for the 'mysql-useradm' command. +/// Please consider using the newer 'muscle' command instead. #[derive(Parser)] #[command( bin_name = "mysql-useradm", diff --git a/src/core/common.rs b/src/core/common.rs index aa1218c..02b24ed 100644 --- a/src/core/common.rs +++ b/src/core/common.rs @@ -4,8 +4,8 @@ use nix::unistd::{Group as LibcGroup, User as LibcUser}; #[cfg(not(target_os = "macos"))] use std::ffi::CString; -pub const DEFAULT_CONFIG_PATH: &str = "/etc/mysqladm/config.toml"; -pub const DEFAULT_SOCKET_PATH: &str = "/run/mysqladm/mysqladm.sock"; +pub const DEFAULT_CONFIG_PATH: &str = "/etc/muscle/config.toml"; +pub const DEFAULT_SOCKET_PATH: &str = "/run/muscle/muscle.sock"; pub struct UnixUser { pub username: String, diff --git a/src/main.rs b/src/main.rs index f302b63..0c77bec 100644 --- a/src/main.rs +++ b/src/main.rs @@ -37,7 +37,7 @@ mod core; /// You are only allowed to manage databases and users that are prefixed with /// either your username, or a group that you are a member of. #[derive(Parser, Debug)] -#[command(bin_name = "mysqladm", version, about, disable_help_subcommand = true)] +#[command(bin_name = "muscle", version, about, disable_help_subcommand = true)] struct Args { #[command(subcommand)] command: Command, @@ -83,14 +83,14 @@ struct GenerateCompletionArgs { #[arg(long, default_value = "bash")] shell: Shell, - #[arg(long, default_value = "mysqladm")] + #[arg(long, default_value = "muscle")] command: ToplevelCommands, } #[cfg(feature = "mysql-admutils-compatibility")] #[derive(ValueEnum, Debug, Clone)] enum ToplevelCommands { - Mysqladm, + Muscle, MysqlDbadm, MysqlUseradm, }