static-dev-0.1-r2.ebuild 1.07 KB
Newer Older
1
# Copyright 1999-2021 Gentoo Authors
Palica's avatar
Palica committed
2
3
# Distributed under the terms of the GNU General Public License v2

4
EAPI=7
Palica's avatar
Palica committed
5
6
7
8
9
10

DESCRIPTION="A skeleton, statically managed /dev"
HOMEPAGE="https://bugs.gentoo.org/107875"

LICENSE="GPL-2"
SLOT="0"
11
KEYWORDS="~alpha amd64 arm ~hppa ~ia64 ~m68k ~mips ppc ppc64 ~s390 sparc x86"
Palica's avatar
Palica committed
12
13
14
15

RDEPEND="sys-apps/makedev"

pkg_pretend() {
16
17
18
19
20
21
	abort() {
		eerror "We have detected that you currently use udev or devfs or devtmpfs"
		eerror "and this ebuild cannot install to the same mount-point."
		die "Cannot install on udev/devfs tmpfs."
	}

Palica's avatar
Palica committed
22
23
24
25
26
27
28
29
30
	if [[ ${MERGE_TYPE} == "buildonly" ]] ; then
		# User is just compiling which is fine -- all our checks are merge-time.
		return
	fi

	# We want to not clobber udev (tmpfs) or older devfs setups.
	if [[ -d ${ROOT}/dev/.udev || -c ${ROOT}/dev/.devfs ]] ; then
		abort
	fi
31

Palica's avatar
Palica committed
32
	# We also want to not clobber newer devtmpfs setups.
33
	if [[ -z ${ROOT} ]] && \
Palica's avatar
Palica committed
34
35
36
37
38
39
40
41
	   ! awk '$2 == "/dev" && $3 == "devtmpfs" { exit 1 }' /proc/mounts ; then
		abort
	fi
}

pkg_postinst() {
	MAKEDEV -d "${ROOT}"/dev generic sg scd rtc hde hdf hdg hdh input audio video
}