Import bash startfiles from IPFire 3.x.

This commit is contained in:
Michael Tremer
2012-11-11 23:28:52 +01:00
parent ee11bc4e12
commit b21b0df6a6
16 changed files with 383 additions and 145 deletions

View File

@@ -0,0 +1,7 @@
# Begin ~/.bash_logout
# Personal items to perform on logout.
echo "Bye bye."
# End ~/.bash_logout

View File

@@ -0,0 +1,12 @@
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/bin
export PATH

12
config/bash/dot_bashrc Normal file
View File

@@ -0,0 +1,12 @@
# .bashrc
# User specific aliases and functions
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi

View File

@@ -1,41 +1,89 @@
# Begin /etc/bashrc
# Written for Beyond Linux From Scratch
# by James Robertson <jameswrobertson@earthlink.net>
# updated by Bruce Dubbs <bdubbs@linuxfromscratch.org>
# /etc/bashrc
# Make sure that the terminal is set up properly for each shell
# System wide functions and aliases
# Environment stuff goes in /etc/profile
if [ -f /etc/profile.d/tinker-term.sh ]; then
source /etc/profile.d/tinker-term.sh
# It's NOT a good idea to change this file unless you know what you
# are doing. It's much better to create a custom.sh shell script in
# /etc/profile.d/ to make custom changes to your environment, as this
# will prevent the need for merging in future updates.
# are we an interactive shell?
if [ "$PS1" ]; then
if [ -z "$PROMPT_COMMAND" ]; then
case $TERM in
xterm*)
if [ -e /etc/sysconfig/bash-prompt-xterm ]; then
PROMPT_COMMAND=/etc/sysconfig/bash-prompt-xterm
else
PROMPT_COMMAND='printf "\033]0;%s@%s:%s\007" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/~}"'
fi
;;
screen)
if [ -e /etc/sysconfig/bash-prompt-screen ]; then
PROMPT_COMMAND=/etc/sysconfig/bash-prompt-screen
else
PROMPT_COMMAND='printf "\033]0;%s@%s:%s\033\\" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/~}"'
fi
;;
*)
[ -e /etc/sysconfig/bash-prompt-default ] && PROMPT_COMMAND=/etc/sysconfig/bash-prompt-default
;;
esac
fi
# Turn on parallel history
shopt -s histappend
history -a
# Turn on checkwinsize
shopt -s checkwinsize
[ "$PS1" = "\\s-\\v\\\$ " ] && PS1="[\u@\h \W]\\$ "
# You might want to have e.g. tty in prompt (e.g. more virtual machines)
# and console windows
# If you want to do so, just add e.g.
# if [ "$PS1" ]; then
# PS1="[\u@\h:\l \W]\\$ "
# fi
# to your custom modification shell script in /etc/profile.d/ directory
fi
# System wide aliases and functions.
if ! shopt -q login_shell ; then # We're not a login shell
# Need to redefine pathmunge, it get's undefined at the end of /etc/profile
pathmunge () {
case ":${PATH}:" in
*:"$1":*)
;;
*)
if [ "$2" = "after" ] ; then
PATH=$PATH:$1
else
PATH=$1:$PATH
fi
esac
}
# System wide environment variables and startup programs should go into
# /etc/profile. Personal environment variables and startup programs
# should go into ~/.bash_profile. Personal aliases and functions should
# go into ~/.bashrc
# By default, we want umask to get set. This sets it for non-login shell.
# Current threshold for system reserved uid/gids is 200
# You could check uidgid reservation validity in
# /usr/share/doc/setup-*/uidgid file
if [ $UID -gt 199 ] && [ "`id -gn`" = "`id -un`" ]; then
umask 002
else
umask 022
fi
# Provides a colored /bin/ls command. Used in conjunction with code in
# /etc/profile.
# Only display echos from profile.d scripts if we are no login shell
# and interactive - otherwise just process them to set envvars
for i in /etc/profile.d/*.sh; do
if [ -r "$i" ]; then
if [ "$PS1" ]; then
. "$i"
else
. "$i" >/dev/null
fi
fi
done
alias ls='ls --color=auto'
alias ll='ls -la'
alias which='alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'
# Make the shell a little bit more interactive
# to prevent the deletion of some files
alias mv='mv -i'
alias rm='rm -i'
alias cp='cp -i'
# Provides prompt for non-login shells, specifically shells started
# in the X environment. [Review the LFS archive thread titled
# PS1 Environment Variable for a great case study behind this script
# addendum.]
#export PS1="\033[0m[\033[1;33m\u\033[1;37m@\033[1;32m\]\h \033[1;31m\w\033[0m]\\$ "
export PS1="[\u@\h \w]\\$ "
#export PS1='\u@\h:\w\$ '
# End /etc/bashrc
unset i
unset -f pathmunge
fi
# vim:ts=4:sw=4

View File

@@ -1,42 +1,42 @@
# Begin /etc/inputrc
# do not bell on tab-completion
#set bell-style none
# Allow the command prompt to wrap to the next line
set horizontal-scroll-mode Off
set meta-flag on
set input-meta on
set convert-meta off
set output-meta on
# Enable 8bit input
set meta-flag On
set input-meta On
# Completed names which are symbolic links to
# directories have a slash appended.
set mark-symlinked-directories on
# Turns off 8th bit stripping
set convert-meta Off
$if mode=emacs
# Keep the 8th bit for display
set output-meta On
# none, visible or audible
set bell-style none
# All of the following map the escape sequence of the
# value contained inside the 1st argument to the
# readline specific functions
"\eOd": backward-word
"\eOc": forward-word
# for linux console
# for linux console and RH/Debian xterm
"\e[1~": beginning-of-line
"\e[4~": end-of-line
"\e[5~": beginning-of-history
"\e[6~": end-of-history
# commented out keymappings for pgup/pgdown to reach begin/end of history
#"\e[5~": beginning-of-history
#"\e[6~": end-of-history
"\e[5~": history-search-backward
"\e[6~": history-search-forward
"\e[3~": delete-char
"\e[2~": quoted-insert
"\e[5C": forward-word
"\e[5D": backward-word
"\e[1;5C": forward-word
"\e[1;5D": backward-word
# for xterm
# for rxvt
"\e[8~": end-of-line
"\eOc": forward-word
"\eOd": backward-word
# for non RH/Debian xterm, can't hurt for RH/DEbian xterm
"\eOH": beginning-of-line
"\eOF": end-of-line
# for Konsole
# for freebsd console
"\e[H": beginning-of-line
"\e[F": end-of-line
# End /etc/inputrc
$endif

View File

@@ -1,64 +1,76 @@
# Begin /etc/profile
# Written for Beyond Linux From Scratch
# by James Robertson <jameswrobertson@earthlink.net>
# modifications by Dagmar d'Surreal <rivyqntzne@pbzpnfg.arg>
# /etc/profile
# System wide environment variables and startup programs.
# System wide environment and startup programs, for login setup
# Functions and aliases go in /etc/bashrc
# System wide aliases and functions should go in /etc/bashrc. Personal
# environment variables and startup programs should go into
# ~/.bash_profile. Personal aliases and functions should go into
# ~/.bashrc.
# It's NOT a good idea to change this file unless you know what you
# are doing. It's much better to create a custom.sh shell script in
# /etc/profile.d/ to make custom changes to your environment, as this
# will prevent the need for merging in future updates.
# Functions to help us manage paths. Second argument is the name of the
# path variable to be modified (default: PATH)
pathremove () {
local IFS=':'
local NEWPATH
local DIR
local PATHVARIABLE=${2:-PATH}
for DIR in ${!PATHVARIABLE} ; do
if [ "$DIR" != "$1" ] ; then
NEWPATH=${NEWPATH:+$NEWPATH:}$DIR
fi
done
export $PATHVARIABLE="$NEWPATH"
}
pathprepend () {
pathremove $1 $2
local PATHVARIABLE=${2:-PATH}
export $PATHVARIABLE="$1${!PATHVARIABLE:+:${!PATHVARIABLE}}"
}
pathappend () {
pathremove $1 $2
local PATHVARIABLE=${2:-PATH}
export $PATHVARIABLE="${!PATHVARIABLE:+${!PATHVARIABLE}:}$1"
pathmunge () {
case ":${PATH}:" in
*:"$1":*)
;;
*)
if [ "$2" = "after" ] ; then
PATH=$PATH:$1
else
PATH=$1:$PATH
fi
esac
}
# Set the initial path
export PATH=/bin:/usr/bin
if [ $EUID -eq 0 ] ; then
pathappend /sbin:/usr/sbin
unset HISTFILE
if [ -x /usr/bin/id ]; then
if [ -z "$EUID" ]; then
# ksh workaround
EUID=`id -u`
UID=`id -ru`
fi
USER="`id -un`"
LOGNAME=$USER
MAIL="/var/spool/mail/$USER"
fi
# Setup some environment variables.
export HISTSIZE=1000
export HISTIGNORE="&:[bf]g:exit"
export PS1="[\u@\h \w]\\$ "
#export PS1='\u@\h:\w\$ '
# Path manipulation
if [ "$EUID" = "0" ]; then
pathmunge /usr/sbin
pathmunge /usr/local/sbin
else
pathmunge /usr/local/sbin after
pathmunge /usr/sbin after
fi
for script in /etc/profile.d/*.sh ; do
if [ -r $script ] ; then
. $script
HOSTNAME=`/usr/bin/hostname 2>/dev/null`
HISTSIZE=1000
if [ "$HISTCONTROL" = "ignorespace" ] ; then
export HISTCONTROL=ignoreboth
else
export HISTCONTROL=ignoredups
fi
export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE HISTCONTROL
# By default, we want umask to get set. This sets it for login shell
# Current threshold for system reserved uid/gids is 200
# You could check uidgid reservation validity in
# /usr/share/doc/setup-*/uidgid file
if [ $UID -gt 199 ] && [ "`id -gn`" = "`id -un`" ]; then
umask 002
else
umask 022
fi
for i in /etc/profile.d/*.sh ; do
if [ -r "$i" ]; then
if [ "${-#*i}" != "$-" ]; then
. "$i"
else
. "$i" >/dev/null 2>&1
fi
fi
done
# Now to clean up
unset pathremove pathprepend pathappend
# End /etc/profile
unset i
unset pathmunge

View File

@@ -0,0 +1,40 @@
# color-ls initialization
#when USER_LS_COLORS defined do not override user LS_COLORS, but use them.
if [ -z "$USER_LS_COLORS" ]; then
alias ll='ls -l' 2>/dev/null
alias l.='ls -d .*' 2>/dev/null
# Skip the rest for noninteractive shells.
[ -z "$PS1" ] && return
COLORS=
for colors in "$HOME/.dir_colors.$TERM" "$HOME/.dircolors.$TERM" \
"$HOME/.dir_colors" "$HOME/.dircolors"; do
[ -e "$colors" ] && COLORS="$colors" && break
done
[ -z "$COLORS" ] && [ -e "/etc/DIR_COLORS.256color" ] && \
[ "x`tty -s && tput colors 2>/dev/null`" = "x256" ] && \
COLORS="/etc/DIR_COLORS.256color"
if [ -z "$COLORS" ]; then
for colors in "/etc/DIR_COLORS.$TERM" "/etc/DIR_COLORS" ; do
[ -e "$colors" ] && COLORS="$colors" && break
done
fi
# Existence of $COLORS already checked above.
[ -n "$COLORS" ] || return
eval "`dircolors --sh "$COLORS" 2>/dev/null`"
[ -z "$LS_COLORS" ] && return
grep -qi "^COLOR.*none" $COLORS >/dev/null 2>/dev/null && return
fi
alias ll='ls -l --color=auto' 2>/dev/null
alias l.='ls -d .* --color=auto' 2>/dev/null
alias ls='ls --color=auto' 2>/dev/null

View File

@@ -1,9 +0,0 @@
# Setup for /bin/ls to support color, the alias is in /etc/bashrc.
if [ -f "/etc/dircolors" ] ; then
eval $(dircolors -b /etc/dircolors)
if [ -f "$HOME/.dircolors" ] ; then
eval $(dircolors -b $HOME/.dircolors)
fi
fi
alias ls='ls --color=auto'

View File

@@ -1,15 +0,0 @@
if [ -d /usr/local/bin ]; then
pathprepend /usr/local/bin
fi
if [ -d /usr/local/sbin -a $EUID -eq 0 ]; then
pathprepend /usr/local/sbin
fi
for directory in $(find /opt/*/bin -type d 2>/dev/null); do
pathappend $directory
done
if [ -d ~/bin ]; then
pathprepend ~/bin
fi
#if [ $EUID -gt 99 ]; then
# pathappend .
#fi

