From 08785e51dfecd7f2ebc801df58971c787c33ae47 Mon Sep 17 00:00:00 2001 Message-Id: <08785e51dfecd7f2ebc801df58971c787c33ae47.1718322817.git.mdw@distorted.org.uk> From: Mark Wooding Date: Fri, 8 May 2020 23:45:11 +0100 Subject: [PATCH] dot/shell-rc: Behave usefully in Cygwin elevated sessions. Organization: Straylight/Edgeware From: Mark Wooding Decorate the prompt as if we're root -- which, really, we basically are -- and put a `%admin' marker in the window title. --- dot/shell-rc | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/dot/shell-rc b/dot/shell-rc index 9857a82..7313cee 100644 --- a/dot/shell-rc +++ b/dot/shell-rc @@ -67,12 +67,26 @@ __mdw_hqual=$__mdw_hqual${SCHROOT_CHROOT_NAME+/$SCHROOT_CHROOT_NAME} __mdw_hqual=$__mdw_hqual${CROSS_BUILDENV+/$CROSS_BUILDENV} __mdw_set_prompt_hacks () { host=$__mdw_host; dir=""; } +__mdw_system=$(uname -s) : ${USER-${LOGNAME-$(id -un)}} __mdw_user=$USER case $(id -u) in - 0) __mdw_rootp=t ;; - *) __mdw_rootp=nil ;; + 0) + __mdw_rootp=t + ;; + *) + case $__mdw_system in + CYGWIN_*) + case " $(id -G) " in + *" 544 "*) __mdw_rootp=t __mdw_user="$__mdw_user%admin" ;; + *) __mdw_rootp=nil ;; + esac + ;; + *) + __mdw_rootp=nil + ;; + esac esac __mdw_set_prompt_pieces () { -- [mdw]