[packages/rpm-build-tools] Try to autodetect if unshare works.

arekm arekm at pld-linux.org
Sun Oct 19 20:31:45 CEST 2025


commit 7374fb5ca81789dac7a646a0a922dca09ddd5d0f
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date:   Sun Oct 19 20:31:27 2025 +0200

    Try to autodetect if unshare works.

 builder.sh | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
---
diff --git a/builder.sh b/builder.sh
index a68af54..decac98 100755
--- a/builder.sh
+++ b/builder.sh
@@ -149,8 +149,8 @@ TRY_UPGRADE=""
 # should the specfile be restored if upgrade failed?
 REVERT_BROKEN_UPGRADE="yes"
 
-# disable network for rpm build tool
-NONETWORK="unshare --user --net --map-current-user"
+# disable network for rpm build tool, autodetect if it works (doesn't work in chroot and in vserver guest)
+unshare --user --net --map-current-user true 2> /dev/null && NONETWORK="unshare --user --net --map-current-user" || NONETWORK=""
 
 if rpm --specsrpm 2>/dev/null; then
 	FETCH_BUILD_REQUIRES_RPMSPECSRPM="yes"
@@ -2183,7 +2183,6 @@ while [ $# -gt 0 ]; do
 		-bp | --build-prep )
 			COMMAND="build-prep"; shift ;;
 		-bs | --build-source )
-			NONETWORK="";
 			COMMAND="build-source"; shift ;;
 		-B | --branch )
 			COMMAND="branch"; shift; TAG="${1}"; shift;;
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/rpm-build-tools.git/commitdiff/7374fb5ca81789dac7a646a0a922dca09ddd5d0f



More information about the pld-cvs-commit mailing list