Subject: Re: mergemaster
To: Martti Kuparinen <email@example.com>
From: Jeremy C. Reed <firstname.lastname@example.org>
Date: 11/14/2001 09:58:12
On Wed, 14 Nov 2001, Martti Kuparinen wrote:
> I've written a FreeBSD mergemaster-like utility to compare, merge and
> install files into /etc (from /usr/src/etc). Yes, I've read the previous
> "wars" on this subject but I needed a tool to do the config file update...
> This script does NOT check for any CVS tags but runs cmp to find out
> if the file has been updated in /usr/src/etc or not. And if it has,
> the user gets a diff and possibility to merge the currently installed
> and the new version, see the merged version and finally install it.
Also, have a look at my http://www.reedmedia.net/misc/netbsd/update_etc/
and J. McNeill's http://invisible.yi.org/~jmcneill/netbsd/merge
> And now the question: how should I get a file's permission in a
> /bin/sh script? I don't want to make this script depend on perl but if
> possible use only standard tools like ls, sed and awk.The uid and gid
> are easily retrieved from ls output but I'd like to avoid parsing the
> "-rwxr-xr-x" strings to produce octal number. But can it be avoided?
I am curious, what do you need this for?
I've been think the past month or more that it would be good to either add
options to ls(1) or chmod(1) to output the current file modes in octal or
create another simple tool to do it. It really seems like some stat(1)
tool should exist that could be used like:
$ stat -mn /etc/passwd
$ stat -m /etc/rc.d
/etc/rc.d : 40755
> All comments are welcome: especially permission parsing and suggestion
> for the name. I'll upload this script somewhere when I'm home (I'm on
> business trip right now).
I look forward to seeing your script.
Jeremy C. Reed