-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathaurpublish
executable file
·79 lines (70 loc) · 1.92 KB
/
aurpublish
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
#!/bin/bash
#### Declare usage
usage()
{
cat <<- _EOF_
Usage: ./aurpublish [OPTIONS] PACKAGE
Push a subtree to the AUR
OPTIONS
-n, --new register package for the first time
-a, --adopt instead of publishing, pull an exisisting package
into a new subtree
-s, --speedup speedup future publishing by recording the subtree
history during a push. This creates a merge commit
and an extra copy of all commits in the subtree.
For more details, see the "--rejoin" option in git
subtree.
-h, --help show this usage message
_EOF_
}
#### Do the great option check
if [[ $# -eq 0 ]]; then
echo "error: No arguments passed. aurpublish needs a package to upload."
exit 1
fi
while [[ "${1}" != "" ]]; do
case ${1} in
-h|--help)
usage
exit
;;
-n|--new)
new=1
;;
-a|--adopt)
adopt=1
shift
package="${1}"
;;
-s|--speedup)
speedup=1
;;
*)
if [[ -d "${1}" ]]; then
package="${1%/}"
else
echo "${0}: unrecognized package '${1}'"
echo "Try '${0} --help' for more information."
exit 1
fi
esac
shift
done
#### MAIN
if [[ "${adopt}" = "1" ]]; then
git subtree add -P "${package}" aur:/${package}.git master
exit 0
fi
# push to legacy AUR. Remove this when AUR 4.0 takes over.
burp ${package}/*.src.tar.gz
if [[ "$?" = "1" ]]; then
echo "Failed to upload aurball. Aborting push..."
exit 1
fi
if [[ "${new}" = "1" ]]; then
ssh aur setup-repo ${package}
fi
if [[ "${speedup}" = "1" ]]; then
git subtree split -P "${package}" --rejoin
fi
git subtree push -P "${package}" aur:/${package}.git master