File: rc.etc-setserial

package info (click to toggle)
setserial 2.17-48
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 748 kB
  • ctags: 254
  • sloc: sh: 2,120; ansic: 1,008; makefile: 140; csh: 2
file content (82 lines) | stat: -rw-r--r-- 1,902 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#! /bin/sh
#
### BEGIN INIT INFO
# Provides:             etc-setserial
# Required-Start:       checkfs
# Required-Stop:        $remote_fs
# Default-Start:        S
# Default-Stop:         0 1 6
# Short-Description:    controls configuration of serial ports
# Description:          Set and/or report the configuration information
#                       associated with a serial port. This information
#                       includes what I/O port and which IRQ a particular
#                       serial port is using.
### END INIT INFO
# This file uses settings from /etc/serial.conf to configure the serial devices.
# This file only exists if you chose to configure the serial devices
# by hand yourself. Otherwise serial configuration happens later on
# using the /etc/init.d/setserial file.
#

SETSERIAL=/bin/setserial

# If the serial executable has been removed abort the configuration
[ -x ${SETSERIAL} ] || exit 0

#
# Support devfs when it arrives.
#
if /bin/ls /dev/tts 2> /dev/null 1>&2 ; then
	ALLDEVS="/dev/tts/*"
else
	# No devfs - old naming scheme
	ALLDEVS="/dev/ttyS?"
	if /bin/ls /dev/ttyS?? 2> /dev/null 1>&2 ; then
		ALLDEVS="$ALLDEVS /dev/ttyS??"
	fi
fi

#
# Handle System V init conventions...
#
case $1 in
start | restart | force-reload )
	action="start";
	;;
stop)
	action="stop";
	;;
modload)
	action="modload";
	;;
modsave)
	action="modsave";
	;;
status)
	action="status";
	;;
*)
	action="start";
esac

#
# Is it Start
#

if test $action  = start ; then

  if test -f /etc/serial.conf ; then
        echo "Loading the saved-state of the serial devices from /etc/serial.conf "
        while read device args
        do
               case "$device" in
                   ""|\#*)
                       continue
                       ;;
               esac
           ${SETSERIAL} -z $device $args
           ${SETSERIAL} -bg $device
        done < /etc/serial.conf
  fi
fi