summaryrefslogblamecommitdiff
path: root/sys-fs/static-dev/static-dev-0.1.ebuild
blob: dc503ee6d1db263714c7d61396b1c3d6797b6fc7 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
                                    
                                                                  
 
      

                                                 
                                         



               
                                                        

       
                         
 
          




                                                                                  
 



                                                                                  
                      
          



                  
                                                            
 
                                                                


                                                    
                                                                 
 
                                


                                  
 
# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=7

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

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="amd64 arm hppa m68k ~mips ppc ppc64 sparc x86"
IUSE=""

DEPEND="sys-apps/makedev"

_abort() {
	echo
	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."
}

pkg_pretend() {
	# We also want to not clobber newer devtmpfs setups.
	if [[ ${ROOT} == "/" ]] && \
	   ! awk '$2 == "/dev" && $3 == "devtmpfs" { exit 1 }' /proc/mounts ; then
		_abort
	fi
}

src_install() {
	dodir /dev
	cd "${ED}/dev/" || die "Unable to descend into /dev"

	local classes="generic console sda sdb sdc ptmx ram rtc"

	einfo "Creating device nodes using classes:"
	einfo "  ${classes}"
	[[ -n "${EXTRA_CLASSES}" ]] && einfo "  ${EXTRA_CLASSES}"

	MAKEDEV -d "${ED}/dev" \
		${classes} \
		${EXTRA_CLASSES} \
		|| die
}