This is the mail archive of the cygwin 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: [PATCH] base-files-4.2-1: Change prompt if running with admin rights

Am 10.04.2014 03:39, schrieb Andrey Repin:
Greetings, Achim Gratz!

Christian Franke writes:
Attached is an updated version of:
I'll put this on hold until the AD integration has landed in Cygwin
(which will require some larger changes anyway).
Generally I'd prefer to move such things that depend on personal
preferences like setting up prompts into profile.d where they are easier
to change and maintain independently from core system functionality.
Using the registry to check for administrative privileges is clever,
But indirect.
It does not guarantee, that a user have administrator rights, only that it has
access to the specified registry key.

however I'm wondering why we shouldn't simply check via id (that's what
I'm doing personally at the moment).
Unless there's a way to ask "if we're a part of <certain group>" or more
direct questions, it would involve much tinkering.
And I agree, that all tinkering needs to go into personal profile.
I use this in .bashrc (to embed $rootmark in an ESC sequence in PS1 later).
I think it doesn't have specific dependencies and also it's portable (except the group names are Windows ones...).

  if id | grep -e "gid=.*(root)" -e "gid=.*(Administrators)" > /dev/null
  then    rootmark="30;41"; dirmark=7
  elif id | grep -e "gid=.*(Power Users)" > /dev/null
  then    rootmark="30;43"; dirmark=7
  else    rootmark=0; dirmark="33;44"

Also I embed [$SHLVL] in PS1 unless it's 0, just as a suggestion.

Diese E-Mail ist frei von Viren und Malware, denn der avast! Antivirus Schutz ist aktiv.

Problem reports:
Unsubscribe info:

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