Created
August 14, 2014 22:01
-
-
Save graysky2/123a92d045bb02ce7634 to your computer and use it in GitHub Desktop.
getpkg function draft
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Optionally define a work directory. | |
work=/scratch | |
# Uncomment to end trunk. If left commented, end in the official repos. | |
favor=testing | |
getpkg() { | |
$(which svn >/dev/null) | |
[[ $? -ne 0 ]] && echo "I require subversion to operate." && return 1 | |
[[ -z "$work" ]] && work=$(pwd) | |
if [[ -z "$1" ]]; then | |
echo "Supply a package name and try again." | |
return 1 | |
else | |
[[ -d "$work/packages/$1" ]] && rm -rf "$work/packages/$1" | |
svn checkout --depth=empty svn://svn.archlinux.org/packages "$work/packages" | |
svn update "$work/packages/$1" &>/dev/null | |
if [[ -d "$work/packages/$1" ]]; then | |
svn update "$work/packages/$1" | |
cd "$work/packages/$1" | |
else | |
svn checkout --depth=empty svn://svn.archlinux.org/community "$work/community" | |
svn update "$work/community/$1" | |
if [[ -d "$work/community/$1" ]]; then | |
svn update "$work/community/$1" &>/dev/null | |
cd "$work/community/$1" | |
else | |
echo "Could not find $1 in the official repos." | |
return 1 | |
fi | |
fi | |
fi | |
if [[ "$favor" = "testing" ]]; then | |
cd trunk | |
return 0 | |
else | |
for i in core-x86_64 extra-x86_64 community-x86_64; do | |
[[ -d repos/$i ]] && cd repos/$i | |
done | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment