1 |
commit: d7bbb0f5830e1ec4df1ec52714d70ac6b0a81878 |
2 |
Author: William Hubbs <w.d.hubbs <AT> gmail <DOT> com> |
3 |
AuthorDate: Thu Mar 9 21:23:02 2017 +0000 |
4 |
Commit: William Hubbs <williamh <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu Mar 9 21:23:02 2017 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/openrc.git/commit/?id=d7bbb0f5 |
7 |
|
8 |
add agetty service |
9 |
|
10 |
The agetty service is an alternate way to manage gettys with agetty |
11 |
under Linux which is separate from an external init system. |
12 |
|
13 |
NEWS.md | 4 ++++ |
14 |
agetty-guide.md | 19 +++++++++++++++++++ |
15 |
conf.d/Makefile | 4 ++-- |
16 |
conf.d/agetty | 8 ++++++++ |
17 |
init.d/Makefile | 6 +++--- |
18 |
init.d/agetty.in | 31 +++++++++++++++++++++++++++++++ |
19 |
6 files changed, 67 insertions(+), 5 deletions(-) |
20 |
|
21 |
diff --git a/NEWS.md b/NEWS.md |
22 |
index 6e36b2b2..6f4f9777 100644 |
23 |
--- a/NEWS.md |
24 |
+++ b/NEWS.md |
25 |
@@ -9,6 +9,10 @@ Since the deptree2dot tool and the perl requirement are completely |
26 |
optional, the deptree2dot tool has been moved to the support directory. |
27 |
As a result, the MKTOOLS=yes/no switch has been removed from the makefiles. |
28 |
|
29 |
+This version adds the agetty service which can be used to spawn |
30 |
+agetty on a specific terminal. This is currently documented in the |
31 |
+agetty-guide.md file at the top level of this distribution. |
32 |
+ |
33 |
## OpenRC-0.23 |
34 |
|
35 |
The tmpfiles.d processing code, which was part of previous versions of |
36 |
|
37 |
diff --git a/agetty-guide.md b/agetty-guide.md |
38 |
new file mode 100644 |
39 |
index 00000000..ce46a830 |
40 |
--- /dev/null |
41 |
+++ b/agetty-guide.md |
42 |
@@ -0,0 +1,19 @@ |
43 |
+# Setting up the agetty service in OpenRC |
44 |
+ |
45 |
+The agetty service is an OpenRC specific way to monitor and respawn a |
46 |
+getty, using agetty, on Linux. To use this method, make sure you aren't |
47 |
+spawning a getty manager for this port some other way (such as through |
48 |
+sysvinit/inittab), then run the following commands as root. |
49 |
+ |
50 |
+Note that [port] refers to the port you are spawning the getty on, and |
51 |
+not the full path to it. For example, tty0 or ttyS0instead of /dev/tty0 |
52 |
+or /dev/ttyS0. |
53 |
+tty0 or ttyS0, not the full path to it (for example, tty0 or ttyS0 and |
54 |
+ |
55 |
+``` |
56 |
+# cd /etc/init.d |
57 |
+# ln -s agetty agetty.[port] |
58 |
+# cd /etc/conf.d |
59 |
+# cp agetty agetty.[port] |
60 |
+#rc-update add agetty.[port] [runlevel] |
61 |
+``` |
62 |
|
63 |
diff --git a/conf.d/Makefile b/conf.d/Makefile |
64 |
index 6c7962b6..64168374 100644 |
65 |
--- a/conf.d/Makefile |
66 |
+++ b/conf.d/Makefile |
67 |
@@ -12,8 +12,8 @@ include ${MK}/os.mk |
68 |
|
69 |
CONF-FreeBSD= ipfw modules moused powerd rarpd savecore syscons |
70 |
|
71 |
-CONF-Linux= consolefont devfs dmesg hwclock keymaps killprocs modules mtab \ |
72 |
- net-online |
73 |
+CONF-Linux= agetty consolefont devfs dmesg hwclock keymaps killprocs modules \ |
74 |
+ mtab net-online |
75 |
|
76 |
CONF-NetBSD= moused rarpd savecore |
77 |
|
78 |
|
79 |
diff --git a/conf.d/agetty b/conf.d/agetty |
80 |
new file mode 100644 |
81 |
index 00000000..012eb8de |
82 |
--- /dev/null |
83 |
+++ b/conf.d/agetty |
84 |
@@ -0,0 +1,8 @@ |
85 |
+# Set the baud rate of the terminal line |
86 |
+#baud="" |
87 |
+ |
88 |
+# set the terminal type |
89 |
+#termtype="linux" |
90 |
+ |
91 |
+# extra options to pass to agetty for this port |
92 |
+#agetty_options="" |
93 |
|
94 |
diff --git a/init.d/Makefile b/init.d/Makefile |
95 |
index 75c88adc..3ecab06b 100644 |
96 |
--- a/init.d/Makefile |
97 |
+++ b/init.d/Makefile |
98 |
@@ -21,9 +21,9 @@ SRCS-FreeBSD= hostid.in modules.in moused.in newsyslog.in pf.in rarpd.in \ |
99 |
SRCS-FreeBSD+= adjkerntz.in devd.in dumpon.in encswap.in ipfw.in \ |
100 |
modules.in modules-load.in mixer.in nscd.in powerd.in syscons.in |
101 |
|
102 |
-SRCS-Linux= binfmt.in devfs.in dmesg.in hwclock.in consolefont.in keymaps.in \ |
103 |
- killprocs.in modules.in modules-load.in mount-ro.in mtab.in numlock.in \ |
104 |
- procfs.in net-online.in sysfs.in termencoding.in |
105 |
+SRCS-Linux= agetty.in binfmt.in devfs.in dmesg.in hwclock.in consolefont.in \ |
106 |
+ keymaps.in killprocs.in modules.in modules-load.in mount-ro.in mtab.in \ |
107 |
+ numlock.in procfs.in net-online.in sysfs.in termencoding.in |
108 |
|
109 |
# Generic BSD scripts |
110 |
SRCS-NetBSD= hostid.in moused.in newsyslog.in pf.in rarpd.in rc-enabled.in \ |
111 |
|
112 |
diff --git a/init.d/agetty.in b/init.d/agetty.in |
113 |
new file mode 100644 |
114 |
index 00000000..297733cb |
115 |
--- /dev/null |
116 |
+++ b/init.d/agetty.in |
117 |
@@ -0,0 +1,31 @@ |
118 |
+#!@SBINDIR@/openrc-run |
119 |
+# Copyright (c) 2017 The OpenRC Authors. |
120 |
+# See the Authors file at the top-level directory of this distribution and |
121 |
+# https://github.com/OpenRC/openrc/blob/master/AUTHORS |
122 |
+# |
123 |
+# This file is part of OpenRC. It is subject to the license terms in |
124 |
+# the LICENSE file found in the top-level directory of this |
125 |
+# distribution and at https://github.com/OpenRC/openrc/blob/master/LICENSE |
126 |
+# This file may not be copied, modified, propagated, or distributed |
127 |
+# except according to the terms contained in the LICENSE file. |
128 |
+ |
129 |
+description="start agetty on a terminal line" |
130 |
+supervisor=supervise-daemon |
131 |
+port="${RC_SVCNAME#*.}" |
132 |
+term_type="${term_type:-linux}" |
133 |
+command=/sbin/agetty |
134 |
+command_args_foreground="${agetty_options} ${port} ${baud} ${termtype}" |
135 |
+pidfile="/run/${RC_SVCNAME}.pid" |
136 |
+ |
137 |
+depend() { |
138 |
+ after local |
139 |
+} |
140 |
+ |
141 |
+start_pre() { |
142 |
+ if [ -z "$port" ]; then |
143 |
+ eerror "${RC_SVCNAME} cannot be started directly. You must create" |
144 |
+ eerror "symbolic links to it for the ports you want to start" |
145 |
+ eerror "agetty on and add those to the appropriate runlevels." |
146 |
+ return 1 |
147 |
+ fi |
148 |
+} |