Skip to content

Commit 533ac5b

Browse files
committed
build.sh: make /usr permission changes smarter
If we only change the permissions on the directories then we won't balloon the size of the container so much. As an example after the changes in 17b3f52, f7ef7d3 we ended up almost doubling the size of the container: ``` builder@coreos-ppc64le-builder:~$ podman images REPOSITORY TAG IMAGE ID CREATED SIZE quay.io/coreos-assembler/staging ppc64le-f7ef7d3 5ca4b8d1eae4 38 hours ago 9.18 GB quay.io/coreos-assembler/staging ppc64le-d34ab4a 659d6f7bbf7a 45 hours ago 5.11 GB quay.io/coreos-assembler/staging ppc64le-17b3f52 d2e55354e43f 2 days ago 5.11 GB ``` This should make it so the duplicated files in layers are only directories so they take up much less space.
1 parent 5c52e79 commit 533ac5b

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

build.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -217,16 +217,16 @@ patch_osbuild() {
217217
}
218218

219219
fixup_file_permissions() {
220-
# Allow group write permissions on /usr/ because in upstream project's
221-
# CI we want to overwrite software for testing. The directories
220+
# Allow group write perms on directories under /usr/ because in upstream
221+
# project's CI we want to overwrite software for testing. The directories
222222
# are typically owned by root:root and CI runs in openshift as a user
223223
# that is a member of the `root` (GID: 0) group.
224224
# See https://github.com/coreos/coreos-installer/pull/1716
225-
chmod -R g+w /usr/
225+
find /usr -type d -print0 | xargs -0 chmod -c g+w
226226
# And also one exception for /etc/grub.d (on arches that support
227227
# grub) since ostree upstream tries to put a symlink in this directory.
228228
if [ -d /etc/grub.d ]; then
229-
chmod g+rwx /etc/grub.d
229+
chmod -c g+rwx /etc/grub.d
230230
fi
231231
}
232232

0 commit comments

Comments
 (0)