mirror of
https://github.com/armbian/os.git
synced 2026-01-06 10:38:50 -08:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user