From 40281a471c31d1283d13034b9aea17ae327a89bb Mon Sep 17 00:00:00 2001 From: xhaa123 Date: Sat, 7 Sep 2024 23:18:11 +0800 Subject: [PATCH] bash 5.2.32-1 --- bash/PKGBUILD | 87 +++++++++++++++++++++++++++++++++++++++++ bash/bash_completion.sh | 34 ++++++++++++++++ bash/bashrc | 33 ++++++++++++++++ bash/dircolors.sh | 12 ++++++ bash/extrapaths.sh | 17 ++++++++ bash/i18n.sh | 17 ++++++++ bash/profile | 82 ++++++++++++++++++++++++++++++++++++++ bash/readline.sh | 5 +++ bash/readline.sh.1 | 5 +++ bash/shells | 6 +++ bash/skel_bash_logout | 5 +++ bash/skel_bash_profile | 22 +++++++++++ bash/skel_bashrc | 17 ++++++++ bash/umask.sh | 6 +++ 14 files changed, 348 insertions(+) create mode 100644 bash/PKGBUILD create mode 100644 bash/bash_completion.sh create mode 100644 bash/bashrc create mode 100644 bash/dircolors.sh create mode 100644 bash/extrapaths.sh create mode 100644 bash/i18n.sh create mode 100644 bash/profile create mode 100644 bash/readline.sh create mode 100644 bash/readline.sh.1 create mode 100644 bash/shells create mode 100644 bash/skel_bash_logout create mode 100644 bash/skel_bash_profile create mode 100644 bash/skel_bashrc create mode 100644 bash/umask.sh diff --git a/bash/PKGBUILD b/bash/PKGBUILD new file mode 100644 index 0000000..63e01c0 --- /dev/null +++ b/bash/PKGBUILD @@ -0,0 +1,87 @@ +# This is an example PKGBUILD file. Use this as a start to creating your own, +# and remove these comments. For more information, see 'man PKGBUILD'. +# NOTE: Please fill out the license field for your package! If it is unknown, +# then please put 'unknown'. + +# Maintainer: Future Linux Team +pkgname=bash +pkgver=5.2.32 +pkgrel=1 +pkgdesc="The GNU Bourne Again shell" +arch=('x86_64') +url="https://www.gnu.org/software/bash/" +license=('GPL-3.0-or-later') +groups=('base') +depends=('glibc' 'readline' 'ncurses') +backup=(etc/{bashrc,profile,shells} + etc/profile.d/{bash_completion,dircolors,extrapaths,i18n,readline,umask}.sh + etc/skel/.bash{rc,_profile,_logout}) +source=(https://ftp.gnu.org/gnu/${pkgname}/${pkgname}-${pkgver}.tar.gz + bash_completion.sh + bashrc + dircolors.sh + extrapaths.sh + i18n.sh + profile + readline.sh + shells + skel_bash_logout + skel_bash_profile + skel_bashrc + umask.sh) +sha256sums=(d3ef80d2b67d8cbbe4d3265c63a72c46f9b278ead6e0e06d61801b58f23f50b5 + c3358ba9f1ad54255a6960236b092e32c5077f658385a9d11dd46ca73f18ad2b + 456936d471ac420a3dc10dfeee631c80579cee432802a29113c53f7e39d679bc + 1c8ce873176834ecf414926bd3b4f7ae42df4065c10d9c503bc6f38894253c29 + 33d9fe6dcff46760cd8a1f900cbc8b25b648261bee66af0caccdcaa1043d2623 + 04ddf9afa78ff75ad3f4e05fe4c86f4795a7aaeabb5f1f85f2d820b76b4b88e8 + 3488e7c0b739193c0c4a2dafa660ff74fd0fcd53aa5b09773afe77216fd828a6 + 515a7a055ca3a3903c53c1b1a313eb3b5fa6bfbb70017472e5ca413d3f3b391b + 1db1de0b837e46cac525afad0b39b41e730114294b209a023f2e7100a3efd2f7 + 0d3e7affb46fd79310d2d0b8ab63cdfbf1b6fbf58fbb6cae786db5a8d62f9bfd + b96ceb11cf69051af9876f0a8f80a100a88208d95ff4244a9eb30f076b40c436 + 5b7693b9fe722063f4b2a6aece9ed71055edb3540b69d35038d27a8b17ee640f + 6ffa96e2dca75701c2e36ae1566c3b3b7e53464960be9e4b75ba730526a200b3) + +build() { + cd ${pkgname}-${pkgver} + + ${CONFIGURE} \ + --without-bash-malloc \ + --with-installed-readline \ + bash_cv_strtold_broken=no \ + --docdir=/usr/share/doc/${pkgname}-${pkgver} + + make +} + +package() { + cd ${pkgname}-${pkgver} + + make DESTDIR=${pkgdir} install + + ln -s bash ${pkgdir}/usr/bin/sh + + install --directory --mode=0755 --owner=root --group=root ${pkgdir}/etc/profile.d + + + install --directory --mode=0755 --owner=root --group=root ${pkgdir}/etc/bash_completion.d + + for file in {bash_completion,dircolors,extrapaths,readline,umask,i18n}.sh + do + install -vm644 ${srcdir}/${file} ${pkgdir}/etc/profile.d/${file} + done + + + install -vDm644 ${srcdir}/bashrc ${pkgdir}/etc/bashrc + install -vDm644 ${srcdir}/profile ${pkgdir}/etc/profile + install -vDm644 ${srcdir}/shells ${pkgdir}/etc/shells + + install -dv -m 0750 ${pkgdir}/root + for file_skel in skel_bash{rc,_profile,_logout} + do + install -vDm644 ${srcdir}/${file_skel} ${pkgdir}/etc/skel/.${file_skel#*_} + done + + dircolors -p > ${pkgdir}/etc/dircolors +} diff --git a/bash/bash_completion.sh b/bash/bash_completion.sh new file mode 100644 index 0000000..4ea3521 --- /dev/null +++ b/bash/bash_completion.sh @@ -0,0 +1,34 @@ +# Begin /etc/profile.d/bash_completion.sh +# Import bash completion scripts + +# If the bash-completion package is installed, use its configuration instead +if [ -f /usr/share/bash-completion/bash_completion ]; then + + # Check for interactive bash and that we haven't already been sourced. + if [ -n "${BASH_VERSION-}" -a -n "${PS1-}" -a -z "${BASH_COMPLETION_VERSINFO-}" ]; then + + # Check for recent enough version of bash. + if [ ${BASH_VERSINFO[0]} -gt 4 ] || \ + [ ${BASH_VERSINFO[0]} -eq 4 -a ${BASH_VERSINFO[1]} -ge 1 ]; then + [ -r "${XDG_CONFIG_HOME:-$HOME/.config}/bash_completion" ] && \ + . "${XDG_CONFIG_HOME:-$HOME/.config}/bash_completion" + if shopt -q progcomp && [ -r /usr/share/bash-completion/bash_completion ]; then + # Source completion code. + . /usr/share/bash-completion/bash_completion + fi + fi + fi + +else + + # bash-completions are not installed, use only bash completion directory + if shopt -q progcomp; then + for script in /etc/bash_completion.d/* ; do + if [ -r $script ] ; then + . $script + fi + done + fi +fi + +# End /etc/profile.d/bash_completion.sh diff --git a/bash/bashrc b/bash/bashrc new file mode 100644 index 0000000..5c9c2c5 --- /dev/null +++ b/bash/bashrc @@ -0,0 +1,33 @@ +# Begin /etc/bashrc + +# System wide aliases and functions. + +# 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 + +# Provides colored /bin/ls and /bin/grep commands. Used in conjunction +# with code in /etc/profile. + +alias ls='ls --color=auto' +alias ll='ls -F -b -T 0 --group-directories-first --color=auto --format=long --time-style="+%F %T" --human-readable' +alias grep='grep --color=auto' + +# 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.] + +NORMAL="\[\e[0m\]" +RED="\[\e[1;31m\]" +GREEN="\[\e[1;32m\]" +if [[ $EUID == 0 ]] ; then + PS1="$RED\u [ $NORMAL\w$RED ]# $NORMAL" +else + PS1="$GREEN\u [ $NORMAL\w$GREEN ]\$ $NORMAL" +fi + +unset RED GREEN NORMAL + +# End /etc/bashrc diff --git a/bash/dircolors.sh b/bash/dircolors.sh new file mode 100644 index 0000000..16d350e --- /dev/null +++ b/bash/dircolors.sh @@ -0,0 +1,12 @@ +# Setup for /bin/ls and /bin/grep to support color, the alias is in /etc/bashrc. +if [ -f "/etc/dircolors" ] ; then + eval $(dircolors -b /etc/dircolors) +fi + +if [ -f "$HOME/.dircolors" ] ; then + eval $(dircolors -b $HOME/.dircolors) +fi + +alias ls='ls --color=auto' +alias ll='ls -F -b -T 0 --group-directories-first --color=auto --format=long --time-style="+%F %T" --human-readable' +alias grep='grep --color=auto' diff --git a/bash/extrapaths.sh b/bash/extrapaths.sh new file mode 100644 index 0000000..1ae61e4 --- /dev/null +++ b/bash/extrapaths.sh @@ -0,0 +1,17 @@ +if [ -d /usr/local/lib64/pkgconfig ] ; then + pathappend /usr/local/lib64/pkgconfig PKG_CONFIG_PATH +fi +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 + +if [ -d /usr/local/share ]; then + pathprepend /usr/local/share XDG_DATA_DIRS +fi + +# Set some defaults before other applications add to these paths. +pathappend /usr/share/man MANPATH +pathappend /usr/share/info INFOPATH diff --git a/bash/i18n.sh b/bash/i18n.sh new file mode 100644 index 0000000..9b96762 --- /dev/null +++ b/bash/i18n.sh @@ -0,0 +1,17 @@ +# Set up i18n variables +for i in $(locale); do + unset ${i%=*} +done + +if [[ "$TERM" = linux ]]; then + export LANG=C.UTF-8 +else + source /etc/locale.conf + + for i in $(locale); do + key=${i%=*} + if [[ -v $key ]]; then + export $key + fi + done +fi diff --git a/bash/profile b/bash/profile new file mode 100644 index 0000000..d794214 --- /dev/null +++ b/bash/profile @@ -0,0 +1,82 @@ +# Begin /etc/profile + +# System wide environment variables and startup programs. + +# 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. + +# 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" +} + +export -f pathremove pathprepend pathappend + +# Set the initial path +export PATH=/usr/bin + +# Attempt to provide backward compatibility with LFS earlier than 11 +if [ ! -L /bin ]; then + pathappend /bin +fi + +if [ $EUID -eq 0 ] ; then + pathappend /usr/sbin + if [ ! -L /sbin ]; then + pathappend /sbin + fi + unset HISTFILE +fi + +# Set up some environment variables. +export HISTSIZE=1000 +export HISTIGNORE="&:[bf]g:exit" + +# Set some defaults for graphical systems +export XDG_DATA_DIRS=${XDG_DATA_DIRS:-/usr/share/} +export XDG_CONFIG_DIRS=${XDG_CONFIG_DIRS:-/etc/xdg/} +export XDG_RUNTIME_DIR=${XDG_RUNTIME_DIR:-/tmp/xdg-$USER} + +# Set up a red prompt for root and a green one for users. +NORMAL="\[\e[0m\]" +RED="\[\e[1;31m\]" +GREEN="\[\e[1;32m\]" +if [[ $EUID == 0 ]] ; then + PS1="$RED\u [ $NORMAL\w$RED ]# $NORMAL" +else + PS1="$GREEN\u [ $NORMAL\w$GREEN ]\$ $NORMAL" +fi + +for script in /etc/profile.d/*.sh ; do + if [ -r $script ] ; then + . $script + fi +done + +unset script RED GREEN NORMAL + +# End /etc/profile diff --git a/bash/readline.sh b/bash/readline.sh new file mode 100644 index 0000000..3429191 --- /dev/null +++ b/bash/readline.sh @@ -0,0 +1,5 @@ +# Set up the INPUTRC environment variable. +if [ -z "$INPUTRC" -a ! -f "$HOME/.inputrc" ] ; then + INPUTRC=/etc/inputrc +fi +export INPUTRC diff --git a/bash/readline.sh.1 b/bash/readline.sh.1 new file mode 100644 index 0000000..3429191 --- /dev/null +++ b/bash/readline.sh.1 @@ -0,0 +1,5 @@ +# Set up the INPUTRC environment variable. +if [ -z "$INPUTRC" -a ! -f "$HOME/.inputrc" ] ; then + INPUTRC=/etc/inputrc +fi +export INPUTRC diff --git a/bash/shells b/bash/shells new file mode 100644 index 0000000..de78133 --- /dev/null +++ b/bash/shells @@ -0,0 +1,6 @@ +# Begin /etc/shells + +/bin/sh +/bin/bash + +# End /etc/shells diff --git a/bash/skel_bash_logout b/bash/skel_bash_logout new file mode 100644 index 0000000..6d3002d --- /dev/null +++ b/bash/skel_bash_logout @@ -0,0 +1,5 @@ +# Begin ~/.bash_logout + +# Personal items to perform on logout. + +# End ~/.bash_logout diff --git a/bash/skel_bash_profile b/bash/skel_bash_profile new file mode 100644 index 0000000..2241295 --- /dev/null +++ b/bash/skel_bash_profile @@ -0,0 +1,22 @@ +# Begin ~/.bash_profile + +# Personal environment variables and startup programs. + +# Personal aliases and functions should go in ~/.bashrc. System wide +# environment variables and startup programs are in /etc/profile. +# System wide aliases and functions are in /etc/bashrc. + +if [ -f "$HOME/.bashrc" ] ; then + source $HOME/.bashrc +fi + +if [ -d "$HOME/bin" ] ; then + pathprepend $HOME/bin +fi + +# Having . in the PATH is dangerous +#if [ $EUID -gt 99 ]; then +# pathappend . +#fi + +# End ~/.bash_profile diff --git a/bash/skel_bashrc b/bash/skel_bashrc new file mode 100644 index 0000000..2717ad5 --- /dev/null +++ b/bash/skel_bashrc @@ -0,0 +1,17 @@ +# Begin ~/.bashrc + +# Personal aliases and functions. + +# Personal environment variables and startup programs should go in +# ~/.bash_profile. System wide environment variables and startup +# programs are in /etc/profile. System wide aliases and functions are +# in /etc/bashrc. + +if [ -f "/etc/bashrc" ] ; then + source /etc/bashrc +fi + +# Set up user specific i18n variables +#export LANG=_.<@modifiers> + +# End ~/.bashrc diff --git a/bash/umask.sh b/bash/umask.sh new file mode 100644 index 0000000..191d324 --- /dev/null +++ b/bash/umask.sh @@ -0,0 +1,6 @@ +# By default, the umask should be set. +if [ "$(id -gn)" = "$(id -un)" -a $EUID -gt 99 ] ; then + umask 002 +else + umask 022 +fi