Skip to content

@pyropeter /aurupload.sh
Last active

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
AUR upload helper script
#!/bin/bash
set -u
set -e
declare -A categorys
categorys[daemons]=2
categorys[devel]=3
categorys[editors]=4
categorys[emulators]=5
categorys[games]=6
categorys[gnome]=7
categorys[i18n]=8
categorys[kde]=9
categorys[kernels]=19
categorys[lib]=10
categorys[modules]=11
categorys[multimedia]=12
categorys[network]=13
categorys[office]=14
categorys[science]=15
categorys[system]=16
categorys[x11]=17
categorys[xfce]=18
verbose=0
if [ "${1:-}" == "-v" ]; then
verbose=1
shift 1
fi
if [ $# -lt 3 ]; then
echo "Usage: aurupload <user> <pass> [<category>] <path to src-pkg>"
echo "Valid categorys are: ${!categorys[*]}"
echo "If pass is -, aurupload asks interactively."
exit 1
fi
username=$1
password=$2
if [ "$password" = "-" ]; then
stty -echo
read -p "Enter your password: " password
stty echo
echo
fi
if [ $# -lt 4 ]; then
category=1
filename=$3
else
category=${categorys[$3]:-errorerror}
filename=$4
fi
if [ $category = "errorerror" ]; then
echo "Invalid category"
exit 2
fi
echo "Logging in..."
response=`curl -sSi -F user=$username -F passwd=$password -H 'Expect: ' https://aur.archlinux.org/login/`
sessid=`echo "$response" | awk '/^Set-Cookie: / {print $2}' | tr -d ';'`
if [ $verbose -gt 0 ]; then
echo "$response"
fi
if [ -z "$sessid" ]; then
echo "Login failed. Wrong username/password?" >&2
exit 1
fi
echo "Done, sessionid is $sessid"
echo "Requesting upload token..."
response=`curl -sSi -H 'Expect: ' -b $sessid https://aur.archlinux.org/submit/`
token=`echo "$response" | grep 'input.type..hidden..name..token..value' | cut -d\" -f6`
if [ $verbose -gt 0 ]; then
echo "$response"
fi
if [ -z "$token" ]; then
echo "Could not get the token." >&2
exit 1
fi
echo "Done, token is $token"
echo "Uploading file..."
response=`curl -sSi -H 'Expect: ' -F token="$token" -F pkgsubmit=1 -F category=$category -F pfile=@$filename -b $sessid https://aur.archlinux.org/submit/`
error=`echo "$response" | grep 'class="errorlist"' | sed 's/\s*<[^>]*>//g'`
package=`echo "$response" | awk '/^Location: / {print $2}'`
if [ $verbose -gt 0 ]; then
echo "$response"
fi
if [ "$error" ]; then
echo "Error: $error" >&2
exit 1
else
echo "Done, (new) package is https://aur.archlinux.org$package"
fi
@slopjong

Thanks for your openspace pull request which was the reason to have a look at your website and thus at your AUR packages. My eclipse plugin packager (eclipse-artifacts) can make use of it :-)

@1ace

Error messages have changed format with the release of AUR v3; they now look like this:

<ul class="errorlist"><li>Error - all files must have permissions of 644 or 755.</li></ul>

You should probably change line #97 accordingly :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.