Revert "Allow configuration of paths to prune"

This reverts commit 68989576e3.

Reason for revert: Breaks pruning in all cases.

Change-Id: Ib7a16ffcf3aaa6a1ffac9ad73e5cff00c7daadb1
This commit is contained in:
Jay Faulkner 2021-08-09 21:24:28 +00:00
parent 68989576e3
commit 8ba630fb22
1 changed files with 25 additions and 16 deletions

View File

@ -19,27 +19,36 @@ IMAGE_PATH=$(readlink -f $IMAGE_NAME)
cd $TARGET_ROOT
DIB_IPA_COMPRESS_CMD="${DIB_IPA_COMPRESS_CMD:-gzip}"
DIB_IPA_PATHS_TO_PRUNE="${DIB_IPA_PATHS_TO_PRUNE:-'./sys/*' './tmp/*' \
'./boot/*' './root/.cache' '*site-packages/babel/locale-data/*' \
'./usr/include/*' './usr/lib/locale/*' './usr/share/doc/*' \
'./usr/share/man/*' './usr/share/GeoIP/*' './usr/share/info/*' \
'./usr/share/licenses/*' './usr/share/locale/*' './usr/share/misc/m*' \
'./usr/src/kernels/*' './var/cache/*' './var/log/*'}"
echo "#disabled" > ./tmp/fstab.new
sudo mv ./tmp/fstab.new ./etc/fstab
sudo ln -s ./sbin/init ./
# Build up the command to find files to add to initramfs
# using configurable list of paths to prune
FIND_COMMAND="find . -xdev "
for path in $DIB_IPA_PATHS_TO_PRUNE; do
FIND_COMMAND="$FIND_COMMAND -path $path -prune -o "
done
FIND_COMMAND="$FIND_COMMAND -name '*.pyc' -prune -o "
FIND_COMMAND="$FIND_COMMAND -name '*.pyo' -prune -o -print "
sudo $FIND_COMMAND | sudo cpio -o -H newc | ${DIB_IPA_COMPRESS_CMD} > ${IMAGE_PATH}.initramfs
# Note: The pci.ids, which is used by lshw, locate on Ubuntu
# in /usr/share/misc. Therefore we are removing only the
# ./usr/share/misc/m* (will remove the magic and magic.mgc files).
# on RHEL pci.ids is locate on /usr/share/hwdata/pci.ids.
sudo find . -xdev \
-path './sys/*' -prune -o \
-path './tmp/*' -prune -o \
-path './boot/*' -prune -o \
-path './root/.cache' -prune -o \
-path "*site-packages/babel/locale-data/*" -prune -o \
-path './usr/include/*' -prune -o \
-path './usr/lib/locale/*' -prune -o \
-path './usr/share/doc/*' -prune -o \
-path './usr/share/man/*' -prune -o \
-path './usr/share/GeoIP/*' -prune -o \
-path './usr/share/info/*' -prune -o \
-path './usr/share/licenses/*' -prune -o \
-path './usr/share/locale/*' -prune -o \
-path './usr/share/misc/m*' -prune -o \
-path './usr/src/kernels/*' -prune -o \
-path './var/cache/*' -prune -o \
-path './var/log/*' -prune -o \
-name '*.pyc' -prune -o \
-name '*.pyo' -prune -o \
-print | sudo cpio -o -H newc | ${DIB_IPA_COMPRESS_CMD} > ${IMAGE_PATH}.initramfs
select_boot_kernel_initrd $TARGET_ROOT
sudo cp $BOOTDIR/$KERNEL ${IMAGE_PATH}.kernel