From bb38d0e3250440a890803d6180f2634dc7ce0487 Mon Sep 17 00:00:00 2001 From: AzherKhan Date: Mon, 27 Oct 2014 09:42:05 -0700 Subject: [PATCH] Optimize speed of deletion in find command I would like to recommend to use + instead of \; in the find command. As this will ensure the removal of all selected directories in a single invocation. Hence improve the speed of deletion. Change-Id: I409fe11aae217afb6f790491591005c679264ed4 --- elements/dpkg/root.d/60-block-apt-translations | 2 +- elements/redhat-common/pre-install.d/15-remove-grub | 2 +- lib/ramdisk-functions | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/elements/dpkg/root.d/60-block-apt-translations b/elements/dpkg/root.d/60-block-apt-translations index 4fde777d..6298cadd 100755 --- a/elements/dpkg/root.d/60-block-apt-translations +++ b/elements/dpkg/root.d/60-block-apt-translations @@ -11,4 +11,4 @@ APT::Acquire::Languages "none"; EOF # And now make sure that we don't fall foul of Debian bug 641967 -find $TARGET_ROOT/var/lib/apt/lists/ -type f -name '*_i18n_Translation-*' -exec sudo rm -f {} \; +find $TARGET_ROOT/var/lib/apt/lists/ -type f -name '*_i18n_Translation-*' -exec sudo rm -f {} + diff --git a/elements/redhat-common/pre-install.d/15-remove-grub b/elements/redhat-common/pre-install.d/15-remove-grub index 60203ae6..d0fcafb0 100755 --- a/elements/redhat-common/pre-install.d/15-remove-grub +++ b/elements/redhat-common/pre-install.d/15-remove-grub @@ -9,7 +9,7 @@ yum remove -y grub2 # Remove all old versions of grub2 from the yum cache and then ensure the # latest version is in the cache. basearch=$(cat /etc/yum/vars/basearch) -find /tmp/yum/$basearch -regex ".*/grub2-[0-9].*\.rpm" -exec rm -f {} \; +find /tmp/yum/$basearch -regex ".*/grub2-[0-9].*\.rpm" -exec rm -f {} + install-packages -d grub2 # Copy grub2 rpm out of mounted yum cache for install during finalise diff --git a/lib/ramdisk-functions b/lib/ramdisk-functions index b34e93ab..62e27428 100644 --- a/lib/ramdisk-functions +++ b/lib/ramdisk-functions @@ -171,7 +171,7 @@ function populate_lib () { cp -a "$MODULE_DIR" "$TMP_MOUNT_PATH/lib/modules/$KERNEL_VERSION" echo "Removing kernel framebuffer drivers to enforce text mode consoles..." - find $TMP_MOUNT_PATH/lib/modules/$KERNEL_VERSION/kernel/drivers/video -name '*fb.ko' -exec rm -v {} \; + find $TMP_MOUNT_PATH/lib/modules/$KERNEL_VERSION/kernel/drivers/video -name '*fb.ko' -exec rm -v {} + if [ -d $FIRMWARE_DIR ]; then cp -a "$FIRMWARE_DIR" "$TMP_MOUNT_PATH/lib/firmware" fi