Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 25 additions & 6 deletions 10.0/build/root/usr/bin/fix-permissions
Original file line number Diff line number Diff line change
@@ -1,8 +1,27 @@
#!/bin/sh
# Fix permissions on the given directory to allow owner/group read/write of

# Allow this script to fail without failing a build
set +e

SYMLINK_OPT=${2:--L}

# Fix permissions on the given directory or file to allow group read/write of
# regular files and execute of directories.
# Note: Openshift uses random UIDs for running apps. Thus we need to grant
# some world-writable perms :(
chgrp -R 0 $1
chmod -R og+rw $1
find $1 -type d -exec chmod g+x {} +

[ $(id -u) -ne 0 ] && CHECK_OWNER=" -uid $(id -u)"

# If argument does not exist, script will still exit with 0,
# but at least we'll see something went wrong in the log
if ! [ -e "$1" ] ; then
echo "ERROR: File or directory $1 does not exist." >&2
# We still want to end successfully
exit 0
fi

find $SYMLINK_OPT "$1" ${CHECK_OWNER} \! -gid 0 -exec chgrp 0 {} +
find $SYMLINK_OPT "$1" ${CHECK_OWNER} \! -perm -g+rw -exec chmod g+rw {} +
find $SYMLINK_OPT "$1" ${CHECK_OWNER} -perm /u+x -a \! -perm /g+x -exec chmod g+x {} +
find $SYMLINK_OPT "$1" ${CHECK_OWNER} -type d \! -perm /g+x -exec chmod g+x {} +

# Always end successfully
exit 0
31 changes: 25 additions & 6 deletions 8.0/runtime/root/usr/bin/fix-permissions
Original file line number Diff line number Diff line change
@@ -1,8 +1,27 @@
#!/bin/sh
# Fix permissions on the given directory to allow owner/group read/write of

# Allow this script to fail without failing a build
set +e

SYMLINK_OPT=${2:--L}

# Fix permissions on the given directory or file to allow group read/write of
# regular files and execute of directories.
# Note: Openshift uses random UIDs for running apps. Thus we need to grant
# some world-writable perms :(
chgrp -R 0 $1
chmod -R og+rw $1
find $1 -type d -exec chmod g+x {} +

[ $(id -u) -ne 0 ] && CHECK_OWNER=" -uid $(id -u)"

# If argument does not exist, script will still exit with 0,
# but at least we'll see something went wrong in the log
if ! [ -e "$1" ] ; then
echo "ERROR: File or directory $1 does not exist." >&2
# We still want to end successfully
exit 0
fi

find $SYMLINK_OPT "$1" ${CHECK_OWNER} \! -gid 0 -exec chgrp 0 {} +
find $SYMLINK_OPT "$1" ${CHECK_OWNER} \! -perm -g+rw -exec chmod g+rw {} +
find $SYMLINK_OPT "$1" ${CHECK_OWNER} -perm /u+x -a \! -perm /g+x -exec chmod g+x {} +
find $SYMLINK_OPT "$1" ${CHECK_OWNER} -type d \! -perm /g+x -exec chmod g+x {} +

# Always end successfully
exit 0
2 changes: 1 addition & 1 deletion 8.0/runtime/test/run
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ test_data_folder() {
test_start

# check a writable data folder is available
assert_equal $(docker_run $IMAGE_NAME stat -c %a /opt/app-root/data) "777"
assert_equal $(docker_run $IMAGE_NAME stat -c %a /opt/app-root/data) "775"
}

test_timezones() {
Expand Down
31 changes: 25 additions & 6 deletions 9.0/runtime/root/usr/bin/fix-permissions
Original file line number Diff line number Diff line change
@@ -1,8 +1,27 @@
#!/bin/sh
# Fix permissions on the given directory to allow owner/group read/write of

# Allow this script to fail without failing a build
set +e

SYMLINK_OPT=${2:--L}

# Fix permissions on the given directory or file to allow group read/write of
# regular files and execute of directories.
# Note: Openshift uses random UIDs for running apps. Thus we need to grant
# some world-writable perms :(
chgrp -R 0 $1
chmod -R og+rw $1
find $1 -type d -exec chmod g+x {} +

[ $(id -u) -ne 0 ] && CHECK_OWNER=" -uid $(id -u)"

# If argument does not exist, script will still exit with 0,
# but at least we'll see something went wrong in the log
if ! [ -e "$1" ] ; then
echo "ERROR: File or directory $1 does not exist." >&2
# We still want to end successfully
exit 0
fi

find $SYMLINK_OPT "$1" ${CHECK_OWNER} \! -gid 0 -exec chgrp 0 {} +
find $SYMLINK_OPT "$1" ${CHECK_OWNER} \! -perm -g+rw -exec chmod g+rw {} +
find $SYMLINK_OPT "$1" ${CHECK_OWNER} -perm /u+x -a \! -perm /g+x -exec chmod g+x {} +
find $SYMLINK_OPT "$1" ${CHECK_OWNER} -type d \! -perm /g+x -exec chmod g+x {} +

# Always end successfully
exit 0
2 changes: 1 addition & 1 deletion 9.0/runtime/test/run
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ test_data_folder() {
test_start

# check a writable data folder is available
assert_equal $(docker_run $IMAGE_NAME stat -c %a /opt/app-root/data) "777"
assert_equal $(docker_run $IMAGE_NAME stat -c %a /opt/app-root/data) "775"
}

test_timezones() {
Expand Down