View File

@@ -1,2 +1,10 @@
# Set up i18n variables
export LANG=en_US.utf8
if [ -f "/etc/sysconfig/console" ]; then
. /etc/sysconfig/console
else
LANG=en_US.UTF-8
fi
unset KEYMAP FONT UNICODE KEYMAP_CORRECTIONS LEGACY_CHARSET
export LANG

90
config/profile.d/lang.sh Normal file
View File

@@ -0,0 +1,90 @@
# /etc/profile.d/lang.sh - set i18n stuff
sourced=0
if [ -n "$LANG" ]; then
saved_lang="$LANG"
[ -f "$HOME/.i18n" ] && . "$HOME/.i18n" && sourced=1
LANG="$saved_lang"
unset saved_lang
else
for langfile in /etc/sysconfig/i18n "$HOME/.i18n" ; do
[ -f $langfile ] && . $langfile && sourced=1
done
fi
if [ "$sourced" = 1 ]; then
[ -n "$LANG" ] && export LANG || unset LANG
[ -n "$LC_ADDRESS" ] && export LC_ADDRESS || unset LC_ADDRESS
[ -n "$LC_CTYPE" ] && export LC_CTYPE || unset LC_CTYPE
[ -n "$LC_COLLATE" ] && export LC_COLLATE || unset LC_COLLATE
[ -n "$LC_IDENTIFICATION" ] && export LC_IDENTIFICATION || unset LC_IDENTIFICATION
[ -n "$LC_MEASUREMENT" ] && export LC_MEASUREMENT || unset LC_MEASUREMENT
[ -n "$LC_MESSAGES" ] && export LC_MESSAGES || unset LC_MESSAGES
[ -n "$LC_MONETARY" ] && export LC_MONETARY || unset LC_MONETARY
[ -n "$LC_NAME" ] && export LC_NAME || unset LC_NAME
[ -n "$LC_NUMERIC" ] && export LC_NUMERIC || unset LC_NUMERIC
[ -n "$LC_PAPER" ] && export LC_PAPER || unset LC_PAPER
[ -n "$LC_TELEPHONE" ] && export LC_TELEPHONE || unset LC_TELEPHONE
[ -n "$LC_TIME" ] && export LC_TIME || unset LC_TIME
if [ -n "$LC_ALL" ]; then
if [ "$LC_ALL" != "$LANG" ]; then
export LC_ALL
else
unset LC_ALL
fi
else
unset LC_ALL
fi
[ -n "$LANGUAGE" ] && export LANGUAGE || unset LANGUAGE
[ -n "$LINGUAS" ] && export LINGUAS || unset LINGUAS
[ -n "$_XKB_CHARSET" ] && export _XKB_CHARSET || unset _XKB_CHARSET
consoletype=$CONSOLETYPE
if [ -z "$consoletype" ]; then
consoletype=$(/sbin/consoletype stdout)
fi
if [ -n "$LANG" ]; then
case $LANG in
*.utf8*|*.UTF-8*)
if [ "$TERM" = "linux" ]; then
if [ "$consoletype" = "vt" ]; then
case $LANG in
ja*) LANG=en_US.UTF-8 ;;
ko*) LANG=en_US.UTF-8 ;;
si*) LANG=en_US.UTF-8 ;;
zh*) LANG=en_US.UTF-8 ;;
ar*) LANG=en_US.UTF-8 ;;
fa*) LANG=en_US.UTF-8 ;;
he*) LANG=en_US.UTF-8 ;;
en_IN*) ;;
*_IN*) LANG=en_US.UTF-8 ;;
esac
fi
fi
;;
*)
if [ "$TERM" = "linux" ]; then
if [ "$consoletype" = "vt" ]; then
case $LANG in
ja*) LANG=en_US ;;
ko*) LANG=en_US ;;
si*) LANG=en_US ;;
zh*) LANG=en_US ;;
ar*) LANG=en_US ;;
fa*) LANG=en_US ;;
he*) LANG=en_US ;;
en_IN*) ;;
*_IN*) LANG=en_US ;;
esac
fi
fi
;;
esac
fi
unset SYSFONTACM SYSFONT consoletype
fi
unset sourced
unset langfile

