delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2014/04/11/03:20:46

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:message-id:date:from:mime-version:to:subject
:references:in-reply-to:content-type:content-transfer-encoding;
q=dns; s=default; b=GDsZSvYppzP4t6Z9WZa+1Mia0oURkOmkvmpfGhFUwyf
XVvCEtMyf1w9LzblIU5xyfkW1y10OIzGRO6brvHzAQoEio2j1JPTXbzirTV4Qnkc
mOHHaSp/j/PtL0494k6nyrGriU4HlPl6x5H7AkMFq6pSQlllFrBtExZS4V0dO5VM
=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:message-id:date:from:mime-version:to:subject
:references:in-reply-to:content-type:content-transfer-encoding;
s=default; bh=fvt/7hiVOF/IX0z7BKSJ805AYS4=; b=agQDgzNUKU6fcCa2s
6Onma45HdlDY2y6gvB13Bfb1PxqIumg3E/UmQckShWaHB0XK9eLqf6D/KusTuFwn
LcK3HwLOxJC9ZCrSkju9HzFbE/HStjr0kNglbYEe2MH4p3zIA99RvjQoafklb7Oi
+UwVgdYV2wpWh71DCzcsUZ8JLw=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=3.1 required=5.0 tests=AWL,BAYES_50,FOREIGN_BODY,RCVD_IN_DNSWL_NONE,SPF_HELO_PASS autolearn=no version=3.3.2
X-HELO: moutng.kundenserver.de
Message-ID: <534797B5.3080801@towo.net>
Date: Fri, 11 Apr 2014 09:20:21 +0200
From: Thomas Wolff <towo AT towo DOT net>
User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:24.0) Gecko/20100101 Thunderbird/24.4.0
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: [PATCH] base-files-4.2-1: Change prompt if running with admin rights
References: <53458036 DOT 1010307 AT t-online DOT de> <877g6ys69r DOT fsf AT Rainer DOT invalid> <1187249515 DOT 20140410053930 AT yandex DOT ru>
In-Reply-To: <1187249515.20140410053930@yandex.ru>
X-TagToolbar-Keys: D20140411092021093
X-IsSubscribed: yes

Am 10.04.2014 03:39, schrieb Andrey Repin:
> Greetings, Achim Gratz!
>
>> Christian Franke writes:
>>> Attached is an updated version of:
>>> https://sourceware.org/ml/cygwin/2012-02/msg00806.html
>> 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"
   fi

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

---
Diese E-Mail ist frei von Viren und Malware, denn der avast! Antivirus Schutz ist aktiv.
http://www.avast.com


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019