commit:     57378b29433826126d1cd5daa0b35c5055b4492f
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Tue Nov 22 21:23:40 2022 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Mon Nov 28 14:31:37 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=57378b29

app-alternatives/sh: Add an ebuild for /bin/sh symlink

Closes: https://github.com/gentoo/gentoo/pull/28390
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 app-alternatives/sh/metadata.xml    | 29 ++++++++++++++++++++++
 app-alternatives/sh/sh-0.ebuild     | 48 +++++++++++++++++++++++++++++++++++++
 profiles/arch/s390/package.use.mask |  4 ++++
 3 files changed, 81 insertions(+)

diff --git a/app-alternatives/sh/metadata.xml b/app-alternatives/sh/metadata.xml
new file mode 100644
index 000000000000..b91b8f41c94c
--- /dev/null
+++ b/app-alternatives/sh/metadata.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd";>
+<pkgmetadata>
+       <maintainer type="project">
+               <email>base-sys...@gentoo.org</email>
+               <name>Gentoo Base System</name>
+       </maintainer>
+       <maintainer type="person">
+               <email>mgo...@gentoo.org</email>
+               <name>Michał Górny</name>
+       </maintainer>
+       <use>
+               <flag name="bash">
+                       Symlink to <pkg>app-shells/bash</pkg>
+               </flag>
+               <flag name="dash">
+                       Symlink to <pkg>app-shells/dash</pkg>
+               </flag>
+               <flag name="ksh">
+                       Symlink to <pkg>app-shells/ksh</pkg>
+               </flag>
+               <flag name="lksh">
+                       Symlink to lksh from <pkg>app-shells/mksh</pkg>
+               </flag>
+               <flag name="mksh">
+                       Symlink to mksh from <pkg>app-shells/mksh</pkg>
+               </flag>
+       </use>
+</pkgmetadata>

diff --git a/app-alternatives/sh/sh-0.ebuild b/app-alternatives/sh/sh-0.ebuild
new file mode 100644
index 000000000000..5da158c80cab
--- /dev/null
+++ 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
+
+DESCRIPTION="/bin/sh (POSIX shell) symlink"
+HOMEPAGE="https://wiki.gentoo.org/wiki/Project:Base/Alternatives";
+SRC_URI=""
+S=${WORKDIR}
+
+LICENSE="CC0-1.0"
+SLOT="0"
+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"
+IUSE="+bash dash ksh lksh mksh"
+REQUIRED_USE="^^ ( bash dash ksh lksh mksh )"
+
+RDEPEND="
+       bash? ( app-shells/bash )
+       dash? ( app-shells/dash )
+       ksh? ( app-shells/ksh )
+       lksh? ( app-shells/mksh[lksh] )
+       mksh? ( app-shells/mksh )
+       !!app-eselect/eselect-sh
+"
+
+src_install() {
+       if use bash; then
+               dosym bash /bin/sh
+       elif use dash; then
+               dosym dash /bin/sh
+       elif use ksh; then
+               dosym ksh /bin/sh
+       elif use lksh; then
+               dosym lksh /bin/sh
+       elif use mksh; then
+               dosym mksh /bin/sh
+       else
+               die "Invalid USE flag combination (broken REQUIRED_USE?)"
+       fi
+}
+
+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/profiles/arch/s390/package.use.mask 
b/profiles/arch/s390/package.use.mask
index 1f332436d88b..32b5b218cfa8 100644
--- a/profiles/arch/s390/package.use.mask
+++ b/profiles/arch/s390/package.use.mask
@@ -1,6 +1,10 @@
 # Copyright 1999-2022 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
+# Michał Górny <mgo...@gentoo.org> (2022-11-25)
+# Unkeyworded shells.
+app-alternatives/sh lksh mksh
+
 # Florian Schmaus <f...@gentoo.org> (2022-11-23)
 # avoid larger deptree, bug #882593
 dev-python/bracex doc

Reply via email to