mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2024-08-30 18:23:09 +00:00
Fix xargs, and increase log verbosity
xargs would fail when no files were found, -r resolves this by continuing. moved repair to function to reduce duplicated code
This commit is contained in:
parent
f39c9c5a28
commit
706c30775a
@ -1,5 +1,14 @@
|
||||
#!/bin/sh
|
||||
|
||||
repair_permissions () {
|
||||
echo -e "\033[36mWrapper | \033[35m📋 (1/3) Ensuring root group ownership..."
|
||||
find . ! -group root -print0 | xargs -0 -r chgrp root
|
||||
echo -e "\033[36mWrapper | \033[35m📋 (2/3) Ensuring group read-write is present on files..."
|
||||
find . ! -perm g+rw -print0 | xargs -0 -r chmod g+rw
|
||||
echo -e "\033[36mWrapper | \033[35m📋 (3/3) Ensuring sticky bit is present on directories..."
|
||||
find . -type d ! -perm g+s -print0 | xargs -0 -r chmod g+s
|
||||
}
|
||||
|
||||
# Check if config exists taking one from image if needed.
|
||||
if [ ! "$(ls -A --ignore=.gitkeep ./app/config)" ]; then
|
||||
echo -e "\033[36mWrapper | \033[33m🏗️ Config not found, pulling defaults..."
|
||||
@ -12,9 +21,9 @@ if [ ! "$(ls -A --ignore=.gitkeep ./app/config)" ]; then
|
||||
# This will do the full /crafty dir, so will take a miniute.
|
||||
echo -e "\033[36mWrapper | \033[35m📋 Looking for problem bind mount permissions globally..."
|
||||
|
||||
find . ! -group root -print0 | xargs -0 chgrp root
|
||||
find . ! -perm g+rw -print0 | xargs -0 chmod g+rw
|
||||
find . -type d ! -perm g+s -print0 | xargs -0 chmod g+s
|
||||
repair_permissions
|
||||
|
||||
echo -e "\033[36mWrapper | \033[32m✅ Initialization complete!"
|
||||
fi
|
||||
else
|
||||
# Keep version file up to date with image
|
||||
@ -31,9 +40,7 @@ if [ $(id -u) -eq 0 ]; then
|
||||
echo -e "\033[36mWrapper | \033[35m📋 Files present in import directory, checking/fixing permissions..."
|
||||
echo -e "\033[36mWrapper | \033[33m⏳ Please be patient for larger servers..."
|
||||
|
||||
find . ! -group root -print0 | xargs -0 chgrp root
|
||||
find . ! -perm g+rw -print0 | xargs -0 chmod g+rw
|
||||
find . -type d ! -perm g+s -print0 | xargs -0 chmod g+s
|
||||
repair_permissions
|
||||
|
||||
echo -e "\033[36mWrapper | \033[32m✅ Permissions Fixed! (This will happen every boot until /import is empty!)"
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user