]> git.rmz.io Git - dotfiles.git/blobdiff - bin/vp
add tardis bin
[dotfiles.git] / bin / vp
diff --git a/bin/vp b/bin/vp
new file mode 100755 (executable)
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 <samir.benmendil@gmail.com>"
+
+################################################################################
+
+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