Skip to content

Commit

Permalink
Replace su with gosu
Browse files Browse the repository at this point in the history
  • Loading branch information
nupplaphil committed Feb 16, 2022
1 parent 34bb363 commit c996526
Show file tree
Hide file tree
Showing 10 changed files with 30 additions and 40 deletions.
7 changes: 3 additions & 4 deletions 2021.09/apache/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@ set -eu

# run an command with the www-data user
run_as() {
set -- -c "cd /var/www/html; $*"
set -- sh -c "cd /var/www/html; $*"
if [ "$(id -u)" -eq 0 ]; then
su - www-data -s /bin/sh -c "export PHP_MEMORY_LIMIT=${PHP_MEMORY_LIMIT}; export PHP_UPLOAD_LIMIT=${PHP_UPLOAD_LIMIT}; $1"
else
sh -c "$1"
set -- gosu www-data "$@"
fi
"$@"
}

# checks if the the first parameter is greater than the second parameter
Expand Down
7 changes: 3 additions & 4 deletions 2021.09/fpm-alpine/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@ set -eu

# run an command with the www-data user
run_as() {
set -- -c "cd /var/www/html; $*"
set -- sh -c "cd /var/www/html; $*"
if [ "$(id -u)" -eq 0 ]; then
su - www-data -s /bin/sh -c "export PHP_MEMORY_LIMIT=${PHP_MEMORY_LIMIT}; export PHP_UPLOAD_LIMIT=${PHP_UPLOAD_LIMIT}; $1"
else
sh -c "$1"
set -- gosu www-data "$@"
fi
"$@"
}

# checks if the the first parameter is greater than the second parameter
Expand Down
7 changes: 3 additions & 4 deletions 2021.09/fpm/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@ set -eu

# run an command with the www-data user
run_as() {
set -- -c "cd /var/www/html; $*"
set -- sh -c "cd /var/www/html; $*"
if [ "$(id -u)" -eq 0 ]; then
su - www-data -s /bin/sh -c "export PHP_MEMORY_LIMIT=${PHP_MEMORY_LIMIT}; export PHP_UPLOAD_LIMIT=${PHP_UPLOAD_LIMIT}; $1"
else
sh -c "$1"
set -- gosu www-data "$@"
fi
"$@"
}

# checks if the the first parameter is greater than the second parameter
Expand Down
7 changes: 3 additions & 4 deletions 2022.02/apache/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@ set -eu

# run an command with the www-data user
run_as() {
set -- -c "cd /var/www/html; $*"
set -- sh -c "cd /var/www/html; $*"
if [ "$(id -u)" -eq 0 ]; then
su - www-data -s /bin/sh -c "export PHP_MEMORY_LIMIT=${PHP_MEMORY_LIMIT}; export PHP_UPLOAD_LIMIT=${PHP_UPLOAD_LIMIT}; $1"
else
sh -c "$1"
set -- gosu www-data "$@"
fi
"$@"
}

# checks if the the first parameter is greater than the second parameter
Expand Down
7 changes: 3 additions & 4 deletions 2022.02/fpm-alpine/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@ set -eu

# run an command with the www-data user
run_as() {
set -- -c "cd /var/www/html; $*"
set -- sh -c "cd /var/www/html; $*"
if [ "$(id -u)" -eq 0 ]; then
su - www-data -s /bin/sh -c "export PHP_MEMORY_LIMIT=${PHP_MEMORY_LIMIT}; export PHP_UPLOAD_LIMIT=${PHP_UPLOAD_LIMIT}; $1"
else
sh -c "$1"
set -- gosu www-data "$@"
fi
"$@"
}

# checks if the the first parameter is greater than the second parameter
Expand Down
7 changes: 3 additions & 4 deletions 2022.02/fpm/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@ set -eu

# run an command with the www-data user
run_as() {
set -- -c "cd /var/www/html; $*"
set -- sh -c "cd /var/www/html; $*"
if [ "$(id -u)" -eq 0 ]; then
su - www-data -s /bin/sh -c "export PHP_MEMORY_LIMIT=${PHP_MEMORY_LIMIT}; export PHP_UPLOAD_LIMIT=${PHP_UPLOAD_LIMIT}; $1"
else
sh -c "$1"
set -- gosu www-data "$@"
fi
"$@"
}

# checks if the the first parameter is greater than the second parameter
Expand Down
7 changes: 3 additions & 4 deletions 2022.05-dev/apache/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@ set -eu

# run an command with the www-data user
run_as() {
set -- -c "cd /var/www/html; $*"
set -- sh -c "cd /var/www/html; $*"
if [ "$(id -u)" -eq 0 ]; then
su - www-data -s /bin/sh -c "export PHP_MEMORY_LIMIT=${PHP_MEMORY_LIMIT}; export PHP_UPLOAD_LIMIT=${PHP_UPLOAD_LIMIT}; $1"
else
sh -c "$1"
set -- gosu www-data "$@"
fi
"$@"
}

# checks if the the first parameter is greater than the second parameter
Expand Down
7 changes: 3 additions & 4 deletions 2022.05-dev/fpm-alpine/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@ set -eu

# run an command with the www-data user
run_as() {
set -- -c "cd /var/www/html; $*"
set -- sh -c "cd /var/www/html; $*"
if [ "$(id -u)" -eq 0 ]; then
su - www-data -s /bin/sh -c "export PHP_MEMORY_LIMIT=${PHP_MEMORY_LIMIT}; export PHP_UPLOAD_LIMIT=${PHP_UPLOAD_LIMIT}; $1"
else
sh -c "$1"
set -- gosu www-data "$@"
fi
"$@"
}

# checks if the the first parameter is greater than the second parameter
Expand Down
7 changes: 3 additions & 4 deletions 2022.05-dev/fpm/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@ set -eu

# run an command with the www-data user
run_as() {
set -- -c "cd /var/www/html; $*"
set -- sh -c "cd /var/www/html; $*"
if [ "$(id -u)" -eq 0 ]; then
su - www-data -s /bin/sh -c "export PHP_MEMORY_LIMIT=${PHP_MEMORY_LIMIT}; export PHP_UPLOAD_LIMIT=${PHP_UPLOAD_LIMIT}; $1"
else
sh -c "$1"
set -- gosu www-data "$@"
fi
"$@"
}

# checks if the the first parameter is greater than the second parameter
Expand Down
7 changes: 3 additions & 4 deletions docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@ set -eu

# run an command with the www-data user
run_as() {
set -- -c "cd /var/www/html; $*"
set -- sh -c "cd /var/www/html; $*"
if [ "$(id -u)" -eq 0 ]; then
su - www-data -s /bin/sh -c "export PHP_MEMORY_LIMIT=${PHP_MEMORY_LIMIT}; export PHP_UPLOAD_LIMIT=${PHP_UPLOAD_LIMIT}; $1"
else
sh -c "$1"
set -- gosu www-data "$@"
fi
"$@"
}

# checks if the the first parameter is greater than the second parameter
Expand Down

0 comments on commit c996526

Please sign in to comment.