#!/bin/bash

echo -e "Welcome to easy deb builder! \c"
echo -e "Project name:"
read project_name
echo -e "Type path to data : \c"
read path
echo -e "Type target path on system : \c"
read install_path
echo -e "Building deb please wait..."
mkdir $project_name
mkdir -p $project_name/$install_path
cp -r $path/* $project_name/$install_path
mkdir $project_name/DEBIAN/
mv $project_name/$install_path/control $project_name/DEBIAN/
find $project_name/$install_path -type f -print0 | xargs -0 md5sum > $project_name/DEBIAN/md5sums
mkdir -p $project_name/usr/share/applications/
mkdir -p $project_name/usr/share/pixmaps/
mv $project_name/$install_path/*.desktop $project_name/usr/share/applications/
mv $project_name/$install_path/ico-*.png $project_name/usr/share/pixmaps/
fakeroot dpkg-deb -b $project_name $project_name.deb
rm -r $project_name
echo "bye"

