X-Git-Url: https://git.rmz.io/dotfiles.git/blobdiff_plain/4b06eb26103a8f0840915532fdf411ef82e9ad24..89cf694280e02442fb435d5fe516ac09783d776a:/bin/vp?ds=sidebyside diff --git a/bin/vp b/bin/vp new file mode 100755 index 0000000..a979204 --- /dev/null +++ b/bin/vp @@ -0,0 +1,36 @@ +#! /bin/bash + +# Open PKGBUILD if it exists and exit + [[ -e PKGBUILD ]] && $EDITOR PKGBUILD && exit + +################################################################################ + +# path to the PKGBUILD.proto +PROTO=/usr/share/pacman/PKGBUILD.proto +PROTOINST=/usr/share/pacman/proto.install +MAINTAINER="Samir Benmendil " + +################################################################################ + +echo "No PKGBUILD was found." +while true; do + read -p "Do you wish to create one? [Y/n] " yn + case $yn in + [Yy]* ) break;; + '' ) break;; + [Nn]* ) exit;; + * ) ;; + esac +done +# get the package name +# I will consider that the folder you're in is also the pkgname +# if its not you can change it later +PKGNAME=`basename $(pwd)` + +cp $PROTO PKGBUILD +cp $PROTOINST $PKGNAME.install + +sed -i "1,5d" PKGBUILD +sed -i "s/# Maintainer: .*/# Maintainer: ${MAINTAINER}\n/" PKGBUILD +sed -i "s/pkgname=.*/pkgname=${PKGNAME}/" PKGBUILD +$EDITOR PKGBUILD