Gentoo Archives: gentoo-commits

From: William Hubbs <williamh@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-apps/openrc/, sys-apps/openrc/files/
Date: Thu, 14 Oct 2021 05:32:17
Message-Id: 1634189520.c6e45be273accf314fb925d977597adde67ba825.williamh@gentoo
1 commit: c6e45be273accf314fb925d977597adde67ba825
2 Author: William Hubbs <williamh <AT> gentoo <DOT> org>
3 AuthorDate: Thu Oct 14 05:31:29 2021 +0000
4 Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
5 CommitDate: Thu Oct 14 05:32:00 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c6e45be2
7
8 sys-apps/openrc: 0.44.6-r1 bump
9
10 Closes: https://bugs.gentoo.org/816900
11 Package-Manager: Portage-3.0.20, Repoman-3.0.3
12 Signed-off-by: William Hubbs <williamh <AT> gentoo.org>
13
14 .../openrc/files/openrc-0.44.6-fix-checkpath.patch | 33 ++++
15 sys-apps/openrc/openrc-0.44.6-r1.ebuild | 168 +++++++++++++++++++++
16 2 files changed, 201 insertions(+)
17
18 diff --git a/sys-apps/openrc/files/openrc-0.44.6-fix-checkpath.patch b/sys-apps/openrc/files/openrc-0.44.6-fix-checkpath.patch
19 new file mode 100644
20 index 00000000000..e1ef97d981d
21 --- /dev/null
22 +++ b/sys-apps/openrc/files/openrc-0.44.6-fix-checkpath.patch
23 @@ -0,0 +1,33 @@
24 +From cc45b55f895d0c21b5ac3e5a65b0bf00f76adeb7 Mon Sep 17 00:00:00 2001
25 +From: Sam James <sam@g.o>
26 +Date: Fri, 8 Oct 2021 04:52:55 +0100
27 +Subject: [PATCH 1/2] checkpath: fix allocation size of path buffer
28 +
29 +strlen's return value isn't enough to be used
30 +directly for (x)malloc; it doesn't include
31 +the null byte at the end of the string.
32 +
33 +X-Gentoo-Bug: 816900
34 +X-Gentoo-Bug-URL: https://bugs.gentoo.org/816900
35 +Fixes: #459
36 +Fixes: #462
37 +---
38 + src/rc/checkpath.c | 2 +-
39 + 1 file changed, 1 insertion(+), 1 deletion(-)
40 +
41 +diff --git a/src/rc/checkpath.c b/src/rc/checkpath.c
42 +index bab22692..c4dd7d9d 100644
43 +--- a/src/rc/checkpath.c
44 ++++ b/src/rc/checkpath.c
45 +@@ -151,7 +151,7 @@ static char *clean_path(char *path)
46 + char *ch;
47 + char *ch2;
48 + char *str;
49 +- str = xmalloc(strlen(path));
50 ++ str = xmalloc(strlen(path) + 1);
51 + ch = path;
52 + ch2 = str;
53 + while (true) {
54 +--
55 +2.32.0
56 +
57
58 diff --git a/sys-apps/openrc/openrc-0.44.6-r1.ebuild b/sys-apps/openrc/openrc-0.44.6-r1.ebuild
59 new file mode 100644
60 index 00000000000..4886ab05cc4
61 --- /dev/null
62 +++ b/sys-apps/openrc/openrc-0.44.6-r1.ebuild
63 @@ -0,0 +1,168 @@
64 +# Copyright 1999-2021 Gentoo Authors
65 +# Distributed under the terms of the GNU General Public License v2
66 +
67 +EAPI=7
68 +
69 +inherit flag-o-matic meson pam toolchain-funcs
70 +
71 +DESCRIPTION="OpenRC manages the services, startup and shutdown of a host"
72 +HOMEPAGE="https://github.com/openrc/openrc/"
73 +
74 +if [[ ${PV} =~ ^9{4,}$ ]]; then
75 + EGIT_REPO_URI="https://github.com/OpenRC/${PN}.git"
76 + inherit git-r3
77 +else
78 + SRC_URI="https://github.com/OpenRC/openrc/archive/${PV}.tar.gz -> ${P}.tar.gz"
79 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
80 +fi
81 +
82 +LICENSE="BSD-2"
83 +SLOT="0"
84 +IUSE="audit bash debug ncurses pam newnet +netifrc selinux sysv-utils unicode"
85 +
86 +COMMON_DEPEND="
87 + ncurses? ( sys-libs/ncurses:0= )
88 + pam? ( sys-libs/pam )
89 + audit? ( sys-process/audit )
90 + sys-process/psmisc
91 + !<sys-process/procps-3.3.9-r2
92 + selinux? (
93 + sys-apps/policycoreutils
94 + >=sys-libs/libselinux-2.6
95 + )
96 + !<sys-apps/baselayout-2.1-r1
97 + !<sys-fs/udev-init-scripts-27"
98 +DEPEND="${COMMON_DEPEND}
99 + virtual/os-headers
100 + ncurses? ( virtual/pkgconfig )"
101 +RDEPEND="${COMMON_DEPEND}
102 + bash? ( app-shells/bash )
103 + !prefix? (
104 + sysv-utils? (
105 + !sys-apps/systemd[sysv-utils(-)]
106 + !sys-apps/sysvinit
107 + )
108 + !sysv-utils? ( >=sys-apps/sysvinit-2.86-r6[selinux?] )
109 + virtual/tmpfiles
110 + )
111 + selinux? (
112 + >=sec-policy/selinux-base-policy-2.20170204-r4
113 + >=sec-policy/selinux-openrc-2.20170204-r4
114 + )
115 + !<app-shells/gentoo-bashcomp-20180302
116 + !<app-shells/gentoo-zsh-completions-20180228
117 +"
118 +
119 +PDEPEND="netifrc? ( net-misc/netifrc )"
120 +
121 +PATCHES=(
122 + "${FILESDIR}"/${P}-fix-checkpath.patch
123 +)
124 +
125 +src_configure() {
126 + local emesonargs=(
127 + $(meson_feature audit)
128 + "-Dbranding=\"Gentoo Linux\""
129 + $(meson_use newnet)
130 + -Dos=Linux
131 + $(meson_use pam)
132 + $(meson_feature selinux)
133 + -Dshell=$(usex bash /bin/bash /bin/sh)
134 + $(meson_use sysv-utils sysvinit)
135 + -Dtermcap=$(usev ncurses)
136 + )
137 + # export DEBUG=$(usev debug)
138 + meson_src_configure
139 +}
140 +
141 +# set_config <file> <option name> <yes value> <no value> test
142 +# a value of "#" will just comment out the option
143 +set_config() {
144 + local file="${ED}/$1" var=$2 val com
145 + eval "${@:5}" && val=$3 || val=$4
146 + [[ ${val} == "#" ]] && com="#" && val='\2'
147 + sed -i -r -e "/^#?${var}=/{s:=([\"'])?([^ ]*)\1?:=\1${val}\1:;s:^#?:${com}:}" "${file}"
148 +}
149 +
150 +set_config_yes_no() {
151 + set_config "$1" "$2" YES NO "${@:3}"
152 +}
153 +
154 +src_install() {
155 + meson_install
156 +
157 + keepdir /lib/rc/tmp
158 +
159 + # Setup unicode defaults for silly unicode users
160 + set_config_yes_no /etc/rc.conf unicode use unicode
161 +
162 + # Cater to the norm
163 + set_config_yes_no /etc/conf.d/keymaps windowkeys '(' use x86 '||' use amd64 ')'
164 +
165 + # On HPPA, do not run consolefont by default (bug #222889)
166 + if use hppa; then
167 + rm -f "${ED}"/etc/runlevels/boot/consolefont
168 + fi
169 +
170 + # Support for logfile rotation
171 + insinto /etc/logrotate.d
172 + newins "${FILESDIR}"/openrc.logrotate openrc
173 +
174 + if use pam; then
175 + # install gentoo pam.d files
176 + newpamd "${FILESDIR}"/start-stop-daemon.pam start-stop-daemon
177 + newpamd "${FILESDIR}"/start-stop-daemon.pam supervise-daemon
178 + fi
179 +
180 + # install documentation
181 + dodoc ChangeLog *.md
182 +}
183 +
184 +pkg_preinst() {
185 + # avoid default thrashing in conf.d files when possible #295406
186 + if [[ -e "${EROOT}"/etc/conf.d/hostname ]] ; then
187 + (
188 + unset hostname HOSTNAME
189 + source "${EROOT}"/etc/conf.d/hostname
190 + : ${hostname:=${HOSTNAME}}
191 + [[ -n ${hostname} ]] && set_config /etc/conf.d/hostname hostname "${hostname}"
192 + )
193 + fi
194 +
195 + # set default interactive shell to sulogin if it exists
196 + set_config /etc/rc.conf rc_shell /sbin/sulogin "#" test -e /sbin/sulogin
197 + return 0
198 +}
199 +
200 +pkg_postinst() {
201 + if use hppa; then
202 + elog "Setting the console font does not work on all HPPA consoles."
203 + elog "You can still enable it by running:"
204 + elog "# rc-update add consolefont boot"
205 + fi
206 +
207 + # Added for 0.35.
208 + if [[ ! -h "${EROOT}"/lib ]]; then
209 + if [[ -d "${EROOT}/$(get_libdir)"/rc ]]; then
210 + cp -RPp "${EROOT}/$(get_libdir)/rc" "${EROOT}"/lib
211 + fi
212 + fi
213 +
214 + if ! use newnet && ! use netifrc; then
215 + ewarn "You have emerged OpenRc without network support. This"
216 + ewarn "means you need to SET UP a network manager such as"
217 + ewarn " net-misc/netifrc, net-misc/dhcpcd, net-misc/connman,"
218 + ewarn " net-misc/NetworkManager, or net-vpn/badvpn."
219 + ewarn "Or, you have the option of emerging openrc with the newnet"
220 + ewarn "use flag and configuring /etc/conf.d/network and"
221 + ewarn "/etc/conf.d/staticroute if you only use static interfaces."
222 + ewarn
223 + fi
224 +
225 + if use newnet && [ ! -e "${EROOT}"/etc/runlevels/boot/network ]; then
226 + ewarn "Please add the network service to your boot runlevel"
227 + ewarn "as soon as possible. Not doing so could leave you with a system"
228 + ewarn "without networking."
229 + ewarn
230 + fi
231 +}