aboutsummarylogtreecommitdiffstats
path: root/upd.sh
blob: 6345f4503de6e678752a9317d7f98992c6c3ce43 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/bin/sh

# Get new version info
URL=$(curl -H 'X-Ubuntu-Series: 16' https://api.snapcraft.io/api/v1/snaps/details/termius-beta | jq '.download_url' -r | cut -d "_" -f2)
VER=$(curl -H 'X-Ubuntu-Series: 16' https://api.snapcraft.io/api/v1/snaps/details/termius-beta | jq '.version' -r)

# Update PKGBUILD
sed -i "s/_[0-9]\+.snap/_$URL/g" PKGBUILD
sed -i "s/pkgver=.*$/pkgver=$VER/g" PKGBUILD 

# Calc new hash 
updpkgsums

# Build & install pkg
makepkg -si

# Update .SRCINFO
makepkg --printsrcinfo > .SRCINFO

# Git ops
git add .SRCINFO PKGBUILD
git commit -m "Update to $VER"

# Cleanup
rm -rf pkg/ src/ *.snap *.pkg.tar.zst

printf "\nAll done!\nRemember to git push!\n"