Skip to content

Commit d17c41f

Browse files
committed
chown only when needed
1 parent 5d2d409 commit d17c41f

File tree

1 file changed

+5
-5
lines changed
  • root/etc/s6-overlay/s6-rc.d/init-setup-app

1 file changed

+5
-5
lines changed

root/etc/s6-overlay/s6-rc.d/init-setup-app/run

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@ ENVIRONMENT APP
1313

1414
echo "Applying permissions to /cache"
1515
chmod "=rwx" "/cache"
16-
chown hotio:hotio "/cache"
16+
find "/cache" -maxdepth 0 \( ! -user hotio -or ! -group hotio \) -exec chown hotio:hotio {} +
1717

1818
echo "Applying permissions to /logs"
1919
chmod "=rwx" "/logs"
20-
chown hotio:hotio "/logs"
20+
find "/logs" -maxdepth 0 \( ! -user hotio -or ! -group hotio \) -exec chown hotio:hotio {} +
2121

2222
if [[ ! -f "${CONFIG_DIR}/machine-id" ]]; then
2323
tr -dc 'a-f0-9' < /dev/urandom | fold -w 32 | head -n 1 > "${CONFIG_DIR}/machine-id"
24-
chown hotio:hotio "${CONFIG_DIR}/machine-id"
24+
find "${CONFIG_DIR}/machine-id" -maxdepth 0 \( ! -user hotio -or ! -group hotio \) -exec chown hotio:hotio {} +
2525
fi
2626

2727
if [[ ! -f "${CONFIG_DIR}/settings.json" ]]; then
@@ -30,10 +30,10 @@ if [[ ! -f "${CONFIG_DIR}/settings.json" ]]; then
3030
"log_directory" : "/logs",
3131
"temporary_directory" : "/cache"
3232
}' > "${CONFIG_DIR}/settings.json"
33-
chown hotio:hotio "${CONFIG_DIR}/settings.json"
33+
find "${CONFIG_DIR}/settings.json" -maxdepth 0 \( ! -user hotio -or ! -group hotio \) -exec chown hotio:hotio {} +
3434
fi
3535

3636
if [[ ! -f "${CONFIG_DIR}/duplicacy.json" ]]; then
3737
echo '{}' > "${CONFIG_DIR}/duplicacy.json"
38-
chown hotio:hotio "${CONFIG_DIR}/duplicacy.json"
38+
find "${CONFIG_DIR}/duplicacy.json" -maxdepth 0 \( ! -user hotio -or ! -group hotio \) -exec chown hotio:hotio {} +
3939
fi

0 commit comments

Comments
 (0)