summarylogtreecommitdiffstats
path: root/autoup.bash
blob: c362c4b8de751bb3f68281ebdd10ba9521832d5e (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
#!/bin/bash
if [ -z "$1" ]; then
    echo "You must specify the target version for the auto-update."
    exit 1
fi

echo "Trying to auto-update this package to version ${1} ..."

# Clean up
rm -rf pkg src discover-*

# Update the version in the PKGBUILD
sed -ri 's/pkgver=([0-9]+\.[0-9]+\.[0-9]+\.{0,1}[0-9]*)/pkgver='"${1}"'/' PKGBUILD 
if [ "$?" -ne 0 ]; then
    echo "Setting the version number in PKGBUILD failed."
    exit 1
fi

# Update the package sums in the PKGBUILD
updpkgsums
if [ "$?" -ne 0 ]; then
    echo "Updating the checksums failed."
    exit 1
fi

# Update .SRCINFO
makepkg --printsrcinfo > .SRCINFO
if [ "$?" -ne 0 ]; then
    echo "Recreating .SRCINFO failed."
    exit 1
fi

# Build & install the package
makepkg -si --noconfirm
if [ "$?" -ne 0 ]; then
    echo "Building and installing the package failed."
    exit 1
fi

echo "Autoupdate  successful. Ready to add, commit and push the changes."