base-files: simplify system shell files.
This commit is contained in:
parent
20873afae9
commit
7c3fb28abb
6 changed files with 48 additions and 91 deletions
|
@ -1,11 +1,4 @@
|
|||
# .bash_profile
|
||||
|
||||
# Get the aliases and functions
|
||||
if [ -f ~/.bashrc ]; then
|
||||
. ~/.bashrc
|
||||
fi
|
||||
|
||||
# User specific environment and startup programs
|
||||
if [ -f ~/.profile ]; then
|
||||
. ~/.profile
|
||||
fi
|
||||
[ -f $HOME/.bashrc ] && . $HOME/.bashrc
|
||||
|
|
|
@ -1,19 +1,10 @@
|
|||
# .bashrc
|
||||
|
||||
# If not running interactively, don't do anything
|
||||
[[ $- != *i* ]] && return
|
||||
|
||||
# Source global definitions
|
||||
if [ -f /etc/bashrc ]; then
|
||||
. /etc/bashrc
|
||||
fi
|
||||
[ -f /etc/bashrc ] && ./etc/bashrc
|
||||
|
||||
# Source again stuff in /etc/profile.d in case it hasn't been.
|
||||
for i in /etc/profile.d/*.sh ; do
|
||||
if [ -r "$i" ]; then
|
||||
if [ "$PS1" ]; then
|
||||
. $i
|
||||
else
|
||||
. $i >/dev/null 2>&1
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
# User specific aliases and functions
|
||||
alias ls='ls --color=auto'
|
||||
PS1='[\u@\h \W]\$ '
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
# Read /etc/profile
|
||||
|
||||
if [ -f /etc/profile ]; then
|
||||
. /etc/profile
|
||||
fi
|
||||
|
||||
PATH=$PATH:$HOME/bin
|
||||
PS1="[\u@\h \W]$ "
|
||||
|
||||
export PATH PS1
|
23
srcpkgs/base-files/files/etc_bashrc
Normal file
23
srcpkgs/base-files/files/etc_bashrc
Normal file
|
@ -0,0 +1,23 @@
|
|||
# /etc/bashrc
|
||||
#
|
||||
# If not running interactively, don't do anything
|
||||
[[ $- != *i* ]] && return
|
||||
|
||||
PS1='[\u@\h \W]\$ '
|
||||
PS2='> '
|
||||
PS3='> '
|
||||
PS4='+ '
|
||||
|
||||
case ${TERM} in
|
||||
xterm*|rxvt*|Eterm|aterm|kterm|gnome*)
|
||||
PROMPT_COMMAND=${PROMPT_COMMAND:+$PROMPT_COMMAND; }'printf "\033]0;%s@%s:%s\007" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/~}"'
|
||||
|
||||
;;
|
||||
screen)
|
||||
PROMPT_COMMAND=${PROMPT_COMMAND:+$PROMPT_COMMAND; }'printf "\033_%s@%s:%s\033\\" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/~}"'
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ -r /usr/share/bash-completion/bash_completion ]; then
|
||||
. /usr/share/bash-completion/bash_completion
|
||||
fi
|
|
@ -3,61 +3,22 @@
|
|||
# System wide environment and startup programs, for login setup
|
||||
# Functions and aliases go in /etc/bashrc
|
||||
|
||||
pathmunge () {
|
||||
if ! echo $PATH | grep -Eq "(^|:)$1($|:)" ; then
|
||||
if [ "$2" = "after" ] ; then
|
||||
PATH=$PATH:$1
|
||||
else
|
||||
PATH=$1:$PATH
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# ksh workaround
|
||||
if [ -z "$EUID" -a -x /bin/id ]; then
|
||||
EUID=`id -u`
|
||||
UID=`id -ru`
|
||||
fi
|
||||
|
||||
# Path manipulation
|
||||
if [ "$EUID" = "0" ]; then
|
||||
pathmunge /sbin
|
||||
pathmunge /usr/sbin
|
||||
pathmunge /usr/local/sbin
|
||||
else
|
||||
pathmunge /usr/local/bin after
|
||||
pathmunge /usr/local/sbin after
|
||||
pathmunge /usr/sbin after
|
||||
pathmunge /sbin after
|
||||
pathmunge /opt/bin after
|
||||
pathmunge /opt/sbin after
|
||||
fi
|
||||
|
||||
# No core files by default
|
||||
ulimit -S -c 0 > /dev/null 2>&1
|
||||
|
||||
if [ -x /bin/id ]; then
|
||||
USER="`id -un`"
|
||||
LOGNAME=$USER
|
||||
MAIL="/var/spool/mail/$USER"
|
||||
fi
|
||||
|
||||
HOSTNAME=`/bin/hostname 2>/dev/null`
|
||||
HISTSIZE=1000
|
||||
|
||||
export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE
|
||||
|
||||
for i in /etc/profile.d/*.sh ; do
|
||||
if [ -r "$i" ]; then
|
||||
if [ "$PS1" ]; then
|
||||
. $i
|
||||
else
|
||||
. $i >/dev/null 2>&1
|
||||
fi
|
||||
fi
|
||||
done
|
||||
#Set our umask
|
||||
umask 022
|
||||
|
||||
# Set our default path
|
||||
PATH="/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin"
|
||||
export PATH
|
||||
|
||||
unset i
|
||||
unset pathmunge
|
||||
# Load profiles from /etc/profile.d
|
||||
if [ -d /etc/profile.d/ ]; then
|
||||
for f in /etc/profile.d/*.sh; do
|
||||
[ -r "$profile" ] && . "$profile"
|
||||
done
|
||||
unset f
|
||||
fi
|
||||
|
||||
# Source global bash config
|
||||
if [ -n "$PS1" && -n "$BASH" && -r /etc/bashrc ]; then
|
||||
. /etc/bashrc
|
||||
fi
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Template file for 'base-files'
|
||||
pkgname=base-files
|
||||
version=0.59
|
||||
version=0.60
|
||||
short_desc="Void GNU/Linux base system files"
|
||||
maintainer="Juan RP <xtraeme@gmail.com>"
|
||||
homepage="http://code.google.com/p/xbps"
|
||||
|
@ -18,7 +18,6 @@ conf_files="
|
|||
/etc/hosts
|
||||
/etc/host.conf
|
||||
/etc/securetty
|
||||
/etc/skel/.profile
|
||||
/etc/skel/.bash_profile
|
||||
/etc/skel/.bash_logout
|
||||
/etc/skel/.bashrc
|
||||
|
@ -30,7 +29,7 @@ Add_dependency full xbps-triggers
|
|||
|
||||
do_install() {
|
||||
# Install misc config files.
|
||||
for f in bash_logout bash_profile bashrc profile inputrc; do
|
||||
for f in bash_logout bash_profile bashrc inputrc; do
|
||||
vinstall ${FILESDIR}/dot_${f} 644 etc/skel .${f}
|
||||
done
|
||||
|
||||
|
|
Loading…
Reference in a new issue