#!/bin/bash

set -e

case $1 in
  preinst)
    exit 0
    ;;
  postinst)
    if [ ! -f ${TARGET}/etc/udev/udev.conf ]; then
      install -m 644 ${TARGET}/usr/share/eudev/udev.conf \
        ${TARGET}/etc/udev/udev.conf
    fi

    if [[ ! ${TARGET} ]]; then
      /etc/init.d/udevd restart
      update-rc enable udevd
    else
      chroot ${TARGET} 'update-rc enable udevd'
    fi
    ;;
  prerm)
    exit 0
    ;;
  postrm)
    exit 0
    ;;
esac
