enable powerscript to check if user can sudo his workstation
parent
40f26ce40d
commit
c7c488f0b0
|
|
@ -4,6 +4,9 @@ A colorful theme, where shows a lot information about your shell session.
|
||||||
|
|
||||||
**IMPORTANT:** This theme requires that [a font with the Powerline symbols](https://github.com/powerline/fonts) needs to be used in your terminal emulator, otherwise the prompt won't be displayed correctly, i.e. some of the additional icons and characters will be missing. Please follow your operating system's instructions to install one of the fonts from the above link and select it in your terminal emulator.
|
**IMPORTANT:** This theme requires that [a font with the Powerline symbols](https://github.com/powerline/fonts) needs to be used in your terminal emulator, otherwise the prompt won't be displayed correctly, i.e. some of the additional icons and characters will be missing. Please follow your operating system's instructions to install one of the fonts from the above link and select it in your terminal emulator.
|
||||||
|
|
||||||
|
**NOTICE:** The default behavior of this theme assumes that you have sudo privileges on your workstation. If it's not the case (i.e you are running on
|
||||||
|
a corporate network) you can set the flag 'CAN_SUDO=false' in powerbase.theme.bash
|
||||||
|
|
||||||
## Provided Information
|
## Provided Information
|
||||||
|
|
||||||
* Current path
|
* Current path
|
||||||
|
|
|
||||||
|
|
@ -13,8 +13,10 @@ function __powerline_user_info_prompt {
|
||||||
local user_info=""
|
local user_info=""
|
||||||
local color=${USER_INFO_THEME_PROMPT_COLOR}
|
local color=${USER_INFO_THEME_PROMPT_COLOR}
|
||||||
|
|
||||||
if sudo -n uptime 2>&1 | grep -q "load"; then
|
if ${CAN_SUDO}; then
|
||||||
color=${USER_INFO_THEME_PROMPT_COLOR_SUDO}
|
if sudo -n uptime 2>&1 | grep -q "load"; then
|
||||||
|
color=${USER_INFO_THEME_PROMPT_COLOR_SUDO}
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
case "${POWERLINE_PROMPT_USER_INFO_MODE}" in
|
case "${POWERLINE_PROMPT_USER_INFO_MODE}" in
|
||||||
"sudo")
|
"sudo")
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
. "$BASH_IT/themes/powerline/powerline.base.bash"
|
. "$BASH_IT/themes/powerline/powerline.base.bash"
|
||||||
|
|
||||||
|
CAN_SUDO=true
|
||||||
|
|
||||||
PROMPT_CHAR=${POWERLINE_PROMPT_CHAR:=""}
|
PROMPT_CHAR=${POWERLINE_PROMPT_CHAR:=""}
|
||||||
POWERLINE_LEFT_SEPARATOR=${POWERLINE_LEFT_SEPARATOR:=""}
|
POWERLINE_LEFT_SEPARATOR=${POWERLINE_LEFT_SEPARATOR:=""}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue