#!/bin/bash
BASEDIR="/usr/local/winetools"
DIR="/usr/local/share"
VERSION="`ls wt*jo`"
RELEASE="`echo $VERSION | sed -e "s/wt\(.*\)jo/\1/"`"
echo "Version: $VERSION"
echo "Release: $RELEASE"

#for Debian:
#BASEDIR="/usr/share/winetools"
#DIR="/usr/share"

# . gettext.sh

echo "Installing WineTools to $BASEDIR..."
mkdir -p $BASEDIR
cp -R * $BASEDIR
ln -sf $BASEDIR/$VERSION /usr/local/bin/wt2
ln -sf $BASEDIR/$VERSION /usr/local/bin/winetools
ln -sf $BASEDIR/findwine /usr/local/bin/findwine

echo "Installing translations..."
cd "$BASEDIR/po"
for i in $( ls  *.po|cut -f1 -d.); do
	mkdir -p $DIR/locale/$i/LC_MESSAGES
	msgfmt $i.po -o $DIR/locale/$i/LC_MESSAGES/wt2.mo
        echo "Installed translations for $i to $DIR/locale/$i/LC_MESSAGES/wt2.mo"
done

echo "Start WineTools as *normal* user with \"wt2\". Don't use as root!"
