From 07be8e3fa1da3ce6dea18dd20ddb0ef4281d06bb Mon Sep 17 00:00:00 2001 From: Allen Herrera <82840027+mariadb-AllenHerrera@users.noreply.github.com> Date: Wed, 11 Sep 2024 04:50:41 -0700 Subject: [PATCH] feat(installation): MCOL-4886 skip chown if top folder permissions good (#3093) * MCOL-4886 skip chown if top folder permissions good * remove '-type f' check permissions of directories too --- oam/install_scripts/columnstore-post-install.in | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/oam/install_scripts/columnstore-post-install.in b/oam/install_scripts/columnstore-post-install.in index 8222c1a72..a25a2eccc 100755 --- a/oam/install_scripts/columnstore-post-install.in +++ b/oam/install_scripts/columnstore-post-install.in @@ -375,7 +375,17 @@ fi if [ $(running_systemd) -eq 0 ]; then chown -R @DEFAULT_USER@:@DEFAULT_GROUP@ @ENGINE_LOGDIR@ chown -R @DEFAULT_USER@:@DEFAULT_GROUP@ /etc/columnstore - chown -R @DEFAULT_USER@:@DEFAULT_GROUP@ @ENGINE_DATADIR@ + findcmd=`which find 2>/dev/null` + if [ -n "$findcmd" ]; then + if [[ $($findcmd @ENGINE_DATADIR@ -maxdepth 3 ! -user @DEFAULT_USER@ -exec echo {} \; -quit 2>/dev/null) ]]; then + echo "At least one file is not owned by @DEFAULT_USER@ in @ENGINE_DATADIR@. Running chown..." + chown -R @DEFAULT_USER@:@DEFAULT_GROUP@ @ENGINE_DATADIR@ + else + echo "Confirmed top @ENGINE_DATADIR@ folders owned by @DEFAULT_USER@" + fi + else + chown -R @DEFAULT_USER@:@DEFAULT_GROUP@ @ENGINE_DATADIR@ + fi chown -R @DEFAULT_USER@:@DEFAULT_GROUP@ $tmpDir chmod 777 /dev/shm fi