Update slskd-install.sh

This commit is contained in:
CanbiZ 2025-06-04 09:21:38 +02:00
parent 7e8083f98c
commit 2da5f5e842

View File

@ -18,8 +18,8 @@ PYTHON_VERSION="3.12" setup_uv
msg_info "Setup ${APPLICATION}" msg_info "Setup ${APPLICATION}"
tmp_file=$(mktemp) tmp_file=$(mktemp)
RELEASE=$(curl -s https://api.github.com/repos/slskd/slskd/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }') RELEASE=$(curl -s https://api.github.com/repos/slskd/slskd/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
curl -fsSL "https://github.com/slskd/slskd/releases/download/${RELEASE}/slskd-${RELEASE}-linux-x64.zip" -o $tmp_file curl -fsSL "https://github.com/slskd/slskd/releases/download/${RELEASE}/slskd-${RELEASE}-linux-x64.zip" -o "$tmp_file"
$STD unzip $tmp_file -d /opt/${APPLICATION} $STD unzip "$tmp_file" -d /opt/${APPLICATION}
echo "${RELEASE}" >/opt/${APPLICATION}_version.txt echo "${RELEASE}" >/opt/${APPLICATION}_version.txt
JWT_KEY=$(openssl rand -base64 44) JWT_KEY=$(openssl rand -base64 44)
SLSKD_API_KEY=$(openssl rand -base64 44) SLSKD_API_KEY=$(openssl rand -base64 44)
@ -42,8 +42,8 @@ curl -fsSL -o main.zip https://github.com/mrusse/soularr/archive/refs/heads/main
$STD unzip main.zip $STD unzip main.zip
mv soularr-main /opt/soularr mv soularr-main /opt/soularr
cd /opt/soularr cd /opt/soularr
$STD uv venv /opt/soularr/venv $STD uv venv /opt/soularr/.venv
$STD /opt/soularr/venv/bin/uv pip install -r requirements.txt $STD /opt/soularr/.venv/bin/uv pip install -r requirements.txt
sed -i \ sed -i \
-e "\|[Slskd]|,\|host_url|s|yourslskdapikeygoeshere|$SLSKD_API_KEY|" \ -e "\|[Slskd]|,\|host_url|s|yourslskdapikeygoeshere|$SLSKD_API_KEY|" \
-e "/host_url/s/slskd/localhost/" \ -e "/host_url/s/slskd/localhost/" \
@ -51,7 +51,7 @@ sed -i \
sed -i \ sed -i \
-e "/#This\|#Default\|INTERVAL/{N;d;}" \ -e "/#This\|#Default\|INTERVAL/{N;d;}" \
-e "/while\|#Pass/d" \ -e "/while\|#Pass/d" \
-e "\|python|s|app|opt/soularr|; s|python|/opt/soularr/venv/bin/python3|" \ -e "\|python|s|app|opt/soularr|; s|python|/opt/soularr/.venv/bin/python3|" \
-e "/dt/,+2d" \ -e "/dt/,+2d" \
/opt/soularr/run.sh /opt/soularr/run.sh
sed -i -E "/(soularr.py)/s/.{5}$//; /if/,/fi/s/.{4}//" /opt/soularr/run.sh sed -i -E "/(soularr.py)/s/.{5}$//; /if/,/fi/s/.{4}//" /opt/soularr/run.sh
@ -82,7 +82,6 @@ RefuseManualStop=no
[Timer] [Timer]
Persistent=true Persistent=true
# run every 5 minutes
OnCalendar=*-*-* *:0/5:00 OnCalendar=*-*-* *:0/5:00
Unit=soularr.service Unit=soularr.service
@ -104,7 +103,7 @@ ExecStart=/bin/bash -c /opt/soularr/run.sh
WantedBy=multi-user.target WantedBy=multi-user.target
EOF EOF
systemctl enable -q --now ${APPLICATION} systemctl enable -q --now soularr
systemctl enable -q soularr.timer systemctl enable -q soularr.timer
msg_ok "Created Services" msg_ok "Created Services"
@ -112,8 +111,7 @@ motd_ssh
customize customize
msg_info "Cleaning up" msg_info "Cleaning up"
rm -f $tmp_file rm -f "$tmp_file" /tmp/main.zip
rm -f /tmp/main.zip
$STD apt-get -y autoremove $STD apt-get -y autoremove
$STD apt-get -y autoclean $STD apt-get -y autoclean
msg_ok "Cleaned" msg_ok "Cleaned"