#!/bin/sh

################################################################################
#      This file is part of OpenELEC - http://www.openelec.tv
#      Copyright (C) 2009-2011 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, 675 Mass Ave, Cambridge, MA 02139, USA.
#  http://www.gnu.org/copyleft/gpl.html
################################################################################

. config/options $1

mkdir -p $INSTALL/etc/ConsoleKit/run-seat.d
mkdir -p $INSTALL/etc/ConsoleKit/run-session.d
mkdir -p $INSTALL/etc/ConsoleKit/seats.d
  cp -P $PKG_BUILD/data/00-primary.seat $INSTALL/etc/ConsoleKit/seats.d

mkdir -p $INSTALL/etc/dbus-1/system.d
  cp -P $PKG_BUILD/data/ConsoleKit.conf $INSTALL/etc/dbus-1/system.d

mkdir -p $INSTALL/sbin
  cp -P $PKG_BUILD/tools/ck-log-system-restart $INSTALL/sbin
  cp -P $PKG_BUILD/tools/ck-log-system-start $INSTALL/sbin
  cp -P $PKG_BUILD/tools/ck-log-system-stop $INSTALL/sbin
  cp -P $PKG_BUILD/src/console-kit-daemon $INSTALL/sbin

mkdir -p $INSTALL/usr/bin
  cp -P $PKG_BUILD/tools/.libs/ck-launch-session $INSTALL/usr/bin
  cp -P $PKG_BUILD/tools/ck-list-sessions $INSTALL/usr/bin
  cp -P $PKG_BUILD/tools/ck-history $INSTALL/usr/bin

mkdir -p $INSTALL/usr/lib
  cp -P $PKG_BUILD/libck-connector/.libs/*.so* $INSTALL/usr/lib

mkdir -p $INSTALL/usr/lib/ConsoleKit
  cp -P $PKG_BUILD/tools/ck-collect-session-info $INSTALL/usr/lib/ConsoleKit
  cp -P $PKG_BUILD/tools/ck-get-x11-display-device $INSTALL/usr/lib/ConsoleKit
  cp -P $PKG_BUILD/tools/ck-get-x11-server-pid $INSTALL/usr/lib/ConsoleKit

mkdir -p $INSTALL/usr/lib/ConsoleKit/run-seat.d
mkdir -p $INSTALL/usr/lib/ConsoleKit/run-session.d
mkdir -p $INSTALL/usr/lib/ConsoleKit/scripts
  cp -P $PKG_BUILD/tools/linux/ck-system-restart $INSTALL/usr/lib/ConsoleKit/scripts
  cp -P $PKG_BUILD/tools/linux/ck-system-stop $INSTALL/usr/lib/ConsoleKit/scripts

mkdir -p $INSTALL/usr/share/dbus-1/interfaces
  cp -P $PKG_BUILD/src/org.freedesktop.ConsoleKit.Manager.xml $INSTALL/usr/share/dbus-1/interfaces
  cp -P $PKG_BUILD/src/org.freedesktop.ConsoleKit.Seat.xml $INSTALL/usr/share/dbus-1/interfaces
  cp -P $PKG_BUILD/src/org.freedesktop.ConsoleKit.Session.xml $INSTALL/usr/share/dbus-1/interfaces

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

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

