forked from cmlsharp/bin
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmkaur
More file actions
executable file
·56 lines (52 loc) · 1.41 KB
/
mkaur
File metadata and controls
executable file
·56 lines (52 loc) · 1.41 KB
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
#!/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-n\t\tDon't try building package before creating the src.tar.gz"
tmpdir=/tmp/mkaur
nobuild=0
noupload=0
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
while getopts "hnb" OPT; do
case $OPT in
h) echo -e $helpmsg; exit 0 ;;
u) noupload=1; shift;;
b) nobuild=1; shift;;
*) echo "Unrecognized argument"; exit 1 ;;
esac
done
if (( $# == 0 )); then
echo "This script requires arguments (the files you want to package)"
exit 1
fi
if [[ -d "$tmpdir" ]]; then
rm -rf "$tmpdir"
fi
mkdir "$tmpdir"
cp "$@" "$tmpdir"
cd "$tmpdir"
if [[ $nobuild == 0 ]] ; then
makepkg -d || { echo "Build failed. Aborting"; exit 1; }
fi
mkdir -p "$tmpdir/aurpkg"
for i in "${@##*/}"; do
mv "${tmpdir}/${i}" "${tmpdir}/aurpkg/${i}"
done
cd "${tmpdir}/aurpkg"
mkaurball
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