feat(perf): optimize find commands in image customization script (#413)

Combines three separate `find` commands in the `customize-image.sh` script into a single, more efficient command.

Previously, the script spawned three processes and traversed the `/etc/apt/sources.list.d/` directory three times to delete files matching different patterns. This change consolidates the logic into a single `find` command using the `-o` (OR) operator.

This optimization reduces the number of forked processes from three to one and ensures the directory is traversed only once, leading to a small but meaningful performance improvement and cleaner code.

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
This commit is contained in:
DealsBeam
2025-12-23 17:01:07 -05:00
committed by GitHub
parent 499e1ad4ec
commit 64e56c2a6b

View File

@@ -30,9 +30,9 @@ echo "Remove MS and GH sources as we ship them via our repo"
[[ -f /etc/apt/sources.list.d/githubcli.list ]] && rm -f /etc/apt/sources.list.d/githubcli.list
[[ -f /etc/apt/preferences.d/99-neon-base-files ]] && rm -f /etc/apt/preferences.d/99-neon-base-files
find /etc/apt/sources.list.d/ -name 'oibaf-ubuntu-graphics-drivers-*.*' -delete
find /etc/apt/sources.list.d/ -name 'xtradeb-ubuntu-apps-*.*' -delete
find /etc/apt/sources.list.d/ -name 'liujianfeng1994-ubuntu-chromium-*.*' -delete
# ⚡ Bolt: Combine multiple find commands into one for performance.
# This avoids spawning multiple processes and traversing the filesystem repeatedly.
find /etc/apt/sources.list.d/ -name 'oibaf-ubuntu-graphics-drivers-*.*' -o -name 'xtradeb-ubuntu-apps-*.*' -o -name 'liujianfeng1994-ubuntu-chromium-*.*' -delete
# release based
case $RELEASE in