]> git.pld-linux.org Git - projects/setup.git/blobdiff - etc/profile
- 2.4.6 - basic /etc/env.d support. Simple way to manage system variables.
[projects/setup.git] / etc / profile
index 592ee89a4391ff20dade4c6a90cf12c226f83810..f2247ae0c21329a72ab499588ead74cdff08bea3 100644 (file)
@@ -20,19 +20,13 @@ LOGNAME=$USER
 HOSTNAME=`/bin/uname -n`
 HISTFILE="$HOME/.history"
 HISTSIZE=1000
-HISTFILESIZE=1000
-
-# home_etc user config-dirs
-#CONFIG_DIR=etc
-#HOME_ETC=$HOME/$CONFIG_DIR
-#export CONFIG_DIR HOME_ETC
 
 #
 # Setup the environment for various shells
 #
 
 if [ "$TERM" = "" -o "$TERM" = "unknown" ]; then
- TERM=linux
      TERM=linux
 fi
 
 SH="${0#\-}"
@@ -51,7 +45,7 @@ fi
 
 case "$SH" in
   bash)
-       case $TERM in
+       case $TERM in
                xterm*)
                        PS1="\[\033]0;\u@\h: \w\007\][\u@\h \W]\\$ "
                        ;;
@@ -61,65 +55,64 @@ case "$SH" in
        esac
        ;;
   ksh|pdksh)
-       if [ `id -u` -eq 0 ]; then
+       if [ `id -u` -eq 0 ]; then
                PS1='[${LOGNAME-$USER}@${HOSTNAME} `
-                       if [ "$PWD" = "/${PWD##*/}" ]; then
-                               echo $PWD;
-                       else
-                               echo ${PWD##*/};
+               if [ "$PWD" = "/${PWD##*/}" ]; then
+                       echo $PWD;
+               else
+                       echo ${PWD##*/};
                fi`]# '
        else
                PS1='[${LOGNAME-$USER}@${HOSTNAME} `
-                       if [ "$PWD" = "/${PWD##*/}" ]; then
-                               echo $PWD;
-                       else
-                               echo ${PWD##*/};
+               if [ "$PWD" = "/${PWD##*/}" ]; then
+                       echo $PWD;
+               else
+                       echo ${PWD##*/};
                fi`]$ '
        fi
        PS2='> '
        set -o emacs
-       bind '^I'=complete >/dev/null 2>&1
        bind '^[^I'=complete-list >/dev/null 2>&1
        #
        # Setup some of the most basic editing functions
-       # to work properly under different termnal emulators.
+       # to work properly under different terminal emulators.
        #
        case $TERM in
-       nxterm|xterm|xterm-color|rxvt)
+       nxterm|xterm|xterm-color)
                bind '^[[H'=beginning-of-line >/dev/null 2>&1
                bind '^[[F'=end-of-line >/dev/null 2>&1
                ;;
-       linux)
-               bind '^[1~'=beginning-of-line >/dev/null 2>&1
-               bind '^[4~'=end-of-line >/dev/null 2>&1
+       linux|rxvt)
+               bind '^[[1~'=beginning-of-line >/dev/null 2>&1
+               bind '^[[4~'=end-of-line >/dev/null 2>&1
                ;;
        esac
        ;;
   ksh93)
-       if [ `id -u` -eq 0 ]; then
+       if [ `id -u` -eq 0 ]; then
                PS1='[${LOGNAME-$USER}@${HOSTNAME} `
-                       if [ "$PWD" = "/${PWD##*/}" ]; then
-                               echo $PWD;
-                       else
-                               echo ${PWD##*/};
+               if [ "$PWD" = "/${PWD##*/}" ]; then
+                       echo $PWD;
+               else
+                       echo ${PWD##*/};
                fi`]# '
        else
                PS1='[${LOGNAME-$USER}@${HOSTNAME} `
-                       if [ "$PWD" = "/${PWD##*/}" ]; then
-                               echo $PWD;
-                       else
-                               echo ${PWD##*/};
+               if [ "$PWD" = "/${PWD##*/}" ]; then
+                       echo $PWD;
+               else
+                       echo ${PWD##*/};
                fi`]$ '
        fi
        PS2='> '
        set -o nolog
        set -o emacs
        case $TERM in
-       nxterm|xterm|xterm-color|rxvt)
-               trap 'case ${.sh.edchar} in  "\e[F") .sh.edchar="\ 5" ;; "\e[H") .sh.edchar="\ 1" ;; esac' KEYBD
+       nxterm|xterm|xterm-color)
+               trap 'case ${.sh.edchar} in "\e[F") .sh.edchar="\ 5" ;; "\e[H") .sh.edchar="\ 1" ;; esac' KEYBD
                ;;
-       linux)
-               trap 'case ${.sh.edchar} in  "\e[4~") .sh.edchar="\ 5" ;; "\e[1~") .sh.edchar="\ 1" ;; esac' KEYBD
+       linux|rxvt)
+               trap 'case ${.sh.edchar} in "\e[4~") .sh.edchar="\ 5" ;; "\e[1~") .sh.edchar="\ 1" ;; esac' KEYBD
                ;;
        esac
        ;;
@@ -129,14 +122,33 @@ case "$SH" in
 
        # other HISTFILE, zsh uses diffrent fmt
        HISTFILE=~/.historyz
-       # w/o this hist file wont get saved !
+       # w/o this hist file won't get saved!
        SAVEHIST=$HISTSIZE
        ;;
 esac
 
 unset SH
-export PATH PS1 PS2 HOSTNAME HISTFILE HISTSIZE HISTFILESIZE USER LOGNAME MAIL
+export PATH USER LOGNAME HOSTNAME HISTFILE HISTSIZE PS1 PS2
+
+# Put all of the variables as files in /etc/env.d/
+# example:
+# cat /etc/env.d/VARIABLE
+# VARIABLE="value"
+for i in /etc/env.d/* ; do
+       NAME=`basename $i`
+       case $NAME in
+               *~ | *.bak | *.old | *.rpmnew | *.rpmsave )
+                       # nothing
+                       ;;
+               * )
+                       if [ -r $i ]; then
+                               . $i; export $NAME
+                       fi
+                       ;;
+       esac
+done
 
+# Scripts:
 for i in /etc/profile.d/*.sh ; do
        if [ -x $i ]; then
                . $i
This page took 0.035365 seconds and 4 git commands to generate.