-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathmkaur
executable file
·86 lines (78 loc) · 2.05 KB
/
mkaur
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
#!/usr/bin/env bash
#
# Written by: Chad Sharp
#
# Purpose: Ease the process of uploading packages to the AUR
#
#########################
helpmsg="${0##*/} [OPTIONS] FILES\n\n-h\t\tPrint this help message\n-u\t\tDon't upload the package to AUR\n-b\t\tDon't try building package before creating the src.tar.gz\n-4\t\tUpload to aur4.archlinux.org"
tmpdir=/tmp/mkaur
nobuild=0
aur3=0
noupload=0
aur4(){
mksrcinfo
local pkgname
eval $(grep "^pkgname=" "${tmpdir}/aurpkg/PKGBUILD")
mkdir -p "${tmpdir}/aur4-git"
git clone ssh+git://aur4.archlinux.org/${pkgname}.git "${tmpdir}/aur4-git"
shopt -s dotglob
mv ${tmpdir}/aurpkg/* ${tmpdir}/aur4-git/
cd "${tmpdir}/aur4-git"
git add *
if (( $noupload != 1 )); then
git commit
git push origin master
else
echo "Repo ready to be commited in $tmpdir/aur4-git"
fi
}
aur3(){
mkaurball
find "${tmpdir}/aurpkg/" -type f \( -not -name '*.src.tar.gz' \) -delete
if (( $noupload != 1 )); then
if which aurploader > /dev/null; then
aurploader -k -a -l ~/.config/aurploader
else
xdg-open https://aur.archlinux.org/submit/
fi
else
echo "Package located in $tmpdir/aurpkg"
fi
}
while [[ $(head -c 1 <<<"$1") == "-" ]]; do
case $1 in
-h) echo -e $helpmsg; exit 0 ;;
-u) noupload=1 ;;
-b) nobuild=1 ;;
-3) aur3=1 ;;
-*) echo "Unrecognized argument $1"; exit 1 ;;
esac
shift
done
if (( $# == 0 )); then
echo "ERROR: No arguments. Please specify the files you want to add to the AUR package (e.g. the PKGBUILD, .install script etc.)"
echo -e "\n$helpmsg"
exit 1
fi
if [[ -d "$tmpdir" ]]; then
rm -rf "$tmpdir"
fi
mkdir "$tmpdir"
cp "$@" "$tmpdir"
cd "$tmpdir"
if (( $nobuild == 0 )) ; then
makepkg -d
else
makepkg -o -d
fi || { echo "Build failed. Aborting"; exit 1; }
mkdir -p "$tmpdir/aurpkg"
for i in "${@##*/}"; do
mv "${tmpdir}/${i}" "${tmpdir}/aurpkg/${i}"
done
cd "${tmpdir}/aurpkg"
if (( $aur3 == 1 )); then
aur3
else
aur4
fi