blob: a44bd846ada82340f2f9ef95383fd4500914ded7 (
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
|
#! /bin/bash
# This file is part of https://aur.archlinux.org/packages/mkinitcpio-systemd-tool/
# build package automation
# create .PKGREL file to auto-bump PKGBUILD pkgver to latest release version
readonly location=$(cd "$(dirname "${BASH_SOURCE[0]}" )" && pwd)
source $location/PKGBUILD
is_root() {
[[ $(id -u) == 0 ]]
}
has_makepkg() {
which makepkg >/dev/null 2>&1
}
do_provision() {
if has_makepkg ; then
do_provision_proper
else
do_provision_simple
fi
}
do_provision_proper() {
echo "// do_provision_proper"
local suno=""
if is_root ; then
chown -R nobody $location
suno="sudo -u nobody"
fi
$suno makepkg --force
}
do_provision_simple() {
echo "// do_provision_simple"
local source="$url.git"
if [[ -e $pkgname ]] ; then
git -C $pkgname pull
else
git clone $source
fi
}
do_version() {
echo "version $pkgver -> $(pkgver)"
if has_makepkg; then
do_version_proper
else
do_version_simple
fi
}
do_version_simple() {
echo "// do_version_simple"
local pkgver=$(pkgver)
local file_list="PKGBUILD .SRCINFO"
local file
for file in $file_list ; do
sed -r -i "s%^([ ]*pkgver[ ]*=[ ]*).*%\1$pkgver%" "$file"
sed -r -i "s%#tag=v[0-9]+%#tag=v$pkgver%" "$file"
done
}
do_version_proper() {
echo "// do_version_proper"
local suno=""
local user="nobody"
if is_root ; then
chown -R $user $location
suno="sudo -u $user"
fi
$suno makepkg --printsrcinfo > .SRCINFO
}
do_commit() {
echo "// do_commit"
git add --all :/
git status
local message=$(git status --short)
git commit --message "$message"
git push
}
do_clean() {
echo "// clean"
rm -rf "$location/$pkgname"
rm -rf "$location/src"
rm -rf "$location/pkg"
}
###
#set -e
do_provision
do_version
do_commit
do_clean
|