commit:     fd35a0112ade616bcdbebb3b27edb3a752b9a0d9
Author:     Zelin2001 <lizl2023 <AT> ion <DOT> ac <DOT> cn>
AuthorDate: Fri Aug  8 02:23:47 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Oct  3 04:58:30 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=fd35a011

sys-fs/snapraid: dash-compatibility fix

This is a patch for the testing process that remove dependency on bash shell.

Closes: https://bugs.gentoo.org/927538
Signed-off-by: Li Ze-Lin <lizl2023 <AT> ion.ac.cn>
Part-of: https://github.com/gentoo/gentoo/pull/43379
Closes: https://github.com/gentoo/gentoo/pull/43379
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../files/snapraid-12.4-dash-compatibility.patch   | 23 +++++++++++++++
 sys-fs/snapraid/snapraid-12.4-r1.ebuild            | 34 ++++++++++++++++++++++
 2 files changed, 57 insertions(+)

diff --git a/sys-fs/snapraid/files/snapraid-12.4-dash-compatibility.patch 
b/sys-fs/snapraid/files/snapraid-12.4-dash-compatibility.patch
new file mode 100644
index 000000000000..f65bba012158
--- /dev/null
+++ b/sys-fs/snapraid/files/snapraid-12.4-dash-compatibility.patch
@@ -0,0 +1,23 @@
+Replace conditional expression with `test`
+to ensure compatibility with different shell environments.
+
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -512,7 +512,7 @@
+       echo RUN > bench/disk1/RUN-CHMOD
+ if HAVE_POSIX
+ # Doesn't run this test as root because the root user override permissions
+-      if [[ $$EUID -ne 0 ]]; then \
++      if test "$$EUID" -ne 0; then \
+               $(FAILENV) ./snapraid$(EXEEXT) $(CHECKFLAGS) -c $(CONF) 
--test-run "chmod a-r bench/disk1/RUN-CHMOD" --test-expect-failure sync; \
+       fi
+ endif
+@@ -532,7 +532,7 @@
+       echo HASH > bench/disk1/HASH-CHMOD
+ if HAVE_POSIX
+ # Doesn't run this test as root because the root user override permissions
+-      if [[ $$EUID -ne 0 ]]; then \
++      if test "$$EUID" -ne 0; then \
+               $(FAILENV) ./snapraid$(EXEEXT) $(CHECKFLAGS) -c $(CONF) 
--test-run "chmod a-r bench/disk1/HASH-CHMOD" --test-expect-failure -h sync; \
+       fi
+ endif

diff --git a/sys-fs/snapraid/snapraid-12.4-r1.ebuild 
b/sys-fs/snapraid/snapraid-12.4-r1.ebuild
new file mode 100644
index 000000000000..67c858b068c4
--- /dev/null
+++ b/sys-fs/snapraid/snapraid-12.4-r1.ebuild
@@ -0,0 +1,34 @@
+# Copyright 1999-2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit autotools
+
+DESCRIPTION="Backup program with disk array for cold data on existing 
filesystems"
+HOMEPAGE="https://www.snapraid.it/";
+SRC_URI="https://github.com/amadvance/${PN}/releases/download/v${PV}/${P}.tar.gz";
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="test"
+RESTRICT="!test? ( test )"
+BDEPEND="test? ( sys-apps/smartmontools )"
+
+DOCS=( "AUTHORS" "HISTORY" "README" "TODO" "snapraid.conf.example" )
+
+PATCHES=(
+       "${FILESDIR}/snapraid-12.4-dash-compatibility.patch"
+)
+
+src_prepare() {
+       default
+       eautoreconf
+}
+
+pkg_postinst() {
+       elog "To start using SnapRAID, change the example configuration"
+       elog "${EPREFIX}/usr/share/doc/${PF}/snapraid.conf.example.bz2"
+       elog "to fit your needs and copy it to ${EPREFIX}/etc/snapraid.conf"
+}

Reply via email to