blob: 7cd7361bda92a81ad6f0b52b57c5af48a36d6e1a (
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
#!/bin/bash
cd "$(dirname "${0}")"
hash git wget
## PKGBUILD updater for bitwig-studio
## --------------------------------------------------------
## Checks for new releases by incrementing the current version number.
## Automatically commits changes if new version was found.
##
## Depends on: git semver pkgbuild-introspection
try_increment() {
## Reset to last known update
git reset --hard > /dev/null
## Get variables from PKGBUILD
source PKGBUILD
## Prepare version strings
local targetver="$(semver -i ${1} ${pkgver})"
local shortver="$(shorten_version "${targetver}")"
local targetrel="1"
echo "Trying version ${targetver}..."
## Update version strings
sed -i "s/pkgver='[0-9.]*'/pkgver='${targetver}'/" PKGBUILD
sed -i "s/_pkgver='[0-9.]*'/_pkgver='${shortver}'/" PKGBUILD
source PKGBUILD
## Remove previous downloads
rm -f *.deb *.pkg.*
## Download the package
wget -q --show-progress -O "${source[0]%%::*}" "${source[0]#*::}" || return
## Update checksum
local targetsum="$(sha256sum bitwig-studio-${shortver}.deb | cut -d ' ' -f 1)"
sed -i "s/sha256sums=('${sha256sums[0]}')/sha256sums=('${targetsum}')/" PKGBUILD
sed -i "s/pkgrel=.*/pkgrel='${targetrel}'/" PKGBUILD
## Build the package
makepkg -f || exit
makepkg --printsrcinfo > .SRCINFO || exit
## Publish the update
git add -A
git status
git commit -m "Update to ${targetver}"
echo "Done!"
exit
}
shorten_version() {
local x="$(echo "${1}" | cut -f1,2 -d.)"
[[ "${x}.0" == "${1}" ]] && echo "${x}" || echo "${1}"
}
## Reset to last known update
git reset --hard > /dev/null
## Try various versions
try_increment patch
try_increment minor
try_increment major
## Oh how sad...
echo "No new versions today :c"
## Reset to last known update
git reset --hard > /dev/null
|