View File

@@ -0,0 +1,26 @@
# Enable 256 color capabilities for appropriate terminals
# Set this variable in your local shell config (such as ~/.bashrc)
# if you want remote xterms connecting to this system, to be sent 256 colors.
# This must be set before reading global initialization such as /etc/bashrc.
# SEND_256_COLORS_TO_REMOTE=1
# Terminals with any of the following set, support 256 colors (and are local)
local256="$COLORTERM$XTERM_VERSION$ROXTERM_ID$KONSOLE_DBUS_SESSION"
if [ -n "$local256" ] || [ -n "$SEND_256_COLORS_TO_REMOTE" ]; then
case "$TERM" in
'xterm') TERM=xterm-256color;;
'screen') TERM=screen-256color;;
'Eterm') TERM=Eterm-256color;;
esac
export TERM
if [ -n "$TERMCAP" ] && [ "$TERM" = "screen-256color" ]; then
TERMCAP=$(echo "$TERMCAP" | sed -e 's/Co#8/Co#256/g')
export TERMCAP
fi
fi
unset local256

View File

@@ -20,7 +20,7 @@ bin/sleep
bin/sync
bin/true
bin/uname
etc/dircolors
etc/DIR_COLORS
usr/bin/[
usr/bin/basename
#usr/bin/cksum

View File

@@ -31,11 +31,11 @@ etc/nsswitch.conf
etc/passwd
etc/profile
#etc/profile.d
etc/profile.d/bashrc.sh
etc/profile.d/dircolors.sh
etc/profile.d/extrapaths.sh
etc/profile.d/colorls.sh
etc/profile.d/i18n.sh
etc/profile.d/lang.sh
etc/profile.d/readline.sh
etc/profile.d/term256.sh
etc/profile.d/umask.sh
etc/resolv.conf
etc/securetty
@@ -51,6 +51,9 @@ media/usbkey
mnt
#opt
#root
root/.bash_logout
root/.bash_profile
root/.bashrc
root/ipfire
#sbin
#srv

View File

@@ -109,7 +109,7 @@ ifeq "$(ROOT)" ""
mv -v /usr/bin/{head,sleep,nice} /bin
ln -sf test /bin/[
#ln -sf ../../bin/install /usr/bin
dircolors -p > /etc/dircolors
dircolors -p > /etc/DIR_COLORS
else
rm /tools/bin/hostname
endif

View File

@@ -83,7 +83,11 @@ $(TARGET) :
[ -f $$i ] && cp $$i /etc/profile.d; \
done
chmod 755 /etc/bashrc
ln -svf ../bashrc /etc/profile.d/bashrc.sh
# Install root's bash files.
for i in $(DIR_SRC)/config/bash/dot_*; do \
[ -f $$i ] && cp $$i /root/$$(basename $${i/dot_/\.}); \
done
# Scripts
for i in `find $(DIR_SRC)/src/scripts -maxdepth 1 -type f`; do \