Skip to content

Commit 90c5070

Browse files
bpowersrsc
authored andcommitted
build: fix check for selinux's allow_execstack on Fedora 16
Fedora 16 mounts selinux at /sys/fs/selinux, instead of the traditional /selinux. Check both locations for the selinux filesystem in make.bash Fixes #2448. R=golang-dev, rsc CC=golang-dev https://golang.org/cl/5373077
1 parent 6d9c02a commit 90c5070

File tree

1 file changed

+18
-13
lines changed

1 file changed

+18
-13
lines changed

src/make.bash

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -50,21 +50,26 @@ chmod +x "$GOBIN"/gomake
5050
# TODO(brainman): delete this after 01/01/2012.
5151
rm -f "$GOBIN"/gotest # remove old bash version of gotest on Windows
5252

53-
if [ -d /selinux -a -f /selinux/booleans/allow_execstack -a -x /usr/sbin/selinuxenabled ] && /usr/sbin/selinuxenabled; then
54-
if ! cat /selinux/booleans/allow_execstack | grep -c '^1 1$' >> /dev/null ; then
55-
echo "WARNING: the default SELinux policy on, at least, Fedora 12 breaks "
56-
echo "Go. You can enable the features that Go needs via the following "
57-
echo "command (as root):"
58-
echo " # setsebool -P allow_execstack 1"
59-
echo
60-
echo "Note that this affects your system globally! "
61-
echo
62-
echo "The build will continue in five seconds in case we "
63-
echo "misdiagnosed the issue..."
53+
# on Fedora 16 the selinux filesystem is mounted at /sys/fs/selinux,
54+
# so loop through the possible selinux mount points
55+
for se_mount in /selinux /sys/fs/selinux
56+
do
57+
if [ -d $se_mount -a -f $se_mount/booleans/allow_execstack -a -x /usr/sbin/selinuxenabled ] && /usr/sbin/selinuxenabled; then
58+
if ! cat $se_mount/booleans/allow_execstack | grep -c '^1 1$' >> /dev/null ; then
59+
echo "WARNING: the default SELinux policy on, at least, Fedora 12 breaks "
60+
echo "Go. You can enable the features that Go needs via the following "
61+
echo "command (as root):"
62+
echo " # setsebool -P allow_execstack 1"
63+
echo
64+
echo "Note that this affects your system globally! "
65+
echo
66+
echo "The build will continue in five seconds in case we "
67+
echo "misdiagnosed the issue..."
6468

65-
sleep 5
69+
sleep 5
70+
fi
6671
fi
67-
fi
72+
done
6873

6974
(
7075
cd "$GOROOT"/src/pkg;

0 commit comments

Comments
 (0)