github.com/muhammadn/cortex@v1.9.1-0.20220510110439-46bb7000d03d/packaging/fpm/package.sh (about) 1 #!/bin/sh 2 3 set -eu 4 5 SRC_PATH=/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 -c "%u" $SRC_PATH) 12 gid=$(stat -c "%g" $SRC_PATH) 13 echo "cortex:x:$uid:$gid::$SRC_PATH:/bin/sh" >>/etc/passwd 14 echo "cortex:*:::::::" >>/etc/shadow 15 echo "cortex ALL=(ALL) NOPASSWD: ALL" >>/etc/sudoers 16 17 su cortex -c "PATH=$PATH make -C $SRC_PATH PACKAGE_IN_CONTAINER=false $*"