Skip to content

Instantly share code, notes, and snippets.

@SpotlightKid
Last active August 29, 2015 14:00
Show Gist options
  • Save SpotlightKid/11037599 to your computer and use it in GitHub Desktop.
Save SpotlightKid/11037599 to your computer and use it in GitHub Desktop.
Generate .AURINFO file, create Arch source package and add .AURINFO to it
#!/bin/bash
#
# aurinfohelper.sh
#
process() {
if [ ! -f PKGBUILD ]; then
echo "PKGBUILD not found!"
else
source PKGBUILD
echo ">>> Generate AURINFO for $pkgname"
cat > .AURINFO << __EOF__
pkgname = $pkgname
pkgver = $pkgver-$pkgrel
pkgdesc = $pkgdesc
url = $url
license = $license
__EOF__
for i in "${depends[@]}"; do
echo "depend = $i"
done | sort >> .AURINFO
print_aurinfo
edit_aurinfo
create_src "$pkgname-$pkgver-$pkgrel" "$pkgname"
upload_src "$pkgname-$pkgver-$pkgrel"
fi
}
print_aurinfo() {
echo ">>> Generated .AURINFO:"
cat .AURINFO
}
edit_aurinfo() {
echo ">>> Edit .AURINFO ? [Y/n] ("A" to abort)"
read -n 1 -r
if [[ -z $REPLY || $REPLY =~ ^[Yy]$ ]]; then
$EDITOR .AURINFO
print_aurinfo
edit_aurinfo
elif [[ $REPLY =~ ^[Aa]$ ]]; then
exit
else
return
fi
}
create_src() {
echo ">>> Generate pkgsrc"
makepkg --source -f
echo ">>> Update pkgsrc"
srcpkg=`realpath $1.src.tar.gz`
gzip -d "$srcpkg"
tar rvf "${srcpkg/${srcpkg: -3}}" .AURINFO --transform s,.AURINFO,$2/.AURINFO,
gzip "${srcpkg/${srcpkg: -3}}"
}
upload_src() {
echo ">>> Upload srcpkg ? [y/N]"
read -n 1 -r
if [[ $REPLY =~ ^[Yy]$ ]]; then
burp "$1.src.tar.gz"
fi
}
process
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment