#!/bin/sh

################################################################################
#      This file is part of OpenELEC - http://www.openelec.tv
#      Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv)
#
#  This Program is free software; you can redistribute it and/or modify
#  it under the terms of the GNU General Public License as published by
#  the Free Software Foundation; either version 2, or (at your option)
#  any later version.
#
#  This Program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with OpenELEC.tv; see the file COPYING.  If not, write to
#  the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA.
#  http://www.gnu.org/copyleft/gpl.html
################################################################################

. config/options $1

mkdir -p $INSTALL/etc/dbus-1/system.d
  cp $PKG_BUILD/data/org.freedesktop.UDisks.conf  $INSTALL/etc/dbus-1/system.d

mkdir -p $INSTALL/lib/udev
  cp -P $PKG_BUILD/src/probers/udisks-part-id $INSTALL/lib/udev
  cp -P $PKG_BUILD/src/probers/udisks-probe-ata-smart $INSTALL/lib/udev

mkdir -p $INSTALL/lib/udev/rules.d
#  cp $PKG_BUILD/data/80-udisks.rules $INSTALL/lib/udev/rules.d

mkdir -p $INSTALL/usr/bin
  cp -P $PKG_BUILD/tools/udisks $INSTALL/usr/bin
  cp -P $PKG_BUILD/tools/umount.udisks $INSTALL/usr/bin

mkdir -p $INSTALL/usr/lib/udisks
  cp -P $PKG_BUILD/src/udisks-daemon $INSTALL/usr/lib/udisks
  cp -P $PKG_BUILD/src/helpers/udisks-helper-ata-smart-collect $INSTALL/usr/lib/udisks
  cp -P $PKG_BUILD/src/helpers/udisks-helper-ata-smart-selftest $INSTALL/usr/lib/udisks
  cp -P $PKG_BUILD/src/helpers/udisks-helper-change-filesystem-label $INSTALL/usr/lib/udisks
#  cp -P $PKG_BUILD/src/helpers/udisks-helper-change-luks-password $INSTALL/usr/lib/udisks
  cp -P $PKG_BUILD/src/helpers/udisks-helper-create-partition $INSTALL/usr/lib/udisks
  cp -P $PKG_BUILD/src/helpers/udisks-helper-create-partition-table $INSTALL/usr/lib/udisks
  cp -P $PKG_BUILD/src/helpers/udisks-helper-delete-partition $INSTALL/usr/lib/udisks
  cp -P $PKG_BUILD/src/helpers/udisks-helper-drive-benchmark $INSTALL/usr/lib/udisks
  cp -P $PKG_BUILD/src/helpers/udisks-helper-drive-detach $INSTALL/usr/lib/udisks
  cp -P $PKG_BUILD/src/helpers/udisks-helper-drive-poll $INSTALL/usr/lib/udisks
  cp -P $PKG_BUILD/src/helpers/udisks-helper-fstab-mounter $INSTALL/usr/lib/udisks
  cp -P $PKG_BUILD/src/helpers/udisks-helper-linux-md-check $INSTALL/usr/lib/udisks
  cp -P $PKG_BUILD/src/helpers/udisks-helper-linux-md-remove-component $INSTALL/usr/lib/udisks
  cp -P $PKG_BUILD/src/helpers/udisks-helper-mdadm-expand $INSTALL/usr/lib/udisks
  cp -P $PKG_BUILD/src/helpers/udisks-helper-mkfs $INSTALL/usr/lib/udisks
  cp -P $PKG_BUILD/src/helpers/udisks-helper-modify-partition $INSTALL/usr/lib/udisks

mkdir -p $INSTALL/usr/share/dbus-1/interfaces
  cp -P $PKG_BUILD/data/org.freedesktop.UDisks.Adapter.xml $INSTALL/usr/share/dbus-1/interfaces
  cp -P $PKG_BUILD/data/org.freedesktop.UDisks.Device.xml $INSTALL/usr/share/dbus-1/interfaces
  cp -P $PKG_BUILD/data/org.freedesktop.UDisks.Expander.xml $INSTALL/usr/share/dbus-1/interfaces
  cp -P $PKG_BUILD/data/org.freedesktop.UDisks.Port.xml $INSTALL/usr/share/dbus-1/interfaces
  cp -P $PKG_BUILD/data/org.freedesktop.UDisks.xml $INSTALL/usr/share/dbus-1/interfaces

mkdir -p $INSTALL/usr/share/dbus-1/system-services
  cp -P $PKG_BUILD/data/org.freedesktop.UDisks.service $INSTALL/usr/share/dbus-1/system-services

mkdir -p $INSTALL/usr/share/polkit-1/actions
  cp -P $PKG_BUILD/policy/org.freedesktop.udisks.policy $INSTALL/usr/share/polkit-1/actions
