portage-overlay

personal portage ebuild repository
git clone anongit@rnpnr.xyz:portage-overlay.git
Log | Files | Refs | Feed | README

Commit: e86ae5ebde6524970b16c107820d8668359154e4
Parent: b61f7c1e5e8e02f0bd071071dd7917937e4ac825
Author: Randy Palamar
Date:   Sun,  1 Jan 2023 23:07:53 -0700

update oksh ebuild and add to app-alternatives/sh

Diffstat:
Aapp-alternatives/sh/sh-0.ebuild | 48++++++++++++++++++++++++++++++++++++++++++++++++
Mapp-shells/oksh/oksh-9999.ebuild | 18+++++++++++++-----
2 files changed, 61 insertions(+), 5 deletions(-)

diff --git a/app-alternatives/sh/sh-0.ebuild b/app-alternatives/sh/sh-0.ebuild @@ -0,0 +1,48 @@ +# Copyright 2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +ALTERNATIVES=( + bash:app-shells/bash + busybox:sys-apps/busybox + dash:app-shells/dash + ksh:app-shells/ksh + "lksh:app-shells/mksh[lksh]" + mksh:app-shells/mksh + oksh:app-shells/oksh +) + +inherit app-alternatives + +DESCRIPTION="/bin/sh (POSIX shell) symlink" +KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86 ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris" + +RDEPEND=" + !app-eselect/eselect-sh +" + +pkg_setup() { + if [[ -z ${ROOT} ]] && use busybox ; then + # Needed to avoid busybox preferring internal applets over PATH lookups. + # https://web.archive.org/web/20221206223848/https://busybox.net/FAQ.html#standalone_shell. + if busybox bbconfig | grep -q "CONFIG_FEATURE_SH_STANDALONE=y" ; then + ewarn "busybox is configured with CONFIG_FEATURE_SH_STANDALONE=y!" + ewarn "This is not a safe configuration for busybox as /bin/sh." + ewarn "Please use savedconfig to disable CONFIG_FEATURE_SH_STANDALONE on busybox." + die "Aborting due to unsafe Busybox configuration (CONFIG_FEATURE_SH_STANDALONE=y)!" + fi + fi +} + +src_install() { + dosym "$(get_alternative)" /bin/sh || die +} + +pkg_postrm() { + # make sure we don't leave the user without /bin/sh, since it's not + # been owned by any other package + if [[ ! -h ${EROOT}/bin/sh ]]; then + ln -s bash "${EROOT}/bin/sh" || die + fi +} diff --git a/app-shells/oksh/oksh-9999.ebuild b/app-shells/oksh/oksh-9999.ebuild @@ -10,23 +10,31 @@ LICENSE="public-domain" SLOT=0 IUSE="+static +ksh curses" +RDEPEND="ksh? ( !app-shells/ksh )" + src_configure() { econf CC=${CC} \ $(use_enable static) \ - $(use_enable ksh) \ $(use_enable curses) \ - --prefix=/ \ - --bindir=/bin \ - --mandir=/usr/share/man + --prefix="${EPREFIX}"/ \ + --bindir="${EPREFIX}"/bin \ + --mandir="${EPREFIX}"/usr/share/man } src_install() { emake DESTDIR="${D}" install + use ksh && dosym oksh /bin/ksh || die einstalldocs + use ksh && dosym oksh.1.gz "${EPREFIX}"/usr/share/man/man1/ksh.1 || die } pkg_postinst() { - if ! grep -q '^/bin/ksh$' "${EROOT}"/etc/shells ; then + if ! grep -q '^/bin/oksh$' "${EROOT}"/etc/shells ; then + ebegin "Updating /etc/shells" + echo "/bin/oksh" >> "${EROOT}"/etc/shells + eend $? + fi + if use ksh && ! grep -q '^/bin/ksh$' "${EROOT}"/etc/shells ; then ebegin "Updating /etc/shells" echo "/bin/ksh" >> "${EROOT}"/etc/shells eend $?