Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. =================================================================== RCS file: /ftp/cvs/cvsroot/src/etc/MAKEDEV.tmpl,v rcsdiff: /ftp/cvs/cvsroot/src/etc/MAKEDEV.tmpl,v: warning: Unknown phrases like `commitid ...;' are present. retrieving revision 1.113.2.5 retrieving revision 1.113.2.6 diff -u -p -r1.113.2.5 -r1.113.2.6 --- src/etc/MAKEDEV.tmpl 2008/11/29 20:44:51 1.113.2.5 +++ src/etc/MAKEDEV.tmpl 2009/01/16 23:01:09 1.113.2.6 @@ -1,5 +1,5 @@ #!/bin/sh - -# $NetBSD: MAKEDEV.tmpl,v 1.113.2.5 2008/11/29 20:44:51 bouyer Exp $ +# $NetBSD: MAKEDEV.tmpl,v 1.113.2.6 2009/01/16 23:01:09 bouyer Exp $ # # Copyright (c) 2003,2007,2008 The NetBSD Foundation, Inc. # All rights reserved. @@ -288,12 +288,19 @@ # -# Apart from a few lines right at the end, this file should consist -# entirely of function definitions. +# NOTE: # -# This file is used both as a standalone script (via "sh ./MAKEDEV all" -# or similar), and as a function library (via "MAKEDEV_AS_LIBRARY=1 . -# MAKEDEV" from MAKEDEV.local). +# * MAKEDEV is used both as a standalone script (via "sh ./MAKEDEV +# all" or similar), and as a function library for MAKEDEV.local (via +# "MAKEDEV_AS_LIBRARY=1 . MAKEDEV"). Because of this, the script +# should consist almost entirely of function definitions, apart from a +# few lines right at the end. +# +# * MAKEDEV may be executed in an environment that is missing some +# common commands. For example, it may be executed from a minimal +# system used during installation, or it may be executed early in the +# boot sequence before most file systems have been mounted. It may +# also be executed in a cross-build environment on a non-NetBSD host. # usage() @@ -477,14 +484,32 @@ setup() # only allow read&write for owner by default umask 077 - # Check if we have fdesc mounted + # Set fdesc_mounted=true if the fdesc file system is mounted + # on the current directory (typically "/dev"). + # Later, this will be used to suppress creation of device nodes + # that are supplied by the fdesc file system. + # + fdesc_mounted=false if [ -d fd ]; then - case "$(df fd)" in - *fdesc*) nofdesc=false;; - *) nofdesc=true;; + # Parse the output from "mount -u -o nosuchoption .". + # We don't parse the output from df(1) because that's + # less likely to be available on install media. + # + # If the current directory is a mount point for the + # fdesc file system, then the expected output (whether + # or not the current user is root) is: + # mount_fdesc: -o suchoption: option not supported. + # + # If the current directory is not a mount point, then + # the expected output is: + # mount: .: unknown special file or file system. + # + # If we are not running on NetBSD, or mount(8) is not + # found, then we should get some other error message. + # + case "$({ LC_ALL=C mount -u -o nosuchoption . ; } 2>&1)" in + *mount_fdesc*) fdesc_mounted=true ;; esac - else - nofdesc=true fi # do_force requires mknod @@ -783,7 +808,7 @@ std) mkdev zero c %mem_chr% 12 666 mkdev klog c %log_chr% 0 600 mkdev ksyms c %ksyms_chr% 0 444 - if $nofdesc; then + if ! $fdesc_mounted; then mkdev tty c %ctty_chr% 0 666 mkdev stdin c %filedesc_chr% 0 666 mkdev stdout c %filedesc_chr% 1 666 @@ -909,7 +934,7 @@ wskbd*) ;; fd) - if $nofdesc; then + if ! $fdesc_mounted; then makedir fd 755 n=0 while [ $n -lt 64 ]