A tiny Subsonic/Jellyfin/S3 server in Rust
navidrome
subsonic
s3
emby
jellyfin
1Name: smolsonic
2Version: 0.10.0
3Release: 1%{?dist}
4Summary: A tiny Subsonic-compatible music server written in Rust
5
6License: MIT
7URL: https://github.com/tsirysndr/smolsonic
8
9BuildArch: aarch64
10
11Requires: glibc
12
13%description
14smolsonic is a self-contained Subsonic-compatible music server. Point it at
15a folder of music, give it a username and a password in a TOML file, and any
16Subsonic client can browse and stream your library. Ships an optional
17S3-compatible upload API and an embedded admin web UI.
18
19%prep
20# Prepare the build environment
21
22%build
23# Build steps (if any)
24
25%install
26mkdir -p %{buildroot}/usr/local/bin
27mkdir -p %{buildroot}/usr/share/smolsonic
28mkdir -p %{buildroot}/usr/lib/systemd/user
29cp -r %{_sourcedir}/arm64/usr %{buildroot}/
30
31%files
32/usr/local/bin/smolsonic
33/usr/share/smolsonic/smolsonic.example.toml
34/usr/lib/systemd/user/smolsonic.service
35
36%post
37EXAMPLE_CFG=/usr/share/smolsonic/smolsonic.example.toml
38
39if [ "$1" -eq 1 ]; then
40 # Fresh install
41 if [ -n "${SUDO_USER:-}" ] && [ "$SUDO_USER" != "root" ]; then
42 USER_HOME=$(getent passwd "$SUDO_USER" | cut -d: -f6)
43 USER_UID=$(id -u "$SUDO_USER" 2>/dev/null)
44 if [ -n "$USER_UID" ]; then
45 sudo -u "$SUDO_USER" mkdir -p \
46 "$USER_HOME/.config/smolsonic" \
47 "$USER_HOME/.local/share/smolsonic" || :
48
49 if [ ! -f "$USER_HOME/.config/smolsonic/smolsonic.toml" ] && [ -f "$EXAMPLE_CFG" ]; then
50 sudo -u "$SUDO_USER" cp "$EXAMPLE_CFG" "$USER_HOME/.config/smolsonic/smolsonic.toml" || :
51 echo "smolsonic: wrote example config to $USER_HOME/.config/smolsonic/smolsonic.toml"
52 fi
53
54 sudo -u "$SUDO_USER" XDG_RUNTIME_DIR=/run/user/$USER_UID \
55 systemctl --user daemon-reload &> /dev/null || :
56
57 echo "smolsonic: edit ~/.config/smolsonic/smolsonic.toml, then start with:"
58 echo " systemctl --user enable --now smolsonic.service"
59 fi
60 else
61 systemctl daemon-reload &> /dev/null || :
62 echo "smolsonic: each user can enable the service with:"
63 echo " systemctl --user enable --now smolsonic.service"
64 fi
65fi
66
67%preun
68if [ "$1" -eq 0 ]; then
69 # Uninstall (not upgrade)
70 if [ -n "${SUDO_USER:-}" ] && [ "$SUDO_USER" != "root" ]; then
71 USER_UID=$(id -u "$SUDO_USER" 2>/dev/null)
72 if [ -n "$USER_UID" ]; then
73 sudo -u "$SUDO_USER" XDG_RUNTIME_DIR=/run/user/$USER_UID systemctl --user stop smolsonic.service &> /dev/null || :
74 sudo -u "$SUDO_USER" XDG_RUNTIME_DIR=/run/user/$USER_UID systemctl --user disable smolsonic.service &> /dev/null || :
75 fi
76 fi
77fi
78
79%postun
80if [ "$1" -eq 0 ]; then
81 # Uninstall (not upgrade)
82 if [ -n "${SUDO_USER:-}" ] && [ "$SUDO_USER" != "root" ]; then
83 USER_UID=$(id -u "$SUDO_USER" 2>/dev/null)
84 if [ -n "$USER_UID" ]; then
85 sudo -u "$SUDO_USER" XDG_RUNTIME_DIR=/run/user/$USER_UID systemctl --user daemon-reload &> /dev/null || :
86 fi
87 fi
88fi