#!/usr/bin/env bash
mkdir -p AppDir/usr/bin
mkdir -p AppDir/usr/lib
mkdir -p AppDir/usr/share/tesseract-ocr/4.00/tessdata
cp -r /usr/share/tesseract-ocr/4.00/tessdata/* AppDir/usr/share/tesseract-ocr/4.00/tessdata
cp ../../checks-parser AppDir/usr/bin

echo \
"[Desktop Entry]
Name=Checks parser
Exec=usr/bin/checks-parser
Icon=checks-parser
Type=Application
Categories=Utility;" \
> AppDir/checks-parser.desktop

echo \
"#!/bin/bash
export TESSDATA_PREFIX=\$APPDIR/usr/share/tesseract-ocr/4.00/tessdata

\$APPDIR/usr/bin/checks-parser" \
> AppDir/AppRun

chmod +x AppDir/AppRun
cp ../../checks-parser AppDir/usr/bin
linuxdeployqt AppDir/usr/bin/checks-parser -no-copy-copyright-files -appimage
