blob: 41241b27313b560680d2873481648ad2e596113d (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
|
#!/bin/sh
# 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
set -e
if ping -W 2 -c 1 codeberg.org >/dev/null 2>&1; then
echo "Updating the repo..."
git pull 2>/dev/null
fi
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
if [ "$(uname -s)" = "FreeBSD" ]; then
BIN="/usr/local/bin/rsp"
echo "Installing to ${BIN}..."
sudo install target/release/rsp "${BIN}"
echo ""
echo "Installing rc.d service..."
sudo install -m 755 rsplayer.rc /usr/local/etc/rc.d/rsplayer
echo "Activating the rc.d service for user ${USER}..."
sudo sysrc rsplayer_enable=YES
sudo sysrc rsplayer_user="$USER"
sudo service rsplayer start
elif [ "$(uname -s)" = "Linux" ]; then
BIN="/usr/bin/rsp"
echo "Installing to ${BIN}..."
sudo install target/release/rsp "${BIN}"
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 2>&1; 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
fi
echo ""
echo "Installing shell completions (only for shells that are installed)..."
found=0
if command -v bash >/dev/null 2>&1; then
dest="${XDG_DATA_HOME:-$HOME/.local/share}/bash-completion/completions"
mkdir -p "$dest"
"${BIN}" completions bash > "$dest/rsp"
echo " → Bash completions: $dest/rsp"
found=1
fi
if command -v zsh >/dev/null 2>&1; then
if [ "$(uname -s)" = "FreeBSD" ]; then
dest="/usr/local/share/zsh/site-functions/_rsp"
else
dest="/usr/share/zsh/site-functions/_rsp"
fi
tmpfile=$(mktemp)
"${BIN}" completions zsh > "$tmpfile"
cat completions/_rsp >> "$tmpfile"
sudo cp "$tmpfile" "$dest"
rm -f "$tmpfile"
echo " → Zsh completions: $dest"
found=1
fi
if command -v fish >/dev/null 2>&1; then
dest="$HOME/.config/fish/completions/rsp.fish"
mkdir -p "$(dirname "$dest")"
"${BIN}" completions fish > "$dest"
echo " → Fish completions: $dest"
found=1
fi
if [ "$found" -eq 0 ]; then
echo " → No supported shell (bash/zsh/fish) found; generate manually with: rsp completions <bash|zsh|fish|powershell|elvish>"
fi
echo ""
echo "Done!"
|