only chown when ownership change or new install detected

This commit is contained in:
aptalca
2024-10-13 13:32:44 -04:00
parent 42aae8bde4
commit fcf9fcbb7f
3 changed files with 12 additions and 12 deletions

View File

@@ -26,14 +26,14 @@ if [[ ! -f /config/.profile ]]; then
cp /root/.profile /config/.profile
fi
# fix permissions (ignore contents of workspace and cache folders)
find /config \
-path "/config/workspace" -prune -o \
-path "/config/.npm" -prune -o \
-path "/config/.rustup" -prune -o \
-path "/config/.cargo" -prune -o \
-exec lsiown abc:abc {} +
lsiown abc:abc /config/workspace
# fix permissions (ignore contents of workspace)
PUID=${PUID:-911}
if [[ ! "$(stat -c %u /config/.profile)" == "${PUID}" ]]; then
echo "Change in ownership or new install detected, please be patient while we chown existing files"
echo "This could take some time"
find /config -path "/config/workspace" -prune -o -exec lsiown abc:abc {} +
lsiown abc:abc /config/workspace
fi
chmod 700 /config/.ssh
if [[ -n "$(ls -A /config/.ssh)" ]]; then
find /config/.ssh/ -type d -exec chmod 700 '{}' \;