File inputattach.init of Package input-utils

#!/bin/sh
#
# /etc/init.d/inputattach
#
# This connects devices on serial ports to
# user-specified kernel drivers.
#
### BEGIN INIT INFO
# Provides:          boot.inputattach
# Should-Start:      $local_fs boot.loadmodules setserial
# Should-Stop:       $null
# Required-Start:
# Required-Stop:
# Default-Start:     1 2 3 5
# Default-Stop:      0 6
# Description:       Attaches drivers to serial devices
### END INIT INFO

. /etc/rc.status

. /etc/sysconfig/inputattach

inputattach_bin=/usr/bin/inputattach

rc_reset
case $1 in
  start)
    echo -n "Starting inputattach for serial drivers:"
    if test -n "$INPUTATTACH_DRIVERS" ; then
      echo
      for pair in $INPUTATTACH_DRIVERS ; do
        serial_node="${pair%%:*}"
        inputattach_driver="${pair##*:}"
        inputattach_params="--${inputattach_driver} ${serial_node}"
        startproc ${inputattach_bin} ${inputattach_params}
        rc_status -v
      done
    else
      rc_status -u
    fi
    ;;
  stop)
    echo -n "Stopping inputattach for serial drivers:"
    killproc -TERM ${inputattach_bin}
    rc_status -v
    ;;
  restart)
    $0 stop
    $0 start
    rc_status
    ;;
  force-reload)
    $0 stop
    $0 start
    rc_status
    ;;
  status)
    echo -n "Checking for inputattach:"
    checkproc ${inputattach_bin}
    rc_status -v
    ;;
  *)
    echo "Usage: $0 {start|stop|restart|force-reload|status}"
    ;;
esac
rc_exit