#!/usr/bin/env bash
set -ueo pipefail

srcdir="$(readlink -e $(dirname ${0})/../..)"

if [[ -d ./ubuntu_package ]] ; then
	rm -r ./ubuntu_package
fi
mkdir ./ubuntu_package
pkgdir=$(readlink -e ./ubuntu_package)

mkdir ${pkgdir}/DEBIAN
cp ${srcdir}/packaging/ubuntu/{control,postinst} ${pkgdir}/DEBIAN

cd ${srcdir}
make DESTDIR="${pkgdir}" install

cd ${pkgdir}
dpkg-deb --build . oomox.deb

echo DEB PACKAGING DONE
exit 0
