File 0971-Adjust-the-installation-scripts-for-Android.patch of Package erlang

From 668c9098c6238795d66be95ed9fa77fc29892fc2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9r=C3=B4me=20de=20Bretagne?=
 <jerome.debretagne@gmail.com>
Date: Thu, 27 Aug 2020 12:15:37 +0200
Subject: [PATCH] Adjust the installation scripts for Android

Replace /bin/sh into /system/bin/sh in the various Erlang/OTP release
scripts and update the documentation accordingly.
---
 HOWTO/INSTALL-ANDROID.md    | 16 ++--------------
 erts/Makefile               |  9 +++++++++
 erts/etc/common/Makefile.in | 16 ++++++++++++++++
 3 files changed, 27 insertions(+), 14 deletions(-)

diff --git a/erts/Makefile.in b/erts/Makefile.in
index 7808dccecc..4827789c96 100644
--- a/erts/Makefile.in
+++ b/erts/Makefile.in
@@ -111,6 +111,15 @@ local_setup:
 		$(ERL_TOP)/bin/start_sasl.script \
 		$(ERL_TOP)/bin/start_clean.script \
 		$(ERL_TOP)/bin/no_dot_erlang.script
+# On Android, the shell is found in /system/bin/sh instead of /bin/sh
+	@case "$(TARGET)" in \
+		*-android*) \
+		sed -i'' -e "s;/bin/sh;/system/bin/sh;" \
+			$(ERL_TOP)/bin/erl; \
+		sed -i'' -e "s;/bin/sh;/system/bin/sh;" \
+			$(ERL_TOP)/bin/cerl; \
+		;; \
+	esac
 
 # Run the configure script
 .PHONY: configure
diff --git a/erts/etc/common/Makefile.in b/erts/etc/common/Makefile.in
index 650ab1f6fe..7a2b821c46 100644
--- a/erts/etc/common/Makefile.in
+++ b/erts/etc/common/Makefile.in
@@ -513,6 +513,13 @@ endif
 ifneq ($(TARGET), win32)
 ifneq ($(findstring vxworks,$(TARGET)), vxworks)
 	$(INSTALL_SCRIPT) erl.src "$(RELEASE_PATH)/erts-$(VSN)/bin"
+# On Android, the shell is found in /system/bin/sh instead of /bin/sh
+	case "$(TARGET)" in \
+		*-android*) \
+		sed -i'' -e "s;/bin/sh;/system/bin/sh;" \
+			"$(RELEASE_PATH)/erts-$(VSN)/bin/erl.src" \
+		;; \
+	esac
 endif
 endif
 ifneq ($(INSTALL_PROGS),)
@@ -534,6 +541,15 @@ ifneq ($(INSTALL_SRC),)
 endif
 ifneq ($(INSTALL_EMBEDDED_DATA),)
 	$(INSTALL_SCRIPT) $(INSTALL_EMBEDDED_DATA) "$(RELEASE_PATH)/erts-$(VSN)/bin"
+# On Android, the shell is found in /system/bin/sh instead of /bin/sh
+	case "$(TARGET)" in \
+		*-android*) \
+		sed -i'' -e "s;/bin/sh;/system/bin/sh;" \
+			"$(RELEASE_PATH)/erts-$(VSN)/bin/start_erl.src"; \
+		sed -i'' -e "s;/bin/sh;/system/bin/sh;" \
+			"$(RELEASE_PATH)/erts-$(VSN)/bin/start.src"; \
+		;; \
+	esac
 endif
 ifneq ($(INSTALL_LIBS),)
 	$(INSTALL_DATA) $(INSTALL_LIBS) "$(RELEASE_PATH)/erts-$(VSN)/bin"
-- 
2.26.2

openSUSE Build Service is sponsored by