github.com/muhammadn/cortex@v1.9.1-0.20220510110439-46bb7000d03d/build-image/build.sh (about) 1 #!/bin/sh 2 3 set -eu 4 5 SRC_PATH=$GOPATH/src/github.com/cortexproject/cortex 6 7 # If we run make directly, any files created on the bind mount 8 # will have awkward ownership. So we switch to a user with the 9 # same user and group IDs as source directory. We have to set a 10 # few things up so that sudo works without complaining later on. 11 uid=$(stat --format="%u" $SRC_PATH) 12 gid=$(stat --format="%g" $SRC_PATH) 13 echo "weave:x:$uid:$gid::$SRC_PATH:/bin/sh" >>/etc/passwd 14 echo "weave:*:::::::" >>/etc/shadow 15 echo "weave ALL=(ALL) NOPASSWD: ALL" >>/etc/sudoers 16 17 su weave -c "PATH=$PATH make -C $SRC_PATH BUILD_IN_CONTAINER=false $*"