Last active
August 29, 2015 14:00
-
-
Save SpotlightKid/11037599 to your computer and use it in GitHub Desktop.
Generate .AURINFO file, create Arch source package and add .AURINFO to it
This file contains 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
#!/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