update_slskd.sh 581 B

1234567891011121314
  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. rm -r /opt/slskd/*
  9. 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
  10. unzip /tmp/slskd.zip -d /opt/slskd
  11. rm /tmp/slskd.zip
  12. # user permissions or whatever
  13. systemctl start slskd.service
  14. fi