From aa705aaa621c2e0d4f146f3a1de801edcb0fa0d5 Mon Sep 17 00:00:00 2001 From: Eero Kelly Date: Wed, 8 Jan 2025 16:55:10 -0800 Subject: [PATCH] feat: [NODE-1499] Run chown/chmod in setup-permissions in parallel (#3373) This further increases the speed of the [reboot toy](https://github.com/dfinity/ic/blob/36e2b45d4712908b8ddca1c05b50b8fc1d6562d1/rs/tests/node/BUILD.bazel#L31) from 56.578s to 33.395s. --- ic-os/components/ic/setup-permissions/erestorecon.sh | 2 +- ic-os/components/ic/setup-permissions/setup-permissions.sh | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ic-os/components/ic/setup-permissions/erestorecon.sh b/ic-os/components/ic/setup-permissions/erestorecon.sh index 3cc9a4192e5..876c59f9af5 100755 --- a/ic-os/components/ic/setup-permissions/erestorecon.sh +++ b/ic-os/components/ic/setup-permissions/erestorecon.sh @@ -5,4 +5,4 @@ set -e # erestorecon (easy prestorecon) uses UNIX tools to parallelize restorecon, # instead of the cpp based prestorecon. -find $@ -print0 | xargs -0 -P 0 restorecon +find $@ -print0 | xargs -0 -P 0 restorecon -F diff --git a/ic-os/components/ic/setup-permissions/setup-permissions.sh b/ic-os/components/ic/setup-permissions/setup-permissions.sh index 8576d1e1e60..9b073af4954 100755 --- a/ic-os/components/ic/setup-permissions/setup-permissions.sh +++ b/ic-os/components/ic/setup-permissions/setup-permissions.sh @@ -24,8 +24,8 @@ function make_group_owned_and_sticky() { local GROUP="$3" mkdir -p "${TARGET_DIR}" - chown -R "${USER}:${GROUP}" "${TARGET_DIR}" - chmod u=rwX,g=rX,o= -R "${TARGET_DIR}" + find "${TARGET_DIR}" -print0 | xargs -0 -P 0 chown "${USER}:${GROUP}" + find "${TARGET_DIR}" -print0 | xargs -0 -P 0 chmod u=rwX,g=rX,o= find "${TARGET_DIR}" -type d | xargs chmod g+s }