#!/bin/sh -e

# Author: Benoit PAPILLAULT <benoit.papillault@free.fr>
# Creation: 13/05/2004

# Ensure to have a working PATH
export PATH="/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin"

setup_remover() {
  [ "$REMOVER" ] || return 0

cat > "${REMOVER}" <<EOF
#!/bin/sh

PATH="/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin"

speedtouch-stop -d "${DEVICE}"

# remove the file used by speedtouch-start to indicate that the modem
# has been initialized

rm -f /var/run/speedtouch-up

EOF

  chmod +x "${REMOVER}"
  return 0
}

##############################################################################
case "$ACTION" in
  add)
    setup_remover
    speedtouch-start -d "${DEVICE}"
    ;;
esac

exit 0

