From cb5b29e924cdc69556637f9fca4ddfc21d465f4e Mon Sep 17 00:00:00 2001 From: Jamie Hewitt Date: Tue, 27 Jan 2026 21:51:35 +0000 Subject: [PATCH] Add one-line install script and simplify README installation section Co-Authored-By: Claude Opus 4.5 --- README.md | 70 +++++++----------------------------------------------- install.sh | 48 +++++++++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+), 62 deletions(-) create mode 100755 install.sh diff --git a/README.md b/README.md index ec2c8c5..a50551e 100644 --- a/README.md +++ b/README.md @@ -47,79 +47,25 @@ Build dependencies (needed to compile from source): | **pkg-config** | `pkgconf` | `pkgconf-pkg-config` | `pkg-config` | | **D-Bus dev headers** | `dbus` | `dbus-devel` | `libdbus-1-dev` | -### Arch Linux +### Quick Install + +Supports Arch, Fedora, and Debian/Ubuntu. Installs dependencies, Rust (if needed), builds from source, and installs to `/usr/local/bin/`: ```bash -# Install runtime dependencies -sudo pacman -S mpv pipewire wireplumber - -# Install build dependencies -sudo pacman -S base-devel pkgconf dbus - -# Build from source -git clone https://github.com/jaidaken/ferrosonic.git -cd ferrosonic -cargo build --release - -# Binary is at target/release/ferrosonic -sudo cp target/release/ferrosonic /usr/local/bin/ +curl -sSf https://gitea.jaidaken.dev/jaidaken/ferrosonic/raw/branch/master/install.sh | sh ``` -### Fedora +### Manual Build + +If you prefer to build manually, install the dependencies listed above, then: ```bash -# Install runtime dependencies -sudo dnf install mpv pipewire wireplumber - -# Install build dependencies -sudo dnf install gcc pkgconf-pkg-config dbus-devel - -# Install Rust toolchain if not already installed -curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh - -# Build from source -git clone https://github.com/jaidaken/ferrosonic.git +git clone https://gitea.jaidaken.dev/jaidaken/ferrosonic.git cd ferrosonic cargo build --release sudo cp target/release/ferrosonic /usr/local/bin/ ``` -### Ubuntu / Debian - -```bash -# Install runtime dependencies -sudo apt install mpv pipewire wireplumber - -# Install build dependencies -sudo apt install build-essential pkg-config libdbus-1-dev - -# Install Rust toolchain if not already installed -curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh - -# Build from source -git clone https://github.com/jaidaken/ferrosonic.git -cd ferrosonic -cargo build --release -sudo cp target/release/ferrosonic /usr/local/bin/ -``` - -### Generic (any Linux distribution) - -Ensure `mpv` is installed and available in your `PATH`. PipeWire is optional but required for automatic sample rate switching. - -```bash -# Install Rust toolchain -curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh - -# Build -git clone https://github.com/jaidaken/ferrosonic.git -cd ferrosonic -cargo build --release - -# Install -sudo cp target/release/ferrosonic /usr/local/bin/ -``` - ## Usage ```bash diff --git a/install.sh b/install.sh new file mode 100755 index 0000000..c7a53db --- /dev/null +++ b/install.sh @@ -0,0 +1,48 @@ +#!/bin/sh +set -e + +REPO="https://gitea.jaidaken.dev/jaidaken/ferrosonic.git" +INSTALL_DIR="/usr/local/bin" + +echo "Ferrosonic installer" +echo "====================" + +# Detect package manager and install dependencies +if command -v pacman >/dev/null 2>&1; then + echo "Detected Arch Linux" + sudo pacman -S --needed --noconfirm mpv pipewire wireplumber base-devel pkgconf dbus +elif command -v dnf >/dev/null 2>&1; then + echo "Detected Fedora" + sudo dnf install -y mpv pipewire wireplumber gcc pkgconf-pkg-config dbus-devel +elif command -v apt >/dev/null 2>&1; then + echo "Detected Debian/Ubuntu" + sudo apt update + sudo apt install -y mpv pipewire wireplumber build-essential pkg-config libdbus-1-dev +else + echo "Unknown package manager. Please install manually: mpv, pipewire, wireplumber, pkg-config, dbus dev headers" + echo "Then re-run this script." + exit 1 +fi + +# Install Rust if not present +if ! command -v cargo >/dev/null 2>&1; then + echo "Installing Rust toolchain..." + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y + . "$HOME/.cargo/env" +fi + +# Clone and build +TMPDIR=$(mktemp -d) +echo "Building ferrosonic..." +git clone "$REPO" "$TMPDIR/ferrosonic" +cd "$TMPDIR/ferrosonic" +cargo build --release + +# Install +sudo cp target/release/ferrosonic "$INSTALL_DIR/ferrosonic" +echo "" +echo "Ferrosonic installed to $INSTALL_DIR/ferrosonic" +echo "Run 'ferrosonic' to start." + +# Cleanup +rm -rf "$TMPDIR"