#!/bin/bash

#This sets permissions, copies the necessary files into the ipk folder and then creates the ipk.

if test -a VERSION ; then
	VERSION="$(cat VERSION)"

	chmod 644 control
	cp control ipk/CONTROL/
	chmod 644 gnurobbo.desktop
	cp gnurobbo.desktop ipk/opt/QtPalmtop/apps/Games/
	chmod 644 gnurobbo.png
	cp gnurobbo.png ipk/opt/QtPalmtop/pics/
	chmod 755 gnurobbo rungnurobbo
	cp gnurobbo rungnurobbo ipk/opt/QtPalmtop/bin/
	chmod 644 ciphers-sl5x00.bmp icons.bmp levels.dat textsmall.bmp
	cp ciphers-sl5x00.bmp icons.bmp levels.dat textsmall.bmp ipk/opt/QtPalmtop/share/gnurobbo/
	./ipkg-build ipk
	echo "All done."
else
	echo "ERROR: File \"VERSION\" not found. This is a text file with the version number inside it."
fi
