update_slskd.sh 564 B

12345678910111213
  1. #!/bin/bash
  2. current_version=`/opt/slskd/slskd -v | cut -d '+' -f 1`
  3. latest_version=`curl -s https://api.github.com/repos/slskd/slskd/releases/latest | grep 'tag_name' | cut -d '"' -f 4`
  4. if [[ $current_version =~ $latest_version ]]; then
  5. echo "Up-to-date"
  6. else
  7. systemctl stop slskd.service
  8. wget `curl -s https://api.github.com/repos/slskd/slskd/releases/latest | grep 'browser_download_url.*linux-x64' | cut -d '"' -f 4` -O /tmp/slskd.zip
  9. unzip -o /tmp/slskd.zip -d /opt/slskd
  10. rm /tmp/slskd.zip
  11. # user permissions or whatever
  12. systemctl start slskd.service
  13. fi