pkgname=luna-core-apps
pkgver=1.0.5_git20170804
pkgrel=1
_commit=da721460474039a2412dc6f47a2e8464e38fc6fd
pkgdesc="The new webOS UI of the webOS ports project."
arch="all"
url="http://webos-ports.org"
license="GPL-3.0+"
depends="luna-webappmanager enyo luna-app-services"
makedepends=""
source="$pkgname-$_commit.tar.gz::https://github.com/webOS-ports/core-apps/archive/$_commit.tar.gz"
builddir="$srcdir/core-apps-$_commit"

package() {
	cd "$builddir"

	install -d "$pkgdir"/usr/palm/applications
	install -d "$pkgdir"/etc/palm/db/kinds
	install -d "$pkgdir"/etc/palm/db/permissions
	install -d "$pkgdir"/etc/palm/activities

	for COREAPPS in $(ls -d1 ./com.palm.app*); do
		COREAPPS_DIR=$(basename $COREAPPS)
		install -d "$pkgdir"/usr/palm/applications/$COREAPPS_DIR/
		cp -vrf $COREAPPS/* "$pkgdir"/usr/palm/applications/$COREAPPS_DIR/

		if [ -d $COREAPPS/configuration/db/kinds ]; then
			install -v -m 644 $COREAPPS/configuration/db/kinds/* "$pkgdir"/etc/palm/db/kinds
		fi

		if [ -d $COREAPPS/configuration/db/permissions ]; then
			install -v -m 644 $COREAPPS/configuration/db/permissions/* "$pkgdir"/etc/palm/db/permissions
		fi

		if [ -d $COREAPPS/configuration/activities ]; then
			cp -vrf $COREAPPS/configuration/activities/* "$pkgdir"/etc/palm/activities/
		fi
	done
}

sha512sums="0e0f93ec7cce52cb0b7d3e90b177da69ef0d8d8bb2b8629cf861f5de914cf3300198f4000b69e5dd7e8f55feb1c8e4344793f0a8b2764dd143bb80a000f92e2e  luna-core-apps-da721460474039a2412dc6f47a2e8464e38fc6fd.tar.gz"
