From 775a8d0eee5416fd5eb60ffbb59de8ae8c9bc1cd Mon Sep 17 00:00:00 2001 From: William Hubbs Date: Tue, 6 Nov 2018 16:34:14 -0600 Subject: [PATCH] Create save-keymaps and save-ktermencoding services These services represent the parts of the keymaps and termencoding services which saved the settings back to the root file system so they can be loaded very early in the boot process. These are needed to allow keymaps and termencoding to run earlier in the boot sequence. X-Gentoo-Bug: 446018 X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=446018 --- NEWS.md | 13 +++++++++++++ init.d/.gitignore | 2 ++ init.d/Makefile | 4 ++-- init.d/keymaps.in | 9 ++------- init.d/save-keymaps.in | 28 ++++++++++++++++++++++++++++ init.d/save-termencoding.in | 35 +++++++++++++++++++++++++++++++++++ init.d/termencoding.in | 3 +-- runlevels/Makefile | 3 ++- 8 files changed, 85 insertions(+), 12 deletions(-) create mode 100644 init.d/save-keymaps.in create mode 100644 init.d/save-termencoding.in diff --git a/NEWS.md b/NEWS.md index 0d386190..0378a08e 100644 --- a/NEWS.md +++ b/NEWS.md @@ -4,6 +4,19 @@ OpenRC NEWS This file will contain a list of notable changes for each release. Note the information in this file is in reverse order. +## OpenRC 0.40 + +In this version, the keymaps and termencoding services on Linux needed +to be modified so they do not write to the root file system. This was +done so they can run earlier in the boot sequence. AS a result, you will +need to add save-termencoding and save-keymaps to your boot runlevel. +This can be done as follows: + +``` +# rc-update add save-keymaps boot +# rc-update add save-termencoding boot +``` + ## OpenRC 0.39 This version removes the support for addons. diff --git a/init.d/.gitignore b/init.d/.gitignore index 90abdbbe..8e03e3b9 100644 --- a/init.d/.gitignore +++ b/init.d/.gitignore @@ -41,6 +41,8 @@ rc-enabled rpcbind runsvdir savecore +save-keymaps +save-termencoding swap-blk swclock syslogd diff --git a/init.d/Makefile b/init.d/Makefile index e18f7a9f..c97aeda9 100644 --- a/init.d/Makefile +++ b/init.d/Makefile @@ -23,8 +23,8 @@ SRCS-FreeBSD+= adjkerntz.in devd.in dumpon.in encswap.in ipfw.in \ SRCS-Linux= agetty.in binfmt.in devfs.in cgroups.in dmesg.in hwclock.in \ consolefont.in keymaps.in killprocs.in modules.in \ - mount-ro.in mtab.in numlock.in procfs.in net-online.in sysfs.in \ -termencoding.in + mount-ro.in mtab.in numlock.in procfs.in net-online.in save-keymaps.in \ + save-termencoding.in sysfs.in termencoding.in # Generic BSD scripts SRCS-NetBSD= hostid.in moused.in newsyslog.in pf.in rarpd.in rc-enabled.in \ diff --git a/init.d/keymaps.in b/init.d/keymaps.in index 4bece821..16ddcc96 100644 --- a/init.d/keymaps.in +++ b/init.d/keymaps.in @@ -14,7 +14,7 @@ description="Applies a keymap for the consoles." depend() { need termencoding - after bootmisc clock + after devfs keyword -docker -lxc -openvz -prefix -systemd-nspawn -uml -vserver -xenu } @@ -68,10 +68,5 @@ start() echo "altgr keycode 18 = U+20AC" | loadkeys -q - eend $? fi - - # Save the keymapping for use immediately at boot - if checkpath -W "$RC_LIBEXECDIR"; then - mkdir -p "$RC_LIBEXECDIR"/console - dumpkeys >"$RC_LIBEXECDIR"/console/keymap - fi + return 0 } diff --git a/init.d/save-keymaps.in b/init.d/save-keymaps.in new file mode 100644 index 00000000..f35097ce --- /dev/null +++ b/init.d/save-keymaps.in @@ -0,0 +1,28 @@ +#!@SBINDIR@/openrc-run +# Copyright (c) 2018 Sony Interactive Entertainment, Inc. +# +# This file is part of OpenRC. It is subject to the license terms in +# the LICENSE file found in the top-level directory of this +# distribution and at https://github.com/OpenRC/openrc/blob/master/LICENSE +# This file may not be copied, modified, propagated, or distributed +# except according to the terms contained in the LICENSE file. + +description="Save the keymap for use as early as possible" + +depend() +{ + need termencoding + after bootmisc clock keymaps + keyword -docker -lxc -openvz -prefix -systemd-nspawn -uml -vserver -xenu +} + +start() +{ + # Save the keymapping for use immediately at boot + ebegin "Saving key mapping" + if checkpath -W "$RC_LIBEXECDIR"; then + mkdir -p "$RC_LIBEXECDIR"/console + dumpkeys >"$RC_LIBEXECDIR"/console/keymap + fi + eend $? "Unable to save keymapping" +} diff --git a/init.d/save-termencoding.in b/init.d/save-termencoding.in new file mode 100644 index 00000000..0701264c --- /dev/null +++ b/init.d/save-termencoding.in @@ -0,0 +1,35 @@ +#!@SBINDIR@/openrc-run +# Copyright (c) 2018 Sony Interactive Entertainment, Inc. +# +# This file is part of OpenRC. It is subject to the license terms in +# the LICENSE file found in the top-level directory of this +# distribution and at https://github.com/OpenRC/openrc/blob/master/LICENSE +# This file may not be copied, modified, propagated, or distributed +# except according to the terms contained in the LICENSE file. + +description="Configures terminal encoding." + +ttyn=${rc_tty_number:-${RC_TTY_NUMBER:-12}} +: ${unicode:=${UNICODE}} + +depend() +{ + keyword -docker -lxc -openvz -prefix -systemd-nspawn -uml -vserver -xenu + use root + after bootmisc clock termencoding +} + +start() +{ +ebegin "Saving terminal encoding" + # Save the encoding for use immediately at boot + if checkpath -W "$RC_LIBEXECDIR"; then + mkdir -p "$RC_LIBEXECDIR"/console + if yesno ${unicode:-${UNICODE}}; then + echo "" > "$RC_LIBEXECDIR"/console/unicode + else + rm -f "$RC_LIBEXECDIR"/console/unicode + fi + fi + eend 0 +} diff --git a/init.d/termencoding.in b/init.d/termencoding.in index 86f5b588..41ddc342 100644 --- a/init.d/termencoding.in +++ b/init.d/termencoding.in @@ -17,8 +17,7 @@ ttyn=${rc_tty_number:-${RC_TTY_NUMBER:-12}} depend() { keyword -docker -lxc -openvz -prefix -systemd-nspawn -uml -vserver -xenu - use root - after bootmisc clock + after devfs } start() diff --git a/runlevels/Makefile b/runlevels/Makefile index f000db0d..dbfb59ca 100644 --- a/runlevels/Makefile +++ b/runlevels/Makefile @@ -36,7 +36,8 @@ BOOT-FreeBSD+= hostid modules newsyslog savecore syslogd # FreeBSD specific stuff BOOT-FreeBSD+= adjkerntz dumpon syscons -BOOT-Linux+= binfmt hwclock keymaps modules mtab procfs termencoding +BOOT-Linux+= binfmt hwclock keymaps modules mtab procfs save-keymaps \ + save-termencoding termencoding SHUTDOWN-Linux= killprocs mount-ro SYSINIT-Linux= devfs cgroups dmesg sysfs -- 2.18.1