aboutsummaryrefslogtreecommitdiffstats
path: root/upload
blob: d5808288d154e818a8da269ecf5d85a4ae07c136 (plain) (blame)
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
#!/bin/bash

set -e

cd "$(dirname "${0}")"

makepkg --install --clean

newpkg=0
pkgname="$(. PKGBUILD && echo "${pkgname}")"
pkgver="$(. PKGBUILD && echo "${pkgver}")"
pkgrel="$(pkgrel=1 && . PKGBUILD && echo "${pkgrel}")"
epoch="$(epoch=0 && . PKGBUILD && echo "${epoch}")"
install="$(install="" && . PKGBUILD && echo "${install}")"

if [ ! -d .aur ]; then
    newpkg=1
    git clone "ssh://aur@aur4.archlinux.org/${pkgname}.git" .aur
fi

version="${pkgver}"
if [ ! "${epoch}" = 0 ]; then
    version="${epoch}:${version}"
fi
if [ ! "${pkgrel}" = 1 ]; then
    version="${version}-${pkgrel}"
fi

cp PKGBUILD .aur
if [ ! "${install}" = "" ]; then
    cp "${install}" .aur
    cd .aur
    git add "${install}"
    cd ..
fi

(
    . PKGBUILD
    cd .aur
    for file in "${source[@]}"; do
	if [ -f ../"${file}" ]; then
	    cp ../"${file}" .
	    git add "${file}"
	fi
    done
    cd ..
)

cd .aur

mksrcinfo
git add PKGBUILD .SRCINFO

if [ ${newpkg} = 1 ]; then
    git commit -m "Initial import, version ${version}"
    git push origin master
elif [ ! "${pkgrel}" = 1 ]; then
    git commit -m "Update package release to ${version}"
    git push
else
    git commit -m "Update to ${version}"
    git push
fi