# SliTaz package receipt.

PACKED_SIZE="216.0K"
UNPACKED_SIZE="1000.0K"
PACKAGE="udisks2"
VERSION="2.1.8"
CATEGORY="system-tools"
SHORT_DESC="D-Bus service to access and manipulate storage devices"
MAINTAINER="pankso@slitaz.org"
LICENSE="GPL2"
WEB_SITE="https://www.freedesktop.org/wiki/Software/udisks/"
TARBALL="udisks-$VERSION.tar.bz2"
WGET_URL="https://udisks.freedesktop.org/releases/$TARBALL"

DEPENDS="libatasmart libgudev polkit"
BUILD_DEPENDS="docbook-xsl gtk-doc libgudev-dev polkit-dev libatasmart-dev \
gobject-introspection-dev"

current_version()
{
	wget -O - $(dirname $WGET_URL) 2>/dev/null | \
	sed "/udisks-2/!d;/tar/!d;s|.*udisks-\\(.*\\).tar.*\".*|\\1|" | sort -Vr  | sed q
}

# Rules to configure and make the package.
compile_rules()
{
	./configure \
		--sysconfdir=/etc \
		--localstatedir=/var \
		--enable-fhs-media \
		--with-udevdir=/etc/udev \
		--with-systemdsystemunitdir=no \
		$CONFIGURE_ARGS &&
	make && make install
}

# Rules to gen a SliTaz package suitable for Tazpkg.
genpkg_rules()
{
	cook_copy_folders etc bin sbin libexec dbus-1 polkit-1 var
	cook_copy_files *.so*

	sed '/lang=/d' -i \
		$fs/usr/share/polkit-1/actions/org.freedesktop.udisks2.policy

	# Please, note:
	# Package:  slitaz-configs-base
	# File:     /etc/polkit-1/localauthority/50-local.d/55-storage.pkla
	# Provides: complete access to udisks2 methods

	# mount to "/media" instead of "/media/<user>"
	cp $stuff/99-udisks2.rules $fs/etc/udev/rules.d/
}
