@@ -32,27 +32,33 @@ sed -i \
3232 -e ' s/^.*picture/#&/' /opt/slskd/config/slskd.yml
3333msg_ok " Configured Slskd"
3434
35- # read -rp "${TAB3}Do you want to install Soularr? y/N " soularr
36- # if [[ ${soularr,,} =~ ^(y|yes)$ ]]; then
37- # msg_info "Installing Dependencies"
38- # $STD apt install -y python3-pip
39- # msg_ok "Installed Dependencies"
40- # cd /opt/soularr
41- # $STD pip install -r requirements.txt
42- # sed -i \
43- # -e "\|[Slskd]|,\|host_url|s|yourslskdapikeygoeshere|$SLSKD_API_KEY|" \
44- # -e "/host_url/s/slskd/localhost/" \
45- # /opt/soularr/config.ini
46- # sed -i \
47- # -e "/#This\|#Default\|INTERVAL/{N;d;}" \
48- # -e "/while\|#Pass/d" \
49- # -e "\|python|s|app|opt/soularr|; s|python|python3|" \
50- # -e "/dt/,+2d" \
51- # /opt/soularr/run.sh
52- # sed -i -E "/(soularr.py)/s/.{5}$//; /if/,/fi/s/.{4}//" /opt/soularr/run.sh
53- # chmod +x /opt/soularr/run.sh
54- # msg_ok "Installed Soularr"
55- # fi
35+ read -rp " ${TAB3} Do you want to install Soularr? y/N " soularr
36+ if [[ ${soularr,,} =~ ^(y| yes)$ ]]; then
37+ PYTHON_VERSION=" 3.11" setup_uv
38+ fetch_and_deploy_gh_release " Soularr" " mrusse/soularr" " tarball" " latest" " /opt/soularr"
39+ cd /opt/soularr
40+ $STD uv venv venv
41+ $STD source venv/bin/activate
42+ $STD uv pip install -r requirements.txt
43+ sed -i \
44+ -e " \|[Slskd]|,\|host_url|s|yourslskdapikeygoeshere|$SLSKD_API_KEY |" \
45+ -e " /host_url/s/slskd/localhost/" \
46+ /opt/soularr/config.ini
47+ cat << EOF >/opt/soularr/run.sh
48+ #!/usr/bin/env bash
49+
50+ if ps aux | grep "[s]oularr.py" >/dev/null; then
51+ echo "Soularr is already running. Exiting..."
52+ exit 1
53+ else
54+ source /opt/soularr/venv/bin/activate
55+ uv run python3 -u /opt/soularr/soularr.py --config-dir /opt/soularr
56+ fi
57+ EOF
58+ chmod +x /opt/soularr/run.sh
59+ deactivate
60+ msg_ok " Installed Soularr"
61+ fi
5662
5763msg_info " Creating Service"
5864cat << EOF >/etc/systemd/system/slskd.service
@@ -70,38 +76,38 @@ Restart=always
7076WantedBy=multi-user.target
7177EOF
7278
73- # if [[ -d /opt/soularr ]]; then
74- # cat <<EOF >/etc/systemd/system/soularr.timer
75- # [Unit]
76- # Description=Soularr service timer
77- # RefuseManualStart=no
78- # RefuseManualStop=no
79- #
80- # [Timer]
81- # Persistent=true
82- # # run every 5 minutes
83- # OnCalendar=*-*-* *:0/5 :00
84- # Unit=soularr.service
85- #
86- # [Install]
87- # WantedBy=timers.target
88- # EOF
89- #
90- # cat <<EOF >/etc/systemd/system/soularr.service
91- # [Unit]
92- # Description=Soularr service
93- # After=network.target slskd.service
94- #
95- # [Service]
96- # Type=simple
97- # WorkingDirectory=/opt/soularr
98- # ExecStart=/bin/bash -c /opt/soularr/run.sh
99- #
100- # [Install]
101- # WantedBy=multi-user.target
102- # EOF
103- # msg_warn "Add your Lidarr API key to Soularr in '/opt/soularr/config.ini', then run 'systemctl enable --now soularr.timer'"
104- # fi
79+ if [[ -d /opt/soularr ]]; then
80+ cat << EOF >/etc/systemd/system/soularr.timer
81+ [Unit]
82+ Description=Soularr service timer
83+ RefuseManualStart=no
84+ RefuseManualStop=no
85+
86+ [Timer]
87+ Persistent=true
88+ # run every 10 minutes
89+ OnCalendar=*-*-* *:0/10 :00
90+ Unit=soularr.service
91+
92+ [Install]
93+ WantedBy=timers.target
94+ EOF
95+
96+ cat << EOF >/etc/systemd/system/soularr.service
97+ [Unit]
98+ Description=Soularr service
99+ After=network.target slskd.service
100+
101+ [Service]
102+ Type=simple
103+ WorkingDirectory=/opt/soularr
104+ ExecStart=/bin/bash -c /opt/soularr/run.sh
105+
106+ [Install]
107+ WantedBy=multi-user.target
108+ EOF
109+ msg_warn " Add your Lidarr API key to Soularr in '/opt/soularr/config.ini', then run 'systemctl enable --now soularr.timer'"
110+ fi
105111systemctl enable -q --now slskd
106112msg_ok " Created Services"
107113
0 commit comments