Преглед на файлове

Add update_gotosocial.sh

poesty преди 11 месеца
родител
ревизия
a7c2c36214
променени са 1 файла, в които са добавени 13 реда и са изтрити 0 реда
  1. 13 0
      update/update_gotosocial.sh

+ 13 - 0
update/update_gotosocial.sh

@@ -0,0 +1,13 @@
+#!/bin/bash
+current_version=v`/gotosocial/gotosocial -v | cut -d ' ' -f 3`
+latest_version=`curl -s https://api.github.com/repos/superseriousbusiness/gotosocial/releases/latest | grep 'tag_name' | cut -d '"' -f 4`
+if [ "$current_version" != "$latest_version" ]; then
+	systemctl stop gotosocial.service
+	wget `curl -s https://api.github.com/repos/superseriousbusiness/gotosocial/releases/latest | grep 'browser_download_url.*linux_amd64' | cut -d '"' -f 4` -O /tmp/gotosocial.tar.gz
+	tar -xvzf /tmp/gotosocial.tar.gz -C /gotosocial
+	rm /tmp/gotosocial.tar.gz
+	# user permissions or whatever
+	systemctl start gotosocial.service
+else
+	echo "Up-to-date"
+fi