Fixes issues with the `build/run` tooling, notably for publishing images where `build/run make <args>` would only result in `make` being called without args. Signed-off-by: Blaine Gardner <blaine.gardner@redhat.com>
37 lines
1.3 KiB
Bash
Executable File
37 lines
1.3 KiB
Bash
Executable File
#!/bin/bash -e
|
|
set -e
|
|
set -x
|
|
|
|
# Copyright 2016 The Rook Authors. All rights reserved.
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
|
|
ARGS=( "$@" )
|
|
if [ $# -eq 0 ]; then
|
|
ARGS=( /bin/bash )
|
|
fi
|
|
|
|
BUILDER_USER=${BUILDER_USER:-rook}
|
|
BUILDER_GROUP=${BUILDER_GROUP:-rook}
|
|
BUILDER_UID=${BUILDER_UID:-1000}
|
|
BUILDER_GID=${BUILDER_GID:-1000}
|
|
|
|
groupadd -o -g "$BUILDER_GID" "$BUILDER_GROUP" 2> /dev/null
|
|
useradd -o -m -g "$BUILDER_GID" -u "$BUILDER_UID" "$BUILDER_USER" 2> /dev/null
|
|
echo "$BUILDER_USER ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
|
|
export HOME=/home/${BUILDER_USER}
|
|
echo "127.0.0.1 $(cat /etc/hostname)" >> /etc/hosts
|
|
[[ -S /var/run/docker.sock ]] && chmod 666 /var/run/docker.sock
|
|
chown -R "$BUILDER_UID":"$BUILDER_GID" "$HOME"
|
|
exec chpst -u :"$BUILDER_UID":"$BUILDER_GID" "${ARGS[@]}"
|