Browse Source

Add a parameter to apply (or not) LC_SSH_* vars

Emmanuel Bouthenot 9 years ago
parent
commit
6dd52c3494
1 changed files with 10 additions and 9 deletions
  1. 10 9
      zsh/zshrc

+ 10 - 9
zsh/zshrc

@@ -207,14 +207,15 @@ bindkey "^[[F" end-of-line
 # MOTD
 #
 
-if [[ -z "${TMUX}" ]] && [[ -z "${SUDO_UID}" ]]; then
-    if [[ -z "${LC_SSH_EMAIL}" || -z "${LC_SSH_FULLNAME}" ]]; then
-        printf "\n${COLOR_RED}You environment seems to not be properly configured: LC_SSH_EMAIL and LC_SSH_FULLNAME have to be set and forwarded through the ssh connection.${COLOR_RESET}\n"
-        exit 1
-    else
-        printf "\n${COLOR_LIGHT_GREEN}You are logged in as ${COLOR_YELLOW}${LC_SSH_FULLNAME}${COLOR_RESET} <${COLOR_YELLOW}${LC_SSH_EMAIL}${COLOR_RESET}>\n"
-    fi
-    if [[ ! -e "${SSH_AUTH_SOCK}" ]]; then
-        printf "${COLOR_LIGHT_YELLOW}Be warned that your ssh agent is not foarwarded${COLOR_RESET}\n"
+if [[ "${LC_SSH_VARS}" = 1 ]]; then
+    if [[ -z "${TMUX}" ]] && [[ -z "${SUDO_UID}" ]]; then
+        if [[ -z "${LC_SSH_EMAIL}" || -z "${LC_SSH_FULLNAME}" ]]; then
+            printf "\n${COLOR_RED}You environment seems to not be properly configured: LC_SSH_EMAIL and LC_SSH_FULLNAME have to be set and forwarded through the ssh connection.${COLOR_RESET}\n"
+        else
+            printf "\n${COLOR_LIGHT_GREEN}You are logged in as ${COLOR_YELLOW}${LC_SSH_FULLNAME}${COLOR_RESET} <${COLOR_YELLOW}${LC_SSH_EMAIL}${COLOR_RESET}>\n"
+        fi
+        if [[ ! -e "${SSH_AUTH_SOCK}" ]]; then
+            printf "${COLOR_LIGHT_YELLOW}Be warned that your ssh agent is not foarwarded${COLOR_RESET}\n"
+        fi
     fi
 fi