-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1743 from mjudeikis/osa.test.add.entrypoint
add mount files for non priv run
- Loading branch information
Showing
3 changed files
with
45 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
projects/azure/base-images/test-base/root/usr/local/bin/entrypoint
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/bin/bash -e | ||
# | ||
# This file serves as the main entrypoint to the azure image. | ||
# | ||
# For more information see the documentation in openshift-ansible | ||
# https://github.com/openshift/openshift-ansible/blob/master/README_CONTAINER_IMAGE.md | ||
|
||
|
||
# Patch /etc/passwd file with the current user info. | ||
# The current user's entry must be correctly defined in this file in order for | ||
# the `ssh` command to work within the created container. | ||
|
||
if ! whoami &>/dev/null; then | ||
echo "${USER:-default}:x:$(id -u):$(id -g):Default User:$HOME:/sbin/nologin" >> /etc/passwd | ||
fi | ||
|
||
exec "$@" |
19 changes: 19 additions & 0 deletions
19
projects/azure/base-images/test-base/root/usr/local/bin/user_setup
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/bin/sh | ||
set -x | ||
|
||
# ensure $HOME exists and is accessible by group 0 (we don't know what the runtime UID will be) | ||
mkdir -p ${HOME} | ||
chown ${USER_UID}:0 ${HOME} | ||
chmod ug+rwx ${HOME} | ||
|
||
# runtime user will need to be able to self-insert in /etc/passwd | ||
chmod g+rw /etc/passwd | ||
|
||
# ensure that the image content is accessible | ||
chmod -R g+r ${WORK_DIR} | ||
find ${WORK_DIR} -type d -exec chmod g+x {} + | ||
# ensure that the dynamic inventory dir can have content created | ||
find ${WORK_DIR} -type d -exec chmod g+wx {} + | ||
|
||
# no need for this script to remain in the image after running | ||
rm $0 |