#!/bin/sh ## TODO: add support for DLAGENT. ## TODO: add support for curl. _printhelp() { cat</dev/null; then echo "You need 'realpath'" exit fi for i ; do if [ ! -f "$i" ]; then echo "$i must be a PKGBUILD file." continue fi OUTPATH="$(realpath "$i")" OUTPATH="${OUTPATH%/*}" PKGNAME="$(awk -F= '/^pkgname/{print $2}' "$i")" UBUILD="${OUTPATH}/$PKGNAME.sh" if [ -f "$UBUILD" ] && ! $OPT_OVERWRITE; then echo "$UBUILD already exists." continue fi cat<<"EOF" > "$UBUILD" #!/bin/bash if ! command -v realpath >/dev/null; then echo "You need 'realpath'." exit fi if ! command -v wget >/dev/null; then echo "You need 'wget'." exit fi ################################################################################ EOF if $OPT_LOCAL; then sed -e 's|/usr|/usr/local|g' "$i" >> "$UBUILD" else cat "$i" >> "$UBUILD" fi cat "${0%/*}/.${0##*/}.in" >> "$UBUILD" chmod +x "$UBUILD" done