Subject: Re: MAKEDEV prob
To: David Laight <david@l8s.co.uk>
From: Luke Mewburn <lukem@netbsd.org>
List: current-users
Date: 05/08/2003 14:56:00
On Wed, May 07, 2003 at 05:18:50PM +0100, David Laight wrote:
  | > No. Just as chmod and chown isn't...
  | > 
  | > Somebody should probably file a pr on that. If you boot a machine without
  | > /dev populated, and /usr on another disk, you'll get *lots* of errors
  | > about not finding chmod and chown.
  | 
  | I could always commit my version of mknod that has '-u uid', '-g gid'
  | and '-m mode' arguments and then hack all the MAKEDEV scripts...

I wouldn't mind having a look over your changes first, because I have
some thoughts on extra features.

One idea is adding a flag (`-n' ?) that performs the following test:
	if (nflag && exists(file)) {
		if (foo's dev_t & type are correct)
			exit(0);
		unlink(foo);
	}
	mknod(foo)
	// optionally
	chmod(foo)
	chown(foo)

This means we could replace:
	rm -f foo
	mknod .... foo; chmod 444 foo; chown u:g foo
with
	mknod -n -u u -g g -m 444 foo

Which has the advantages:
    *	It's faster (as you know ;-)
    *	It doesn't depend upon /usr being mounted for chown/chgrp
    *	Existing devices with the correct type but locally changed
	permissions don't unnecessarily get removed and recreated
	with the wrong perms

Luke.