summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authortheRealPadster2023-10-05 17:33:05 -0400
committertheRealPadster2023-10-05 17:33:05 -0400
commit1bef23fe03cb7bb91e571d4948e94312d6ca6b32 (patch)
tree76cc99ddccae5d2133ea08588cfe033d12e1b63c
parentfb27a4cbd7878b2dc261abf58e2f9bbf02356af0 (diff)
downloadaur-1bef23fe03cb7bb91e571d4948e94312d6ca6b32.tar.gz
Add pull-snapcraft script for easy package updating
-rwxr-xr-xpull-snapcraft.sh28
1 files changed, 28 insertions, 0 deletions
diff --git a/pull-snapcraft.sh b/pull-snapcraft.sh
new file mode 100755
index 000000000000..c87102f173f8
--- /dev/null
+++ b/pull-snapcraft.sh
@@ -0,0 +1,28 @@
+#! /bin/bash
+
+# get latest snap json
+json=$(curl -s -H 'Snap-Device-Series: 16' http://api.snapcraft.io/v2/snaps/info/spotify);
+
+# pull out url
+url=$(echo $json | jq '."channel-map" | map(select(.channel.architecture == "amd64" and .channel.name == "edge")) | .[0].download.url');
+# remove quote marks from beginning and end of url
+url=${url:1:-1}
+
+# pull out version
+version=$(echo $json | jq '."channel-map" | map(select(.channel.architecture == "amd64" and .channel.name == "edge")) | .[0].version');
+# remove quote marks from beginning and end of url
+version=${version:1:-1}
+# extract commit id from the end
+commit=$(echo $version | cut -d '.' -f5);
+# extract the main version number
+version=$(echo $version | cut -d '.' -f1-4);
+
+# download file
+wget --header='Snap-Device-Series: 16' -O /tmp/spotify.snap $url;
+sum=$(sha512sum /tmp/spotify.snap | cut -d ' ' -f1);
+
+# output the fields that need to be updated
+echo "url=$url";
+echo "version=$version";
+echo "commit=$commit";
+echo "sum=$sum";