#!/bin/sh

prefix=/usr/local

pSyntax()
{
   echo Syntax `basename $0` '[-h|--help]'
   echo "      " `basename $0` '[-p|--prefix installPath]'
   echo
   echo "Default install path: $prefix"
   echo "Chemin d'installation par default: $prefix"
   echo "Default Installationspfad: $prefix"
   echo "Percorso d'installazione di default: $prefix"
   echo "Alapértelmezett telepítési útvonal: $prefix"
   echo
}

# Check for args
while [ $# -ne 0 ]
do
   case $1 in
   -h|--h*)
      pSyntax
      exit 0;;
   -p|--p*)
      shift
      if [ $# -ne 1 ]
      then
        pSyntax
        exit 1
      else
         prefix=$1
      fi;;
   *)
      pSyntax
      exit 1;;
   esac
   shift
done

sed "s:^prefix.*:prefix='$prefix':" pyink.py > pyink.py.tmp
mv pyink.py.tmp pyink.py
chmod +x pyink.py

sed "s:^prefix.*:prefix=$prefix:" Makefile > Makefile.tmp
mv Makefile.tmp Makefile

sed "s:^prefix.*:prefix=$prefix:" pyink.sh > pyink.sh.tmp
mv pyink.sh.tmp pyink.sh
chmod +x pyink.sh
