summaryrefslogtreecommitdiff
blob: 963a9ab13efa119f86345922df7f7b9b653cd5bb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# Copyright 1999-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sys-libs/glibc/files/eblits/pkg_pretend.eblit,v 1.1 2015/05/27 13:55:42 vapier Exp $

check_devpts() {
	# Make sure devpts is mounted correctly for use w/out setuid pt_chown.

	# If merely building the binary package, then there's nothing to verify.
	[[ ${MERGE_TYPE} == "buildonly" ]] && return

	# Only sanity check when installing the native glibc.
	[[ ${ROOT} != "/" ]] && return

	# Older versions always installed setuid, so no need to check.
	in_iuse suid || return

	# If they're opting in to the old suid code, then no need to check.
	use suid && return

	if awk '$3 == "devpts" && $4 ~ /[, ]gid=5[, ]/ { exit 1 }' /proc/mounts ; then
		eerror "In order to use glibc with USE=-suid, you must make sure that"
		eerror "you have devpts mounted at /dev/pts with the gid=5 option."
		eerror "Openrc should do this for you, so you should check /etc/fstab"
		eerror "and make sure you do not have any invalid settings there."
		# Do not die on older kernels as devpts did not export these settings #489520.
		if version_is_at_least 2.6.25 $(uname -r) ; then
			die "mount & fix your /dev/pts settings"
		fi
	fi
}

eblit-glibc-pkg_pretend() {
	# For older EAPIs, this is run in pkg_preinst.
	if [[ ${EAPI:-0} != [0123] ]] ; then
		check_devpts
	fi
}