diff options
-rw-r--r-- | .SRCINFO | 16 | ||||
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | PKGBUILD | 68 | ||||
-rw-r--r-- | ksh93.install | 40 | ||||
-rw-r--r-- | sample.kshrc | 157 |
5 files changed, 137 insertions, 146 deletions
@@ -1,24 +1,20 @@ pkgbase = ksh93-git - pkgdesc = AT&T's KornShell (ksh93) from ast-base - pkgver = r5.0be82553 + pkgdesc = KornShell 93u+m, fork based on ksh 93u+ + pkgver = r1291.654461d2 pkgrel = 1 - url = http://kornshell.org/ + url = https://github.com/ksh93/ksh/ install = ksh93.install arch = x86_64 license = EPL - license = CPL - makedepends = gcc makedepends = git depends = glibc provides = ksh + provides = ksh93 conflicts = ksh conflicts = ksh93 - source = ksh93::git+http://github.com/att/ast#branch=master + source = ksh93::git+http://github.com/ksh93/ksh#branch=dev source = sample.kshrc - source = LICENSE sha512sums = SKIP - sha512sums = aeb54cb5ec944628ab64a692d364cab14bbc312c1a892b3692058f7f7b1cf72c95a6bfb4a95ffc3c4ddfb8f8ca4d17707023108d5504f912cb3ceb9e8d4da6b3 - sha512sums = 917ae643f241741919eb7f4633ec7b3cd58fb0d19150a017773562c36b15812bcf5f680024994d546ef18d771ab25aefc4bfe57ebd0c08043c9ad17e9cd7e076 + sha512sums = e9837bede44d13d47a342456ad911534dc7f4965f0611f369459849047e8c77d3c6678b60e7a7bbe0aa5f12b88325685b3cd68a6dcb3d5bcd970fd68d3d40ba7 pkgname = ksh93-git - diff --git a/.gitignore b/.gitignore index 60fa0c9c46f4..388e0f7c562d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ pkg/ src/ ksh93/ -*.xz +*.zst @@ -1,25 +1,24 @@ -# Maintainer: Adrien Wu <adrien.sf.wu dot gmail at com> +# Maintainer: Johnothan King <johnothanking dot protonmail at com> +# Contributor: Adrien Wu <adrien.sf.wu dot gmail at com> # Contributor: Head_on_a_Stick <matthew.t.hoare dot gmail at com> _pkgname='ksh93' pkgname="${_pkgname}-git" -pkgver=r5.0be82553 +pkgver=r1291.654461d2 pkgrel=1 -pkgdesc="AT&T's KornShell (${_pkgname}) from ast-base" +pkgdesc="KornShell 93u+m, fork based on ksh 93u+" arch=('x86_64') -url='http://kornshell.org/' -license=('EPL' 'CPL') +url='https://github.com/ksh93/ksh/' +license=('EPL') depends=('glibc') -makedepends=('gcc' 'git') +makedepends=('git') conflicts=('ksh' 'ksh93') -provides=('ksh') +provides=('ksh' 'ksh93') install='ksh93.install' -source=("${_pkgname}::git+http://github.com/att/ast#branch=master" -'sample.kshrc' -'LICENSE') +source=("${_pkgname}::git+http://github.com/ksh93/ksh#branch=dev" + 'sample.kshrc') sha512sums=('SKIP' -'aeb54cb5ec944628ab64a692d364cab14bbc312c1a892b3692058f7f7b1cf72c95a6bfb4a95ffc3c4ddfb8f8ca4d17707023108d5504f912cb3ceb9e8d4da6b3' -'917ae643f241741919eb7f4633ec7b3cd58fb0d19150a017773562c36b15812bcf5f680024994d546ef18d771ab25aefc4bfe57ebd0c08043c9ad17e9cd7e076') + 'e9837bede44d13d47a342456ad911534dc7f4965f0611f369459849047e8c77d3c6678b60e7a7bbe0aa5f12b88325685b3cd68a6dcb3d5bcd970fd68d3d40ba7') pkgver() { cd "${_pkgname}" @@ -28,37 +27,34 @@ pkgver() { build() { cd "${srcdir}/${_pkgname}" - ./bin/package make + test -n "${CFLAGS}" || CFLAGS=-Os # Fallback to default ksh flags if necessary + ./bin/package make CCFLAGS="${CFLAGS}" } package() { cd "${srcdir}" - install -dm 755 "${pkgdir}/usr/share/ksh" - install -dm 755 "${pkgdir}/usr/share/ksh/functions" - install -dm 755 "${pkgdir}/usr/share/doc/ksh" - install -dm 755 "${pkgdir}/usr/share/licenses/ksh" - install -Dm 644 LICENSE "${pkgdir}/usr/share/licenses/ksh/LICENSE" - install -Dm 644 sample.kshrc "${pkgdir}/etc/skel/.kshrc" + install -dm0755 "${pkgdir}/usr/share/ksh" + install -dm0755 "${pkgdir}/usr/share/ksh/functions" + install -dm0755 "${pkgdir}/usr/share/doc/ksh" + install -dm0755 "${pkgdir}/usr/share/licenses/ksh" + install -Dm0644 sample.kshrc "${pkgdir}/etc/skel/.kshrc" cd "${srcdir}/$_pkgname" - install -Dm 644 "src/cmd/${_pkgname}/nval.3" "${pkgdir}/usr/share/man/man3/nval.3" - install -Dm 644 "src/cmd/${_pkgname}/shell.3" "${pkgdir}/usr/share/man/man3/shell.3" - install -Dm 644 "src/cmd/${_pkgname}/sh.1" "${pkgdir}/usr/share/man/man1/ksh.1" - local _man - for _man in 'rksh' 'pfksh'; do - ln -sf 'ksh.1' "${pkgdir}/usr/share/man/man1/${_man}.1" + install -Dm0644 LICENSE.md "${pkgdir}/usr/share/licenses/ksh/LICENSE.md" + install -Dm0644 "src/cmd/${_pkgname}/nval.3" "${pkgdir}/usr/share/man/man3/nval.3" + install -Dm0644 "src/cmd/${_pkgname}/shell.3" "${pkgdir}/usr/share/man/man3/shell.3" + install -Dm0644 "src/cmd/${_pkgname}/sh.1" "${pkgdir}/usr/share/man/man1/ksh.1" + for _man in 'ksh93' 'rksh'; do + ln -srf 'ksh.1' "${pkgdir}/usr/share/man/man1/${_man}.1" done - local _fun - for _fun in 'dirs' 'popd' 'pushd'; do - install -Dm 644 "src/cmd/${_pkgname}/fun/${_fun}" "${pkgdir}/usr/share/ksh/functions/${_fun}" + for _fun in 'autocd' 'man' 'dirs' 'popd' 'pushd'; do + install -Dm0644 "src/cmd/${_pkgname}/fun/${_fun}" "${pkgdir}/usr/share/ksh/functions/${_fun}" done - local _dox - for _dox in 'COMPATIBILITY' 'DESIGN' 'OBSOLETE' 'README' 'RELEASE' 'RELEASE88' 'RELEASE93' 'TYPES'; do - install -Dm 644 "src/cmd/${_pkgname}/${_dox}" "${pkgdir}/usr/share/doc/ksh/${_dox}" + for _doc in 'COMPATIBILITY' 'DESIGN' 'OBSOLETE' 'PROMO.mm' 'README' 'README-AUDIT.md' 'RELEASE' 'RELEASE88' 'RELEASE93' 'TYPES'; do + install -Dm0644 "src/cmd/${_pkgname}/${_doc}" "${pkgdir}/usr/share/doc/ksh/${_doc}" done - install -Dm 755 "arch/linux.i386-64/bin/ksh" "${pkgdir}/usr/bin/ksh" - local _exe - for _exe in 'rksh' 'pfksh'; do - ln -sf 'ksh' "${pkgdir}/usr/bin/${_exe}" + install -Dm0755 "arch/linux.i386-64/bin/ksh" "${pkgdir}/usr/bin/ksh" + for _exe in 'ksh93' 'rksh'; do + ln -srf 'ksh' "${pkgdir}/usr/bin/${_exe}" done - install -Dm 755 "arch/linux.i386-64/bin/shcomp" "${pkgdir}/usr/bin/shcomp" + install -Dm0755 "arch/linux.i386-64/bin/shcomp" "${pkgdir}/usr/bin/shcomp" } diff --git a/ksh93.install b/ksh93.install index 2f098b9162ef..8ac52c373642 100644 --- a/ksh93.install +++ b/ksh93.install @@ -1,34 +1,40 @@ pre_install() { - : + : } post_install() { - grep -qle '/bin/ksh$' '/etc/shells' || echo $'/usr/bin/ksh\n/bin/ksh' >> '/etc/shells' + grep -qle '/bin/ksh$' '/etc/shells' || echo $'/usr/bin/ksh\n/bin/ksh' >> '/etc/shells' + grep -qle '/bin/ksh93$' '/etc/shells' || echo $'/usr/bin/ksh93\n/bin/ksh93' >> '/etc/shells' + grep -qle '/bin/rksh$' '/etc/shells' || echo $'/usr/bin/rksh\n/bin/rksh' >> '/etc/shells' } pre_upgrade() { - : + : } post_upgrade() { - post_install + post_install } pre_remove() { - if getent passwd root | cut -d: -f7 | grep -qle '/bin/ksh'; then - echo '**************************************************' - echo '*** Warning: root has ksh as the login shell.' - echo '*** Shell changed to sh to prevent loss of access.' - echo '**************************************************' - chsh -s '/bin/sh' - fi - sed -i -e '/^\/bin\/ksh$/d' -e '/^\/usr\/bin\/ksh$/d' '/etc/shells' + for _ksh in ksh ksh93 rksh; do + if getent passwd root | cut -d: -f7 | grep -qle "/bin/${_ksh}"; then + echo "**************************************************" + echo "*** Warning: root has ${_ksh} as the login shell." + echo "*** Shell changed to sh to prevent loss of access." + echo "**************************************************" + chsh -s '/bin/sh' + fi + sed -i -e '/^\/bin\/'"${_ksh}"'$/d' -e '/^\/usr\/bin\/'"${_ksh}"'$/d' '/etc/shells' + done } post_remove() { - # /usr/bin/ksh is also detected - if getent passwd | cut -d: -f7 | grep -qle '/bin/ksh'; then - echo '*** Warning: Some users have ksh as their login shell.' - echo '*** Fix promptly to restore access.' - fi + # /usr/bin/${_ksh} is also detected + for _ksh in ksh ksh93 rksh; do + if getent passwd | cut -d: -f7 | grep -qle "/bin/${_ksh}"; then + echo "*** Warning: Some users have ${_ksh} as their login shell." + echo "*** Fix promptly to restore access." + fi + done } diff --git a/sample.kshrc b/sample.kshrc index ae6834b370d9..0890b4bad03a 100644 --- a/sample.kshrc +++ b/sample.kshrc @@ -1,91 +1,84 @@ # This file contains examples of some of the things you may want to # include in a user startup file. -# skip this setup for non-interactive shells -[[ -o interactive && -t 0 ]] || return +# Set the shell options +set -o emacs -o notify -o globstar +[[ -o nobackslashctrl ]] && set -o nobackslashctrl +[[ -o globcasedetect ]] && set -o globcasedetect +#[[ -o noarrowkeysearch ]] && set -o noarrowkeysearch -# disable core dumps -ulimit -c 0 - -# Environment variables. These could go in .profile if you prefer -export VISUAL=vi -export EDITOR=$VISUAL -export PAGER=less -export GZIP=-9 - -# set some shell options -set -o emacs -o trackall -o globstar - -# specify search path for autoloadable functions +# Specify search path for autoloadable functions FPATH=/usr/share/ksh/functions:~/.func -# avoid certain file types in completion -FIGNORE='@(*.o|~*)' - -# save more commands in history -HISTSIZE=500 -HISTEDIT=$EDITOR - -# aliases for various command shortcuts -alias ll='ls -lFb' -alias la='ls -LaFb' -alias pu='ps -fu $USER' -alias md=mkdir -alias rd=rmdir - -# avoid problems with long argument lists for some commands (like xargs) -alias cp='command -x cp' mv='command -x mv' grep='command -x grep' - -# some short functions - -# empty line -empty() { echo $'\e[3J'; } - -# man page viewer -mere() { nroff -man -Tman $1 | ${MANPAGER:-less}; } - -# view/manipulate and export environment variables -setenv() { - case $# in - 0) export ;; - 1) export "$1"= ;; - *) export "$1"="$2" ;; - esac - } - -# Use keyboard trap to map keys to other keys -# note that escape sequences vary for different terminals so these -# may not work for you -trap '.sh.edchar=${keymap[${.sh.edchar}]:-${.sh.edchar}}' KEYBD -keymap=( - [$'\eOD']=$'\eb' # Ctrl-Left -> move word left - [$'\eOC']=$'\ef' # Ctrl-Right -> move word right - [$'\e[3~']=$'\cd' # Delete -> delete to right - [$'\e[1~']=$'\ca' # Home -> move to beginning of line - [$'\e[4~']=$'\ce' # End -> move to end of line +# Optional: Autoload functions installed with ksh +#autoload autocd +#autoload man +#autoload dirs +#autoload pushd +#autoload popd + +# Optional: Set the precision of the time keyword to six and use %C +#((.sh.version >= 20220606)) && TIMEFORMAT=$'\nreal\t%6lR\ncpu\t%6lC' + +# Optional: Avoid certain file types in completion +#FIGNORE='@(*.o|~*)' + +# Save more commands in history +HISTSIZE=2000 +#HISTEDIT=$EDITOR + +# Remove the problematic default 'r' alias (this is only +# done when it's safe, as old versions of ksh can crash +# after 'unalias r'). +((.sh.version >= 20220806)) && unalias r + +# Below is a basic example that provides extra tilde expansions +if ((.sh.version >= 20210318)) && [[ $(id -u) != 0 ]]; then + .sh.tilde.get() + { + case ${.sh.tilde} in + '~docs') .sh.tilde=~/Documents ;; + '~dls') .sh.tilde=~/Downloads ;; + '~share') .sh.tilde=~/.local/share ;; + esac + } +fi + +# Associative array containing a set of RGB color codes. +# Terminals emulators with support for wide color ranges +# can take better advantage of this. +typeset -A color=( + [bright_lavender]=$'\E[38;2;191;148;228m' + [red]=$'\E[38;2;255;0;0m' + [cyan_process]=$'\E[38;2;0;183;235m' + [ultramarine_blue]=$'\E[38;2;65;102;245m' + [reset]=$'\E[0m' + # Some extra examples + #[start_title]=$'\E]0;' + #[bell]=$'\a' + #[underline]=$'\E[4m' + #[spaced_dots]=$'\E[4:5m' ) -# keep a shortened version of the current directory for the prompt -function _cd { - typeset -n dir=HOME - - "cd" "$@" - - if [[ $PWD = $HOME* && $HOME != / ]]; then - _pwd=\~${PWD#$HOME} - return - fi - - for dir in JAVA_HOME GNOMEDIR; do - if [[ -n $dir && $PWD = $dir* ]]; then - _pwd="\$${!dir}${PWD#$dir}" - return - fi - done - _pwd="$PWD" +PS1.get() +{ + ret=$? # Workaround $? bug in ksh < 2022-03-16 (cf. https://github.com/ksh93/ksh/pull/226) + + pwd=$(pwd 2>/dev/null) + [[ ${pwd} == / ]] && return 0 + case ${pwd} in + ~) pwd='~' ;; + ~docs) pwd='~docs' ;; + ~dls) pwd='~dls' ;; + ~share) pwd='~share' ;; + '') pwd="${color[red]}No pwd found" ;; + *) pwd=${pwd##*/} ;; + esac + if [[ $(id -u) == 0 ]]; then + PS1='${color[bright_lavender]}${pwd} ${color[red]}#${color[reset]} ' + else + PS1='${color[ultramarine_blue]}${pwd} ${color[cyan_process]}\$${color[reset]} ' + fi + + return $ret } -alias cd=_cd -_cd . - -# put the current directory and history number in the prompt -PS1='$_pwd [!]\$ ' |