summarylogtreecommitdiffstats
path: root/upgrade.sh
blob: f538853f3fe7b44748d282f9a03a0007a1a7d73a (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
#!/bin/bash
# author: amF6enRpY2tldHNAZ21haWwuY29tCg==

# get new version
pacman -Q | grep sqlite
echo "Enter new version: "
read -r version

# check version
if [ -z "$version" ]; then
	echo "No version specified"
	exit 1
fi

# clean
rm -f sqlite-autoconf-*.tar.gz

# get download url
url_version="${version/\./}"
url_version="${url_version/\./0}00"
url="https://www.sqlite.org/2024/sqlite-autoconf-${url_version}.tar.gz"
echo "$url"

# download source
if ! wget "$url"; then
	echo "Failed to download new version!"
	exit 1
fi

# get checksum
checksum=$(sha256sum "sqlite-autoconf-${url_version}.tar.gz" | cut -f1 -d ' ')
if [ -z "$checksum" ]; then
	echo "Bad sha256sum!"
	exit 1
fi

echo "$checksum"

# update PKGBUILD
sed -i "s/pkgver=.*/pkgver=$version/" PKGBUILD
sed -i "s/_amalgamationver=.*/_amalgamationver=$url_version/" PKGBUILD
sed -i "s/sha256sums=(.*)/sha256sums=('$checksum')/" PKGBUILD

# build
makepkg --printsrcinfo > .SRCINFO
makepkg -s