xref: /dragonfly/etc/rc.d/ttys (revision 4e7eb5cc)
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.2 2003/11/19 10:32:45 eirikn 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	FreeBSD)
33		# Whack the pty perms back into shape.
34		#	XXX:	there may be more ptys than this; maybe use
35		#		sysctl to find out how many?
36		#
37		if ls /dev/tty[pqrsPQRS]* > /dev/null 2>&1; then
38			chflags 0 /dev/tty[pqrsPQRS]*
39			chmod 666 /dev/tty[pqrsPQRS]*
40			chown root:wheel /dev/tty[pqrsPQRS]*
41		fi
42		;;
43	NetBSD)
44		#	set flags on ttys.
45		#	(do early, in case they use tty for SLIP in network)
46		#
47		echo "Setting tty flags."
48		ttyflags -a
49
50		#	setup ptys
51		#
52		#	XXX:	there may be more ptys than this; maybe use
53		#		sysctl to find out how many?
54		#
55		chmod 666 /dev/tty[pqrs]*
56		;;
57	esac
58}
59
60load_rc_config $name
61run_rc_command "$1"
62