Skip to content

Commit

Permalink
chowns are non-fatal
Browse files Browse the repository at this point in the history
There may be cases where specific files are readonly,
like .my-healthcheck.cnf due to filesystem mounts.

So lets make the ownership/permission changes optional.

Closes: MariaDB#573
  • Loading branch information
grooverdan committed Jun 21, 2024
1 parent fb46c56 commit 98ddea9
Show file tree
Hide file tree
Showing 14 changed files with 42 additions and 42 deletions.
6 changes: 3 additions & 3 deletions 10.11-ubi/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -204,9 +204,9 @@ docker_create_db_directories() {

if [ "$user" = "0" ]; then
# this will cause less disk access than `chown -R`
find "$DATADIR" \! -user mysql -exec chown mysql: '{}' +
find "$DATADIR" \! -user mysql \( -exec chown mysql: '{}' + -o -printf "couldn't chown %p\n" -o -true \)
# See https://github.com/MariaDB/mariadb-docker/issues/363
find "${SOCKET%/*}" -maxdepth 0 \! -user mysql -exec chown mysql: '{}' \;
find "${SOCKET%/*}" -maxdepth 0 \! -user mysql \( -exec chown mysql: '{}' \; -o -printf "couldn't chown %p\n" -o -true \)

# memory.pressure
local cgroup; cgroup=$(</proc/self/cgroup)
Expand Down Expand Up @@ -526,7 +526,7 @@ docker_mariadb_init()
rm -rf "$DATADIR"/.init "$DATADIR"/.restore
if [ "$(id -u)" = "0" ]; then
# this will cause less disk access than `chown -R`
find "$DATADIR" \! -user mysql -exec chown mysql: '{}' +
find "$DATADIR" \! -user mysql \( -exec chown mysql: '{}' + -o -printf "couldn't chown %p\n" -o -true \)
fi
done
if _check_if_upgrade_is_needed; then
Expand Down
6 changes: 3 additions & 3 deletions 10.11/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -204,9 +204,9 @@ docker_create_db_directories() {

if [ "$user" = "0" ]; then
# this will cause less disk access than `chown -R`
find "$DATADIR" \! -user mysql -exec chown mysql: '{}' +
find "$DATADIR" \! -user mysql \( -exec chown mysql: '{}' + -o -printf "couldn't chown %p\n" -o -true \)
# See https://github.com/MariaDB/mariadb-docker/issues/363
find "${SOCKET%/*}" -maxdepth 0 \! -user mysql -exec chown mysql: '{}' \;
find "${SOCKET%/*}" -maxdepth 0 \! -user mysql \( -exec chown mysql: '{}' \; -o -printf "couldn't chown %p\n" -o -true \)

# memory.pressure
local cgroup; cgroup=$(</proc/self/cgroup)
Expand Down Expand Up @@ -526,7 +526,7 @@ docker_mariadb_init()
rm -rf "$DATADIR"/.init "$DATADIR"/.restore
if [ "$(id -u)" = "0" ]; then
# this will cause less disk access than `chown -R`
find "$DATADIR" \! -user mysql -exec chown mysql: '{}' +
find "$DATADIR" \! -user mysql \( -exec chown mysql: '{}' + -o -printf "couldn't chown %p\n" -o -true \)
fi
done
if _check_if_upgrade_is_needed; then
Expand Down
6 changes: 3 additions & 3 deletions 10.5/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -204,9 +204,9 @@ docker_create_db_directories() {

if [ "$user" = "0" ]; then
# this will cause less disk access than `chown -R`
find "$DATADIR" \! -user mysql -exec chown mysql: '{}' +
find "$DATADIR" \! -user mysql \( -exec chown mysql: '{}' + -o -printf "couldn't chown %p\n" -o -true \)
# See https://github.com/MariaDB/mariadb-docker/issues/363
find "${SOCKET%/*}" -maxdepth 0 \! -user mysql -exec chown mysql: '{}' \;
find "${SOCKET%/*}" -maxdepth 0 \! -user mysql \( -exec chown mysql: '{}' \; -o -printf "couldn't chown %p\n" -o -true \)

fi
}
Expand Down Expand Up @@ -517,7 +517,7 @@ docker_mariadb_init()
rm -rf "$DATADIR"/.init "$DATADIR"/.restore
if [ "$(id -u)" = "0" ]; then
# this will cause less disk access than `chown -R`
find "$DATADIR" \! -user mysql -exec chown mysql: '{}' +
find "$DATADIR" \! -user mysql \( -exec chown mysql: '{}' + -o -printf "couldn't chown %p\n" -o -true \)
fi
done
if _check_if_upgrade_is_needed; then
Expand Down
6 changes: 3 additions & 3 deletions 10.6-ubi/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -204,9 +204,9 @@ docker_create_db_directories() {

if [ "$user" = "0" ]; then
# this will cause less disk access than `chown -R`
find "$DATADIR" \! -user mysql -exec chown mysql: '{}' +
find "$DATADIR" \! -user mysql \( -exec chown mysql: '{}' + -o -printf "couldn't chown %p\n" -o -true \)
# See https://github.com/MariaDB/mariadb-docker/issues/363
find "${SOCKET%/*}" -maxdepth 0 \! -user mysql -exec chown mysql: '{}' \;
find "${SOCKET%/*}" -maxdepth 0 \! -user mysql \( -exec chown mysql: '{}' \; -o -printf "couldn't chown %p\n" -o -true \)

fi
}
Expand Down Expand Up @@ -518,7 +518,7 @@ docker_mariadb_init()
rm -rf "$DATADIR"/.init "$DATADIR"/.restore
if [ "$(id -u)" = "0" ]; then
# this will cause less disk access than `chown -R`
find "$DATADIR" \! -user mysql -exec chown mysql: '{}' +
find "$DATADIR" \! -user mysql \( -exec chown mysql: '{}' + -o -printf "couldn't chown %p\n" -o -true \)
fi
done
if _check_if_upgrade_is_needed; then
Expand Down
6 changes: 3 additions & 3 deletions 10.6/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -204,9 +204,9 @@ docker_create_db_directories() {

if [ "$user" = "0" ]; then
# this will cause less disk access than `chown -R`
find "$DATADIR" \! -user mysql -exec chown mysql: '{}' +
find "$DATADIR" \! -user mysql \( -exec chown mysql: '{}' + -o -printf "couldn't chown %p\n" -o -true \)
# See https://github.com/MariaDB/mariadb-docker/issues/363
find "${SOCKET%/*}" -maxdepth 0 \! -user mysql -exec chown mysql: '{}' \;
find "${SOCKET%/*}" -maxdepth 0 \! -user mysql \( -exec chown mysql: '{}' \; -o -printf "couldn't chown %p\n" -o -true \)

fi
}
Expand Down Expand Up @@ -518,7 +518,7 @@ docker_mariadb_init()
rm -rf "$DATADIR"/.init "$DATADIR"/.restore
if [ "$(id -u)" = "0" ]; then
# this will cause less disk access than `chown -R`
find "$DATADIR" \! -user mysql -exec chown mysql: '{}' +
find "$DATADIR" \! -user mysql \( -exec chown mysql: '{}' + -o -printf "couldn't chown %p\n" -o -true \)
fi
done
if _check_if_upgrade_is_needed; then
Expand Down
6 changes: 3 additions & 3 deletions 11.1/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -204,9 +204,9 @@ docker_create_db_directories() {

if [ "$user" = "0" ]; then
# this will cause less disk access than `chown -R`
find "$DATADIR" \! -user mysql -exec chown mysql: '{}' +
find "$DATADIR" \! -user mysql \( -exec chown mysql: '{}' + -o -printf "couldn't chown %p\n" -o -true \)
# See https://github.com/MariaDB/mariadb-docker/issues/363
find "${SOCKET%/*}" -maxdepth 0 \! -user mysql -exec chown mysql: '{}' \;
find "${SOCKET%/*}" -maxdepth 0 \! -user mysql \( -exec chown mysql: '{}' \; -o -printf "couldn't chown %p\n" -o -true \)

# memory.pressure
local cgroup; cgroup=$(</proc/self/cgroup)
Expand Down Expand Up @@ -526,7 +526,7 @@ docker_mariadb_init()
rm -rf "$DATADIR"/.init "$DATADIR"/.restore
if [ "$(id -u)" = "0" ]; then
# this will cause less disk access than `chown -R`
find "$DATADIR" \! -user mysql -exec chown mysql: '{}' +
find "$DATADIR" \! -user mysql \( -exec chown mysql: '{}' + -o -printf "couldn't chown %p\n" -o -true \)
fi
done
if _check_if_upgrade_is_needed; then
Expand Down
6 changes: 3 additions & 3 deletions 11.2/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -204,9 +204,9 @@ docker_create_db_directories() {

if [ "$user" = "0" ]; then
# this will cause less disk access than `chown -R`
find "$DATADIR" \! -user mysql -exec chown mysql: '{}' +
find "$DATADIR" \! -user mysql \( -exec chown mysql: '{}' + -o -printf "couldn't chown %p\n" -o -true \)
# See https://github.com/MariaDB/mariadb-docker/issues/363
find "${SOCKET%/*}" -maxdepth 0 \! -user mysql -exec chown mysql: '{}' \;
find "${SOCKET%/*}" -maxdepth 0 \! -user mysql \( -exec chown mysql: '{}' \; -o -printf "couldn't chown %p\n" -o -true \)

# memory.pressure
local cgroup; cgroup=$(</proc/self/cgroup)
Expand Down Expand Up @@ -526,7 +526,7 @@ docker_mariadb_init()
rm -rf "$DATADIR"/.init "$DATADIR"/.restore
if [ "$(id -u)" = "0" ]; then
# this will cause less disk access than `chown -R`
find "$DATADIR" \! -user mysql -exec chown mysql: '{}' +
find "$DATADIR" \! -user mysql \( -exec chown mysql: '{}' + -o -printf "couldn't chown %p\n" -o -true \)
fi
done
if _check_if_upgrade_is_needed; then
Expand Down
6 changes: 3 additions & 3 deletions 11.4-ubi/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,9 @@ docker_create_db_directories() {

if [ "$user" = "0" ]; then
# this will cause less disk access than `chown -R`
find "$DATADIR" \! -user mysql -exec chown mysql: '{}' +
find "$DATADIR" \! -user mysql \( -exec chown mysql: '{}' + -o -printf "couldn't chown %p\n" -o -true \)
# See https://github.com/MariaDB/mariadb-docker/issues/363
find "${SOCKET%/*}" -maxdepth 0 \! -user mysql -exec chown mysql: '{}' \;
find "${SOCKET%/*}" -maxdepth 0 \! -user mysql \( -exec chown mysql: '{}' \; -o -printf "couldn't chown %p\n" -o -true \)

# memory.pressure
local cgroup; cgroup=$(</proc/self/cgroup)
Expand Down Expand Up @@ -528,7 +528,7 @@ docker_mariadb_init()
rm -rf "$DATADIR"/.init "$DATADIR"/.restore
if [ "$(id -u)" = "0" ]; then
# this will cause less disk access than `chown -R`
find "$DATADIR" \! -user mysql -exec chown mysql: '{}' +
find "$DATADIR" \! -user mysql \( -exec chown mysql: '{}' + -o -printf "couldn't chown %p\n" -o -true \)
fi
done
if _check_if_upgrade_is_needed; then
Expand Down
6 changes: 3 additions & 3 deletions 11.4/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,9 @@ docker_create_db_directories() {

if [ "$user" = "0" ]; then
# this will cause less disk access than `chown -R`
find "$DATADIR" \! -user mysql -exec chown mysql: '{}' +
find "$DATADIR" \! -user mysql \( -exec chown mysql: '{}' + -o -printf "couldn't chown %p\n" -o -true \)
# See https://github.com/MariaDB/mariadb-docker/issues/363
find "${SOCKET%/*}" -maxdepth 0 \! -user mysql -exec chown mysql: '{}' \;
find "${SOCKET%/*}" -maxdepth 0 \! -user mysql \( -exec chown mysql: '{}' \; -o -printf "couldn't chown %p\n" -o -true \)

# memory.pressure
local cgroup; cgroup=$(</proc/self/cgroup)
Expand Down Expand Up @@ -528,7 +528,7 @@ docker_mariadb_init()
rm -rf "$DATADIR"/.init "$DATADIR"/.restore
if [ "$(id -u)" = "0" ]; then
# this will cause less disk access than `chown -R`
find "$DATADIR" \! -user mysql -exec chown mysql: '{}' +
find "$DATADIR" \! -user mysql \( -exec chown mysql: '{}' + -o -printf "couldn't chown %p\n" -o -true \)
fi
done
if _check_if_upgrade_is_needed; then
Expand Down
6 changes: 3 additions & 3 deletions 11.5-ubi/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,9 @@ docker_create_db_directories() {

if [ "$user" = "0" ]; then
# this will cause less disk access than `chown -R`
find "$DATADIR" \! -user mysql -exec chown mysql: '{}' +
find "$DATADIR" \! -user mysql \( -exec chown mysql: '{}' + -o -printf "couldn't chown %p\n" -o -true \)
# See https://github.com/MariaDB/mariadb-docker/issues/363
find "${SOCKET%/*}" -maxdepth 0 \! -user mysql -exec chown mysql: '{}' \;
find "${SOCKET%/*}" -maxdepth 0 \! -user mysql \( -exec chown mysql: '{}' \; -o -printf "couldn't chown %p\n" -o -true \)

# memory.pressure
local cgroup; cgroup=$(</proc/self/cgroup)
Expand Down Expand Up @@ -528,7 +528,7 @@ docker_mariadb_init()
rm -rf "$DATADIR"/.init "$DATADIR"/.restore
if [ "$(id -u)" = "0" ]; then
# this will cause less disk access than `chown -R`
find "$DATADIR" \! -user mysql -exec chown mysql: '{}' +
find "$DATADIR" \! -user mysql \( -exec chown mysql: '{}' + -o -printf "couldn't chown %p\n" -o -true \)
fi
done
if _check_if_upgrade_is_needed; then
Expand Down
6 changes: 3 additions & 3 deletions 11.5/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,9 @@ docker_create_db_directories() {

if [ "$user" = "0" ]; then
# this will cause less disk access than `chown -R`
find "$DATADIR" \! -user mysql -exec chown mysql: '{}' +
find "$DATADIR" \! -user mysql \( -exec chown mysql: '{}' + -o -printf "couldn't chown %p\n" -o -true \)
# See https://github.com/MariaDB/mariadb-docker/issues/363
find "${SOCKET%/*}" -maxdepth 0 \! -user mysql -exec chown mysql: '{}' \;
find "${SOCKET%/*}" -maxdepth 0 \! -user mysql \( -exec chown mysql: '{}' \; -o -printf "couldn't chown %p\n" -o -true \)

# memory.pressure
local cgroup; cgroup=$(</proc/self/cgroup)
Expand Down Expand Up @@ -528,7 +528,7 @@ docker_mariadb_init()
rm -rf "$DATADIR"/.init "$DATADIR"/.restore
if [ "$(id -u)" = "0" ]; then
# this will cause less disk access than `chown -R`
find "$DATADIR" \! -user mysql -exec chown mysql: '{}' +
find "$DATADIR" \! -user mysql \( -exec chown mysql: '{}' + -o -printf "couldn't chown %p\n" -o -true \)
fi
done
if _check_if_upgrade_is_needed; then
Expand Down
6 changes: 3 additions & 3 deletions 11.6-ubi/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,9 @@ docker_create_db_directories() {

if [ "$user" = "0" ]; then
# this will cause less disk access than `chown -R`
find "$DATADIR" \! -user mysql -exec chown mysql: '{}' +
find "$DATADIR" \! -user mysql \( -exec chown mysql: '{}' + -o -printf "couldn't chown %p\n" -o -true \)
# See https://github.com/MariaDB/mariadb-docker/issues/363
find "${SOCKET%/*}" -maxdepth 0 \! -user mysql -exec chown mysql: '{}' \;
find "${SOCKET%/*}" -maxdepth 0 \! -user mysql \( -exec chown mysql: '{}' \; -o -printf "couldn't chown %p\n" -o -true \)

# memory.pressure
local cgroup; cgroup=$(</proc/self/cgroup)
Expand Down Expand Up @@ -528,7 +528,7 @@ docker_mariadb_init()
rm -rf "$DATADIR"/.init "$DATADIR"/.restore
if [ "$(id -u)" = "0" ]; then
# this will cause less disk access than `chown -R`
find "$DATADIR" \! -user mysql -exec chown mysql: '{}' +
find "$DATADIR" \! -user mysql \( -exec chown mysql: '{}' + -o -printf "couldn't chown %p\n" -o -true \)
fi
done
if _check_if_upgrade_is_needed; then
Expand Down
6 changes: 3 additions & 3 deletions 11.6/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,9 @@ docker_create_db_directories() {

if [ "$user" = "0" ]; then
# this will cause less disk access than `chown -R`
find "$DATADIR" \! -user mysql -exec chown mysql: '{}' +
find "$DATADIR" \! -user mysql \( -exec chown mysql: '{}' + -o -printf "couldn't chown %p\n" -o -true \)
# See https://github.com/MariaDB/mariadb-docker/issues/363
find "${SOCKET%/*}" -maxdepth 0 \! -user mysql -exec chown mysql: '{}' \;
find "${SOCKET%/*}" -maxdepth 0 \! -user mysql \( -exec chown mysql: '{}' \; -o -printf "couldn't chown %p\n" -o -true \)

# memory.pressure
local cgroup; cgroup=$(</proc/self/cgroup)
Expand Down Expand Up @@ -528,7 +528,7 @@ docker_mariadb_init()
rm -rf "$DATADIR"/.init "$DATADIR"/.restore
if [ "$(id -u)" = "0" ]; then
# this will cause less disk access than `chown -R`
find "$DATADIR" \! -user mysql -exec chown mysql: '{}' +
find "$DATADIR" \! -user mysql \( -exec chown mysql: '{}' + -o -printf "couldn't chown %p\n" -o -true \)
fi
done
if _check_if_upgrade_is_needed; then
Expand Down
6 changes: 3 additions & 3 deletions docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,9 @@ docker_create_db_directories() {

if [ "$user" = "0" ]; then
# this will cause less disk access than `chown -R`
find "$DATADIR" \! -user mysql -exec chown mysql: '{}' +
find "$DATADIR" \! -user mysql \( -exec chown mysql: '{}' + -o -printf "couldn't chown %p\n" -o -true \)
# See https://github.com/MariaDB/mariadb-docker/issues/363
find "${SOCKET%/*}" -maxdepth 0 \! -user mysql -exec chown mysql: '{}' \;
find "${SOCKET%/*}" -maxdepth 0 \! -user mysql \( -exec chown mysql: '{}' \; -o -printf "couldn't chown %p\n" -o -true \)

# memory.pressure
local cgroup; cgroup=$(</proc/self/cgroup)
Expand Down Expand Up @@ -528,7 +528,7 @@ docker_mariadb_init()
rm -rf "$DATADIR"/.init "$DATADIR"/.restore
if [ "$(id -u)" = "0" ]; then
# this will cause less disk access than `chown -R`
find "$DATADIR" \! -user mysql -exec chown mysql: '{}' +
find "$DATADIR" \! -user mysql \( -exec chown mysql: '{}' + -o -printf "couldn't chown %p\n" -o -true \)
fi
done
if _check_if_upgrade_is_needed; then
Expand Down

0 comments on commit 98ddea9

Please sign in to comment.