install -d ${INSTALL_ROOT}/sys                &&
local FILE UDEV_CFG=${INSTALL_ROOT}/etc/udev  &&
mkdir  -p  ${UDEV_CFG}/rules.d                &&

install_config_file $SCRIPT_DIRECTORY/udev.conf ${UDEV_CFG}/udev.conf &&
install_config_file $SCRIPT_DIRECTORY/udev.missing ${UDEV_CFG}/udev.missing &&

for FILE in $SCRIPT_DIRECTORY/rules/* ; do
  install_config_file $FILE ${UDEV_CFG}/rules.d/$(basename $FILE)
done  &&

# install diff default rules on hotplug and non-hotplug systems, install 
# required modprobe aliases for non-hotplug rules
if spell_ok hotplug; then
  install_config_file $SCRIPT_DIRECTORY/52-modules.rules-hotplug ${UDEV_CFG}/rules.d/52-modules.rules
else
  install_config_file $SCRIPT_DIRECTORY/52-modules.rules ${UDEV_CFG}/rules.d/52-modules.rules  &&
  mkdir -p $INSTALL_ROOT/etc/modprobe.d  &&
  install_config_file $SCRIPT_DIRECTORY/modprobe.aliases $INSTALL_ROOT/etc/modprobe.d/udev
fi  &&

# install early rules
nstall_config_file $SOURCE_DIRECTORY/etc/udev/05-udev-early.rules  \
                           ${UDEV_CFG}/rules.d/05-udev-early.rules

# udevstart and udevsend are nolonger installed by default. we need them for kernel < 2.6.15rc1
install udevsend udevstart  ${INSTALL_ROOT}/sbin  &&

make prefix=${INSTALL_ROOT}/ exec_prefix=${INSTALL_ROOT}/ V=true ${OPTS} install   &&
make EXTRAS="extras/run_directory extras/cdrom_id extras/firmware" \
  prefix=${INSTALL_ROOT}/ exec_prefix=${INSTALL_ROOT}/ \
  V=true ${OPTS} install &&

# Install helper scripts
mkdir -p /lib/udev  &&
for FILE in $SCRIPT_DIRECTORY/helpers/*; do
  install -m 755 $FILE $INSTALL_ROOT/lib/udev
done  &&

if [[ "$UDEV_EXTRAS" == 'y' ]]; then
  make EXTRAS="extras/ata_id extras/dasd_id extras/edd_id extras/floppy extras/scsi_id extras/usb_id extras/volume_id" prefix=${INSTALL_ROOT}/ exec_prefix=${INSTALL_ROOT}/ ${OPTS} V=true install   &&
  install  extras/path_id/path_id  ${INSTALL_ROOT}/lib/udev  &&

  if [[ "$UDEV_PERSIST" == 'y' ]]; then
    install_config_file etc/udev/60-persistent-storage.rules ${UDEV_CFG}/rules.d/60-persistent-storage.rules
  fi
fi

#if [[ "$UDEV_STATIC" == 'y' ]]; then
#  pushd __static__ &&
#  # we are not supposed to use `make install'
#  for FILE in $UDEV_STATIC_TARGET; do
#    install -D $FILE $INSTALL_ROOT/usr/sbin/$FILE.static
#  done &&
#  popd
#fi
