# This file is a part of RSPlayer # Licensed under the GPL-3.0 License # Copyright (C) 2026 Salmonik @ salmonik@tuta.io # https://codeberg.org/salmonik/RSPlayer #!/bin/bash set -e echo "Updating the repo..." git pull 2>/dev/null echo "Building rsplayer in release mode..." cargo build --release echo "Stopping existing daemon..." systemctl --user stop rsplayer 2>/dev/null || true rsp stop-daemon 2>/dev/null || true echo "Installing to /usr/bin/rsp..." sudo cp target/release/rsp /usr/bin/rsp sudo chmod +x /usr/bin/rsp echo "" echo "Installing systemd service..." mkdir -p ~/.config/systemd/user cp rsplayer.service ~/.config/systemd/user/ if systemctl --user is-active default.target &>/dev/null; then systemctl --user daemon-reload echo "Activating the daemon…" systemctl --user restart --now rsplayer.service else echo "Service installed but not enabled (no user session running)" echo "To enable later when logged in: systemctl --user enable rsplayer" fi echo "" echo "Installing shell completions..." shell_name=$(basename "${SHELL:-}") case "$shell_name" in bash) dest="${XDG_DATA_HOME:-$HOME/.local/share}/bash-completion/completions" mkdir -p "$dest" /usr/bin/rsp completions bash > "$dest/rsp" echo " → Bash completions: $dest/rsp" ;; zsh) dest="/usr/share/zsh/site-functions/_rsp" (/usr/bin/rsp completions zsh; echo; cat completions/_rsp) | sudo tee "$dest" > /dev/null echo " → Zsh completions: $dest" ;; fish) dest="$HOME/.config/fish/completions/rsp.fish" mkdir -p "$(dirname "$dest")" /usr/bin/rsp completions fish > "$dest" echo " → Fish completions: $dest" ;; *) echo " → Unrecognized shell '$shell_name'; generate with: rsp completions " ;; esac echo "" echo "Done!"