#!/bin/sh -e

PREREQS=""

prereqs() { echo "$PREREQS"; }

case "$1" in
    prereqs)
    prereqs
    exit 0
    ;;
esac

. /usr/share/initramfs-tools/hook-functions

[ -r /etc/default/brltty ] && . /etc/default/brltty

[ -x /sbin/brltty ] || exit 0

if [ "$START_IN_INITRAMFS" = "true" -o "$START_IN_INITRAMFS" = "yes" ]; then
  echo -n "Installing BRLTTY into initramfs..."

  cp -a /etc/brltty/ $DESTDIR/etc/
  cp /etc/brltty.conf $DESTDIR/etc/

  cp -a /lib/brltty/ $DESTDIR/lib/

  mkdir -p $DESTDIR/usr/lib
  cp -a /usr/lib/gconv $DESTDIR/usr/lib

  copy_exec /sbin/brltty /sbin/

  manual_add_modules pcspkr
  manual_add_modules uinput

  echo "done"
fi
