tUse templates to create CRUX ports - scripts - various script and utils
 (HTM) git clone git://z3bra.org/scripts
 (DIR) Log
 (DIR) Files
 (DIR) Refs
       ---
 (DIR) commit 66415b1db97dc8de8d413d8a8adab84195c81ef1
 (DIR) parent 10613b7b74d59afe7f054ba66b0ed20b775a68ea
 (HTM) Author: z3bra <willy@mailoo.org>
       Date:   Wed, 26 Mar 2014 19:42:16 +0100
       
       Use templates to create CRUX ports
       
       Diffstat:
         A prtmk                               |      73 +++++++++++++++++++++++++++++++
       
       1 file changed, 73 insertions(+), 0 deletions(-)
       ---
 (DIR) diff --git a/prtmk b/prtmk
       t@@ -0,0 +1,73 @@
       +#!/bin/sh
       +
       +PKGFILE=~/src/ports/Pkgfile
       +PORTDIR=~/usr/ports
       +test -z $EDITOR && EDITOR=vim
       +
       +echo_color () {
       +    tput bold
       +    tput setaf $1
       +    shift
       +
       +    echo "$@"
       +
       +    tput sgr0
       +}
       +
       +read -p 'Name : ' name
       +read -p 'Description : ' description
       +read -p 'Version : ' version
       +read -p 'URL : ' url
       +read -p 'Maintainer : ' daddy
       +read -p 'Depends on : ' depends
       +read -p 'Source : ' sources
       +
       +source=${source/$name/\$name}
       +source=${source/$version/\$version}
       +
       +PORTDIR=$PORTDIR/$name
       +
       +if test "$version" = "git"; then
       +    git_url=$sources
       +    sources=''
       +
       +    PKGFILE=${PKGFILE}-git
       +    PORTDIR=${PORTDIR}-git
       +fi
       +
       +echo -n "creating port $name .. "
       +mkdir $PORTDIR
       +
       +if cd $PORTDIR; then
       +    echo_color 2 OK
       +else
       +    echo_color 1 FAIL
       +    exit 1
       +fi
       +
       +echo -n "copying Pkgfile .. "
       +cp $PKGFILE Pkgfile
       +
       +if test -f $PORTDIR/Pkgfile; then
       +    echo_color 2 OK
       +else
       +    echo_color 1 FAIL
       +    exit 1
       +fi
       +
       +echo -n "filling Pkgfile .. "
       +sed \
       +    -e "s__DESCRIPTION__$description" \
       +    -e "s__URL__$url" \
       +    -e "s__MAINTAINER__$daddy" \
       +    -e "s__DEPENDENCIES__$depends" \
       +    -e "s__NAME__$name" \
       +    -e "s__VERSION__$version" \
       +    -e "s__SOURCE__$sources" \
       +    -e "s__GIT_URL__$git_url" \
       +    -i $PORTDIR/Pkgfile
       +echo_color 2 OK
       +
       +echo -n "openning Pkgfile for fixes .. "
       +$EDITOR Pkgfile
       +echo_color 2 OK