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 :content-type; q=dns; s=default; b=DQ0SR7G7GghIAoTG5cTldSQ7R85lJ 6Hy61yPd2jAYvfksXXJKaCU0bjelvpxS43of9LPfHDN2gGQOYrrAO2Ow5ud7qMzO dA6x8WVRgdbg8TLyGkVwrrapevjFXwtLcaTGBKSLeDuDx5G6Uo70Q2YcCMusD2RN 11xTFNxbxQ+bws= 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 :content-type; s=default; bh=k50nhFZ1Uj2DhkfaDlEaPb7Xp+c=; b=aLn vZWV0GkElyilCHXb2Pbg/4II1M8ambJSNKjVF19dfi9nOt7L0gVKbW19pqUbu246 AA8KxDZe13mVhFosmPNwojL96GrOtNqTT6paaCXCBNzsV9xxTDuEVzbfVT9fVz9Z 2teczc33s4bBAuBpP6/nwSxWqcAksBNr/SjrkeP4= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , 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=-0.9 required=5.0 tests=AWL,BAYES_00,RCVD_IN_BL_SPAMCOP_NET,RCVD_IN_DNSWL_NONE,RP_MATCHES_RCVD autolearn=no version=3.3.2 X-HELO: mailout12.t-online.de Message-ID: <53458036.1010307@t-online.de> Date: Wed, 09 Apr 2014 19:15:34 +0200 From: Christian Franke User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:28.0) Gecko/20100101 Firefox/28.0 SeaMonkey/2.25 MIME-Version: 1.0 To: cygwin AT cygwin DOT com Subject: [PATCH] base-files-4.2-1: Change prompt if running with admin rights Content-Type: multipart/mixed; boundary="------------050008090608040305060508" X-IsSubscribed: yes --------------050008090608040305060508 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Thanks to Achim Gratz for adopting base-files. Attached is an updated version of: https://sourceware.org/ml/cygwin/2012-02/msg00806.html Christian --------------050008090608040305060508 Content-Type: text/x-patch; name="base-files-4.2-1-rootprompt.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="base-files-4.2-1-rootprompt.patch" diff -rup base-files-4.2-1.orig/etc/defaults/etc/bash.bashrc base-files-4.2-1/etc/defaults/etc/bash.bashrc --- base-files-4.2-1.orig/etc/defaults/etc/bash.bashrc 2014-03-23 14:56:28.412930900 +0100 +++ base-files-4.2-1/etc/defaults/etc/bash.bashrc 2014-04-09 13:42:05.000000000 +0200 @@ -27,7 +27,7 @@ export EXECIGNORE="*.dll" # Set a default prompt of: user AT host and current_directory -PS1='\[\e]0;\w\a\]\n\[\e[32m\]\u@\h \[\e[33m\]\w\[\e[0m\]\n\$ ' +PS1='\[\e]0;\w\a\]\n\[\e[32m\]\u@\h \[\e[33m\]\w\[\e[0m\]\n'"${PS1a:-\\\$ }" # Uncomment to use the terminal colours set in DIR_COLORS # eval "$(dircolors -b /etc/DIR_COLORS)" diff -rup base-files-4.2-1.orig/etc/defaults/etc/profile base-files-4.2-1/etc/defaults/etc/profile --- base-files-4.2-1.orig/etc/defaults/etc/profile 2014-03-23 14:56:28.312931800 +0100 +++ base-files-4.2-1/etc/defaults/etc/profile 2014-04-09 12:59:43.000000000 +0200 @@ -109,6 +109,12 @@ else cd "${HOME}" || echo "WARNING: Failed attempt to cd into ${HOME}!" fi +# Set PS1a if user has admin rights +unset PS1a +if [ -r /proc/registry/HKEY_LOCAL_MACHINE/SECURITY ]; then + PS1a="# " +fi + # Shell dependent settings profile_d () { @@ -135,15 +141,17 @@ if [ ! "x${BASH_VERSION}" = "x" ]; then [ -f "/etc/bash.bashrc" ] && . "/etc/bash.bashrc" elif [ ! "x${KSH_VERSION}" = "x" ]; then typeset -l HOSTNAME="$(/usr/bin/hostname)" - [ "${PS1-null}" = "null" ] || PS1=$(print '\033]0;${PWD}\n\033[32m${USER}@${HOSTNAME} \033[33m${PWD/${HOME}/~}\033[0m\n$ ') + [ "${PS1-null}" = "null" ] || PS1=$(print '\033]0;${PWD}\n\033[32m${USER}@${HOSTNAME} \033[33m${PWD/${HOME}/~}\033[0m\n'"${PS1a:-\$ }") elif [ ! "x${ZSH_VERSION}" = "x" ]; then # zsh is in shell compatibility mode here, so we probably shouldn't do this profile_d zsh + [ "${PS1-null}" = "null" ] || PS1='(%n@%m)[%h] %~ '"${PS1a:-%% }" elif [ ! "x${POSH_VERSION}" = "x" ]; then - : # [ "${PS1-null}" = "null" ] || PS1="$ " + : # [ "${PS1-null}" = "null" ] || PS1="${PS1a:-\$ }" else - : # [ "${PS1-null}" = "null" ] || PS1="$ " + : # [ "${PS1-null}" = "null" ] || PS1="${PS1a:-\$ }" fi +unset PS1a export PROFILEREAD PATH ORIGINAL_PATH MANPATH INFOPATH USER TMP TEMP PRINTER HOSTNAME PS1 SHELL tmp temp --------------050008090608040305060508 Content-Type: text/plain; charset=us-ascii -- 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 --------------050008090608040305060508--