Difference between revisions of "Bash Startup Files"

From CBLFS
Jump to navigationJump to search
(/etc/profile)
(/etc/profile)
Line 16: Line 16:
 
  install -d -m755 /etc/profile.d
 
  install -d -m755 /etc/profile.d
  
=== 05-i18n.sh ===
+
=== 05-i18n.sh ===
  
 
  cat > /etc/profile.d/05-i18n.sh << "EOF"
 
  cat > /etc/profile.d/05-i18n.sh << "EOF"

Revision as of 12:05, 3 September 2006

/etc/profile

cat > /etc/profile << "EOF"
# Begin /etc/profile
# Based on the profile scripts in BLFS http://www.linuxfromscratch.org/blfs/view/svn/postlfs/profile.html

for script in /etc/profile.d/*.sh
do
  source $script
done
unset script

# End /etc/profile.d
EOF
install -d -m755 /etc/profile.d

05-i18n.sh

cat > /etc/profile.d/05-i18n.sh << "EOF"
# Begin /etc/profile.d/05-i18n.sh

export LANG=[ll]_[CC].[locale]
export LC_ALL=[ll]_[CC]
export G_FILENAME_ENCODING=@locale
 
# End /etc/profile.d/05-i18n.sh
EOF

10-path.sh

cat > /etc/profile.d/10-path.sh << "EOF"
# Begin /etc/profile.d/10-path.sh

if [ "$EUID" -eq 0 ]; then
  export PATH="/sbin:/bin:/usr/sbin:/usr/bin"
  if [ -d "/usr/local/sbin" ]; then
    export PATH="$PATH:/usr/local/sbin"
  fi
else
  export PATH="/bin:/usr/bin"
fi

if [ -d "/usr/local/bin" ]; then
  export PATH="$PATH:/usr/local/bin"
fi

if [ -d "$HOME/bin" ]; then
  export PATH="$HOME/bin:$PATH"
fi

# End /etc/profile.d/10-path.sh
EOF

10-pkg_config_path.sh (Multilib Only)

cat > /etc/profile.d/10-pkg_config_path.sh << "EOF"
# Begin /etc/profile.d/10-pkg_config_path.sh

export PKG_CONFIG_PATH32="/usr/lib/pkgconfig"
export PKG_CONFIG_PATHN32="/usr/lib/pkgconfig32"
export PKG_CONFIG_PATH64="/usr/lib/pkgconfig64"

# End /etc/profile.d/10-pkg_config_path.sh
EOF

15-xorg.sh

Change XORG_PREFIX to wherever you are going to install Xorg to.

Non-Multilib 15-xorg.sh

cat > /etc/profile.d/15-xorg.sh << "EOF"
# Begin /etc/profile.d/15-xorg.sh

export XORG_PREFIX=/usr/X11R7

export PATH="${PATH}:${XORG_PREFIX}/bin"
export PKG_CONFIG_PATH="${PKG_CONFIG_PATH}:${XORG_PREFIX}/lib/pkgconfig"

# End /etc/profile.d/15-xorg.sh
EOF

Multilib 15-xorg.sh

cat > /etc/profile.d/15-xorg.sh << "EOF"
# Begin /etc/profile.d/15-xorg.sh

export XORG_PREFIX=/usr/X11R7

export PATH="${PATH}:${XORG_PREFIX}/bin"
export PKG_CONFIG_PATH32="${PKG_CONFIG_PATH32}${PKG_CONFIG_PATH32-:}${XORG_PREFIX}/lib/pkgconfig"
export PKG_CONFIG_PATHN32="${PKG_CONFIG_PATHN32}${PKG_CONFIG_PATHN32-:}${XORG_PREFIX}/lib32/pkgconfig"
export PKG_CONFIG_PATH64="${PKG_CONFIG_PATH64}${PKG_CONFIG_PATH64-:}${XORG_PREFIX}/lib64/pkgconfig"

# End /etc/profile.d/15-xorg.sh
EOF

50-dircolors.sh

cat > /etc/profile.d/50-dircolors.sh << "EOF"
# Begin /etc/profile.d/50-dircolors.sh

alias ls='ls --color=auto'
if [ -f "$HOME/.dircolors" ]; then
  eval `dircolors -b "$HOME/.dircolors"`
else
  if [ -f "/etc/dircolors" ]; then
    eval `dircolors -b "/etc/dircolors"`
  fi
fi

# End /etc/profile.d/50-dircolors.sh
EOF

To create /etc/dircolors run the following command:

dircolors -b > /etc/dircolors

50-history.sh

cat > /etc/profile.d/50-history.sh << "EOF"
# Begin /etc/profile.d/50-history.sh

export HISTSIZE=1000
export HISTIGNORE="&:[bf]g:exit"

# End /etc/profile.d/50-history.sh
EOF

50-prompt.sh

cat > /etc/profile.d/50-prompt.sh << "EOF"
# Begin /etc/profile.d/50-prompt.sh

export PS1="\u:\w\$ "
if [ "${TERM:0:5}" = "xterm" ]; then
  export PS1="\[\e]2;\u@\H :: \w\a\]$PS1"
fi

# End /etc/profile.d/50-prompt.sh
EOF

If you're after a colorful PS1 try using \[\e[1;32m\]\u\[\e[1;33m\]@\[\e[1;31m\]\H \[\e[1;34m\]\w \[\e[1;32m\ ]\$ \[\e[0;0m\]

50-readline.sh

cat > /etc/profile.d/50-readline.sh << "EOF"
# Begin /etc/profile.d/50-readline.sh

if [ -z "$INPUTRC" ]; then
  if [ -f "$HOME/.inputrc" ]; then
    export INPUTRC="$HOME/.inputrc"
  else
    if [ -f "/etc/inputrc" ]; then
      export INPUTRC="/etc/inputrc"
    fi
  fi
fi

# End /etc/profile.d/50-readline.sh
EOF

50-umask.sh

cat > /etc/profile.d/50-umask.sh << "EOF"
# Begin /etc/profile.d/50-umask.sh

if [ "`id -un`" = "`id -gn`" -a $EUID -gt 99 ]; then
  umask 002
else
  umask 022
fi

# End /etc/profile.d/50-umask.sh
EOF