Jail for emulators/linux_base

Dag-ErlingSmørgrav des at des.no
Sun Feb 8 04:40:10 PST 2004

"Dan Langille" <dan at langille.org> writes:
> In emulators/linux_base/Makefile, I see this:
> .if !defined(BATCH) && !exists(${LINUXBASE}/dev/null)
>         @${ECHO_MSG} ""
>         @${ECHO_MSG} "You need to create the null device in your 
> jailed Linux environment. Run this"
>         @${ECHO_MSG} "outside the jail, then press enter:"
>         @${ECHO_MSG} ""
>         @${ECHO_MSG} "mkdir -m 0755 -p <Jail root dir>/dev"
>         @${ECHO_MSG} "rm -f <Jail root dir>${LINUXBASE}/dev/null"
>         @${ECHO_MSG} "mknod <Jail root dir>${LINUXBASE}/dev/null c 2 
> 2"
>         @${ECHO_MSG} "chmod 666 <Jail root dir>${LINUXBASE}/dev/null"
>         @${ECHO_MSG} ""
>         @${SH} -c "read line"
> .endif
> Would it not be better to use ${LINUXBASE} instead of <Jail root 
> dir>?  As it stands, the user (namely me) has no idea where <Jail 
> root dir> should be.

The entire check is bogus.  Outside a jail, you already have /dev/null
and therefore don't need to do anything.  Inside a jail, all you need
to do is 'cd /dev && sh MAKEDEV std' (on 4.x) or 'mount_devfs dev
/dev' (on 5.x), and FreeBSD processes need this just as much as Linux
processes.  In either case, you will never have ${LINUXBASE}/dev/null,
just /dev/null.  And finally, it would be trivial and far more user-
friendly for the Makefile to do the required mknod'ing itself rather
than require user intervention.

Dag-Erling Smørgrav - des at des.no

More information about the freebsd-ports mailing list