#!/bin/sh

. config/options

$SCRIPTS/install sg3_utils
$SCRIPTS/install udev
$SCRIPTS/install glib
$SCRIPTS/install dbus
$SCRIPTS/install dbus-glib
$SCRIPTS/install parted
$SCRIPTS/install LVM2
$SCRIPTS/install polkit
$SCRIPTS/install libatasmart

mkdir -p $INSTALL/etc/dbus-1/system.d
  cp -P $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-dm-export $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
  cp -P $PKG_BUILD/src/probers/udisks-probe-sas-expander $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/sbin
  cp -P $PKG_BUILD/tools/umount.udisks $INSTALL/sbin

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

mkdir -p $INSTALL/usr/lib/polkit-1/extensions
  cp -P $PKG_BUILD/src/.libs/*.so $INSTALL/usr/lib/polkit-1/extensions

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
