Skip to content

Commit 44f7b9f

Browse files
authored
Merge pull request #73 from gjrtimmer/fix/chown
fix apply chown permissions in parallel for large workspace
2 parents e95b42b + 442dac7 commit 44f7b9f

File tree

3 files changed

+19
-2
lines changed

3 files changed

+19
-2
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,7 @@ Once registered you can define the dockerfile to use with `-f Dockerfile.aarch64
260260

261261
## Versions
262262

263+
* **16.09.21:** - Fix slow `chown` on large workspace (contents of workspace folder no longer chowned).
263264
* **11.07.21:** - Bump node to 14 to fix builds
264265
* **08.05.21:** - Fix doc link
265266
* **04.02.20:** - Allow setting gui password via hash using env var `HASHED_PASSWORD`.

readme-vars.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ app_setup_block: |
7575
7676
# changelog
7777
changelogs:
78+
- { date: "16.09.21:", desc: "Fix slow `chown` on large workspace (contents of workspace folder no longer chowned)." }
7879
- { date: "11.07.21:", desc: "Bump node to 14 to fix builds" }
7980
- { date: "08.05.21:", desc: "Fix doc link" }
8081
- { date: "04.02.20:", desc: "Allow setting gui password via hash using env var `HASHED_PASSWORD`." }

root/etc/cont-init.d/30-config

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,20 @@ if [ -n "${SUDO_PASSWORD}" ] || [ -n "${SUDO_PASSWORD_HASH}" ]; then
1818
fi
1919

2020
# permissions
21-
chown -R abc:abc \
22-
/config
21+
if [ -f "/usr/bin/find" ] && [ -f "/usr/bin/xargs" ]; then
22+
CORES=$(nproc --all)
23+
24+
# Split workload between config and workspace
25+
echo "setting permissions::configuration"
26+
find /config -path /config/workspace -prune -false -o -type d -print0 | \
27+
xargs --null -r --max-args=1 --max-procs=$((CORES*2*8)) \
28+
chown -R abc:abc
29+
30+
echo "setting permissions::workspace"
31+
chown abc:abc /config/workspace
32+
else
33+
# Set permissions on data mount
34+
# do not decend into the workspace
35+
chown -R abc:abc "$(ls /config -I workspace)"
36+
chown abc:abc /config/workspace
37+
fi

0 commit comments

Comments
 (0)