#!/bin/bash
PERUNTMP="`mktemp -d`"
PERUNBIN="${PERUNTMP}/perun-cli/bin"
PERUNLIB="${PERUNTMP}/perun-cli/lib"
mkdir $PERUNTMP/perun-cli
mkdir $PERUNBIN
mkdir $PERUNLIB
cp `find . -maxdepth 1 -type f` $PERUNBIN
rm ${PERUNBIN}/perun-cli.tar.gz 2>/dev/null
rm ${PERUNBIN}/maketar
rm ${PERUNBIN}/Makefile
mv ${PERUNBIN}/README ${PERUNTMP}/perun-cli
chmod 0755 ${PERUNBIN}/*
chmod 0644 ${PERUNTMP}/perun-cli/README
mkdir ${PERUNLIB}/Perun
cp `find ./Perun -maxdepth 1 -name "*.pm" -type f` ${PERUNLIB}/Perun
chmod 0644 ${PERUNLIB}/Perun/*
mkdir ${PERUNLIB}/Perun/beans
cp `find ./Perun/beans -maxdepth 1 -name "*.pm" -type f` ${PERUNLIB}/Perun/beans
chmod 0644 ${PERUNLIB}/Perun/beans/*
tar -czf perun-cli.tar.gz -C ${PERUNTMP} perun-cli
rm -rf $PERUNTMP
