aboutsummaryrefslogtreecommitdiff
path: root/extra/go/patches/no-bash.patch
blob: a1130c0b80d950f73a6ba9e17f5d90461cb2a16a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
diff -ur a/go-current/src/make.bash b/go-current/src/make.bash
--- a/go-current/src/make.bash	2020-12-03 20:32:44.000000000 +0300
+++ b/go-current/src/make.bash	2021-01-02 00:36:42.692155781 +0300
@@ -1,4 +1,4 @@
-#!/usr/bin/env bash
+#!/bin/sh
 # Copyright 2009 The Go Authors. All rights reserved.
 # Use of this source code is governed by a BSD-style
 # license that can be found in the LICENSE file.
@@ -106,7 +106,7 @@
 # so loop through the possible selinux mount points.
 for se_mount in /selinux /sys/fs/selinux
 do
-	if [ -d $se_mount -a -f $se_mount/booleans/allow_execstack -a -x /usr/sbin/selinuxenabled ] && /usr/sbin/selinuxenabled; then
+	if [ -d $se_mount ] && [ -f $se_mount/booleans/allow_execstack ] && [ -x /usr/sbin/selinuxenabled ] && /usr/sbin/selinuxenabled; then
 		if ! cat $se_mount/booleans/allow_execstack | grep -c '^1 1$' >> /dev/null ; then
 			echo "WARNING: the default SELinux policy on, at least, Fedora 12 breaks "
 			echo "Go. You can enable the features that Go needs via the following "
@@ -154,14 +154,14 @@
 
 export GOROOT_BOOTSTRAP=${GOROOT_BOOTSTRAP:-$HOME/go1.4}
 export GOROOT="$(cd .. && pwd)"
-IFS=$'\n'; for go_exe in $(type -ap go); do
+for go_exe in $(command -v go); do
 	if [ ! -x "$GOROOT_BOOTSTRAP/bin/go" ]; then
 		goroot=$(GOROOT='' GOOS='' GOARCH='' "$go_exe" env GOROOT)
 		if [ "$goroot" != "$GOROOT" ]; then
 			GOROOT_BOOTSTRAP=$goroot
 		fi
 	fi
-done; unset IFS
+done
 GOROOT_BOOTSTRAP_VERSION=$($GOROOT_BOOTSTRAP/bin/go version | sed 's/go version //')
 echo "Building Go cmd/dist using $GOROOT_BOOTSTRAP. ($GOROOT_BOOTSTRAP_VERSION)"
 if $verbose; then
diff -ur a/go1.4-bootstrap/src/make.bash b/go1.4-bootstrap/src/make.bash
--- a/go1.4-bootstrap/src/make.bash	2017-11-22 04:33:58.000000000 +0300
+++ b/go1.4-bootstrap/src/make.bash	2021-01-02 00:11:00.448427915 +0300
@@ -1,4 +1,4 @@
-#!/usr/bin/env bash
+#!/bin/sh
 # Copyright 2009 The Go Authors. All rights reserved.
 # Use of this source code is governed by a BSD-style
 # license that can be found in the LICENSE file.
@@ -82,7 +82,7 @@
 # so loop through the possible selinux mount points.
 for se_mount in /selinux /sys/fs/selinux
 do
-	if [ -d $se_mount -a -f $se_mount/booleans/allow_execstack -a -x /usr/sbin/selinuxenabled ] && /usr/sbin/selinuxenabled; then
+	if [ -d $se_mount ] && [ -f $se_mount/booleans/allow_execstack ] [ -x /usr/sbin/selinuxenabled ] && /usr/sbin/selinuxenabled; then
 		if ! cat $se_mount/booleans/allow_execstack | grep -c '^1 1$' >> /dev/null ; then
 			echo "WARNING: the default SELinux policy on, at least, Fedora 12 breaks "
 			echo "Go. You can enable the features that Go needs via the following "
@@ -102,7 +102,7 @@
 # Test for debian/kFreeBSD.
 # cmd/dist will detect kFreeBSD as freebsd/$GOARCH, but we need to
 # disable cgo manually.
-if [ "$(uname -s)" == "GNU/kFreeBSD" ]; then
+if [ "$(uname -s)" = "GNU/kFreeBSD" ]; then
         export CGO_ENABLED=0
 fi
 
@@ -122,12 +122,12 @@
 386) mflag=-m32;;
 amd64) mflag=-m64;;
 esac
-if [ "$(uname)" == "Darwin" ]; then
+if [ "$(uname)" = "Darwin" ]; then
 	# golang.org/issue/5261
 	mflag="$mflag -mmacosx-version-min=10.6"
 fi
 # if gcc does not exist and $CC is not set, try clang if available.
-if [ -z "$CC" -a -z "$(type -t gcc)" -a -n "$(type -t clang)" ]; then
+if [ -z "$CC" ] && ! command -v gcc >/dev/null && command -v clang; then
 	export CC=clang CXX=clang++
 fi
 ${CC:-gcc} $mflag -O2 -Wall -Werror -o cmd/dist/dist -Icmd/dist "$DEFGOROOT" cmd/dist/*.c
@@ -162,7 +162,7 @@
 "$GOTOOLDIR"/go_bootstrap clean -i std
 echo
 
-if [ "$GOHOSTARCH" != "$GOARCH" -o "$GOHOSTOS" != "$GOOS" ]; then
+if [ "$GOHOSTARCH" != "$GOARCH" ] || [ "$GOHOSTOS" != "$GOOS" ]; then
 	echo "# Building packages and commands for host, $GOHOSTOS/$GOHOSTARCH."
 	# CC_FOR_TARGET is recorded as the default compiler for the go tool. When building for the host, however,
 	# use the host compiler, CC, from `cmd/dist/dist env` instead.