xref: /dragonfly/etc/rc.d/ttys (revision 1d1731fa)
1#!/bin/sh
2#
3# $NetBSD: ttys,v 1.1.1.1 2000/03/10 11:53:24 lukem Exp $
4# $FreeBSD: src/etc/rc.d/ttys,v 1.3 2002/09/06 16:18:05 gordon Exp $
5# $DragonFly: src/etc/rc.d/ttys,v 1.1 2003/07/24 06:35:37 dillon Exp $
6#
7
8# PROVIDE: tty
9# REQUIRE: root
10# KEYWORD: DragonFly FreeBSD NetBSD
11
12. /etc/rc.subr
13
14name="ttyflags"
15start_cmd="ttyflags_start"
16stop_cmd=":"
17
18ttyflags_start()
19{
20	case ${OSTYPE} in
21	DragonFly)
22		# Whack the pty perms back into shape.
23                #       XXX:    there may be more ptys than this; maybe use
24                #               sysctl to find out how many?
25                #
26                if ls /dev/tty[pqrsPQRS]* > /dev/null 2>&1; then
27                        chflags 0 /dev/tty[pqrsPQRS]*
28                        chmod 666 /dev/tty[pqrsPQRS]*
29                        chown root:wheel /dev/tty[pqrsPQRS]*
30                fi
31                ;;
32
33	FreeBSD)
34
35		# Whack the pty perms back into shape.
36		#	XXX:	there may be more ptys than this; maybe use
37		#		sysctl to find out how many?
38		#
39		if ls /dev/tty[pqrsPQRS]* > /dev/null 2>&1; then
40			chflags 0 /dev/tty[pqrsPQRS]*
41			chmod 666 /dev/tty[pqrsPQRS]*
42			chown root:wheel /dev/tty[pqrsPQRS]*
43		fi
44		;;
45	NetBSD)
46		#	set flags on ttys.
47		#	(do early, in case they use tty for SLIP in network)
48		#
49		echo "Setting tty flags."
50		ttyflags -a
51
52		#	setup ptys
53		#
54		#	XXX:	there may be more ptys than this; maybe use
55		#		sysctl to find out how many?
56		#
57		chmod 666 /dev/tty[pqrs]*
58		;;
59	esac
60}
61
62load_rc_config $name
63run_rc_command "$1"
64