This is the mail archive of the cygwin-apps@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: /etc/profile, mk[passwd|group|group_l_d] messages


> Hows this...?  (edit inline)
> 
> oops, corrected some typos.

Instead of running `id -ng` several times you can hard code the values
(see XXX below)

> case "`id -ng`" in
> mkpasswd )
>   echo "Your group is currently \"`id -ng`\".  This indicates that"
XXX echo "Your group is currently \"mkpasswd\".  This indicates that"
>   echo "the /etc/passwd (and possibly /etc/group) files should be rebuilt."
>   echo "See the man pages for mkpasswd and mkgroup then, for example, run"
>   echo "mkpasswd -l [-d] > /etc/passwd"
>   echo "mkgroup  -l [-d] > /etc/group"
>   echo "as appropriate.  Note that the -d switch is necessary for"
>   echo "domain users." ;;
> mkgroup )
>   echo "Your group is currently \"`id -ng`\".  This indicates that"
XXX ditto
>   echo "the /etc/group (and possibly /etc/passwd) files should be rebuilt."
>   echo "See the man pages for mkpasswd and mkgroup then, for example, run"
>   echo "mkpasswd -l [-d] > /etc/passwd"
>   echo "mkgroup  -l [-d] > /etc/group"
>   echo "as appropriate.  Note that the -d switch is necessary for"
>   echo "domain users." ;;
> mkgroup_l_d )
>   echo "The /etc/group file doesn't contain the domain groups."
>   echo "See the man page for mkgroup and then, for example, run"
>   echo "mkgroup -l -d > /etc/group"
>   echo "as appropriate."
XXX echo "Your group name is currently \"mkpasswd_l_d\". This indicates that not all"
XXX echo "domain users and groups are listed in the "/etc/passwd and /etc/group files."
XXX echo "See the man pages for mkpasswd and mkgroup then, for example, run"
XXX echo "mkpasswd -l [-d] > /etc/passwd"
XXX echo "mkgroup  -l [-d] > /etc/group"
>   echo
>   echo "You can safely ignore this message"
XXX echo "This message is only displayed once and can be safely ignored."
>   # only display the above once
>   cat /etc/group | sed -e 's/mkgroup_l_d/mkgroup-l-d/g' >
>   /etc/group.new mv /etc/group /etc/group.mkgroup_l_d
>   mv /etc/group.new /etc/group

Let's make it fail safe, avoid invoking cat and set the mode
	sed -e 's/mkgroup_l_d/mkgroup-l-d/' /etc/group > /etc/group.new \
        && mv /etc/group /etc/group.mkgroup_l_d
        && (mv /etc/group.new /etc/group ||  mv /etc/group.mkgroup_l_d /etc/group ; )
	chmod a+r /etc/group 
        rm -f /etc/group.mkgroup_l_d

Pierre


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]