Skip to content
This repository was archived by the owner on Aug 5, 2024. It is now read-only.

Commit 9496464

Browse files
Added root/sudo check in build script (#156)
* Added root/sudo check in build script * Resource Plan ID wasn't being written to the config file (#157) * fixed the script so it writes the inputted plan id to the script, also hardcoded the resource plan id to be entry instead of lite in anticipation of THINK 21 * removing the debugging lines added * added a little more info on the different resource plan id choices * fixed a mis-spelling of provision, its been bothering me * added some more verbage to the fail on running as root Co-authored-by: Gregory Boland <boland@us.ibm.com>
1 parent 28cb8a1 commit 9496464

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

BuildDockerImage.sh

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,17 @@ get_Boost(){
132132
#rm boost-$1.tar.gz
133133
}
134134

135-
135+
# Check to see if the user is running the script as root/with sudo.
136+
# We need the script to be running as non-sudo because we map volumes from the host machine into the
137+
# container for data persistence, and we need a non-root id on the host side so we can map the permissions
138+
# properly across the container and host as needed
139+
#
140+
if [ $EUID -eq 0 ]; then
141+
echo " "
142+
echo "FATAL: Aborting. Sorry but we need to run this script as a non-root user without sudo so we can properly map ids in the container. Please re-run without sudo."
143+
echo " "
144+
exit -1
145+
fi
136146

137147
# First we determine which architecture we are running on... AMD64 or s390x
138148
ARCH=`uname -m`

0 commit comments

Comments
 (0)