From 462cd6a991126ed6d7ab5a48a71cb78c27080361 Mon Sep 17 00:00:00 2001 From: Tobias Powalowski Date: Tue, 18 Jun 2024 16:42:07 +0200 Subject: [PATCH] replace find and fix fd locale cleaning --- usr/lib/archboot/container.sh | 14 +++++++------- usr/lib/archboot/update/desktop.sh | 16 +++++++++------- usr/lib/archboot/update/manage.sh | 4 ++-- 3 files changed, 18 insertions(+), 16 deletions(-) diff --git a/usr/lib/archboot/container.sh b/usr/lib/archboot/container.sh index a8311ce92..18d251e30 100644 --- a/usr/lib/archboot/container.sh +++ b/usr/lib/archboot/container.sh @@ -67,13 +67,13 @@ _clean_container() { rm -r "${1}"/usr/share/{aclocal,applications,audit-rules,awk,common-lisp,emacs,et,fish,gettext,gettext-[0-9]*,glib-[0-9]*,gnupg,gtk-doc,iana-etc,icons,icu,keyutils,libalpm,libgpg-error,makepkg-template,misc,pixmaps,pkgconfig,screen,smartmontools,ss,tabset,vala,xml,man,doc,info,xtables} rm -r "${1}"/usr/lib/{audit,awk,binfmt.d,cmake,dracut,e2fsprogs,environment.d,gawk,getconf,gettext,glib-[0-9]*,gnupg,gssproxy,icu,krb5,ldscripts,libnl,pkgconfig,siconv,tar,xfsprogs,xtables} # locale cleaning - fd -u --min-depth 2 -E '*/be/*' -E '*/bg/*' \ - -E '*/cs/*' -E '*/da/*' -E '*/de/*' -E '*/en/*' \ - -E '*/el/*' -E '*/es/*' -E '*/fi/*' -E '*/fr/*' \ - -E '*/hu/*' -E '*/it/*' -E '*/lt/*' -E '*/lv/*' \ - -E '*/mk/*' -E '*/nl/*' -E '*/nn/*' -E '*/pl/*' \ - -E '*/pt/*' -E '*/ro/*' -E '*/ru/*' -E '*/sk/*' \ - -E '*/sr/*' -E '*/sv/*' -E '*/tr/*' -E '*/uk/*' \ + fd -u --min-depth 2 -E '/be/' -E '/bg/' \ + -E '/cs/' -E '/da/' -E '/de/' -E '/en/' \ + -E '/el/' -E '/es/' -E '/fi/' -E '/fr/' \ + -E '/hu/' -E '/it/' -E '/lt/' -E '/lv/' \ + -E '/mk/' -E '/nl/' -E '/nn/' -E '/pl/' \ + -E '/pt/' -E '/ro/' -E '/ru/' -E '/sk/' \ + -E '/sr/' -E '/sv/' -E '/tr/' -E '/uk/' \ . "${1}"/usr/share/locale/ -X rm &>"${_NO_LOG}" fd -u -t f -E 'UTF-8.gz' . "${1}"/usr/share/i18n/charmaps -X rm &>"${_NO_LOG}" fi diff --git a/usr/lib/archboot/update/desktop.sh b/usr/lib/archboot/update/desktop.sh index 0753da8d1..116cc4d85 100644 --- a/usr/lib/archboot/update/desktop.sh +++ b/usr/lib/archboot/update/desktop.sh @@ -6,13 +6,15 @@ _cleanup() { rm -rf /usr/share/{man,help,info,doc,gtk-doc} rm -rf /usr/include rm -rf /usr/share/icons/breeze-dark - find /usr/share/locale/ -mindepth 2 ! -path '*/be/*' ! -path '*/bg/*' ! -path '*/cs/*' \ - ! -path '*/da/*' ! -path '*/de/*' ! -path '*/en/*' ! -path '*/el/*' ! -path '*/es/*' \ - ! -path '*/fi/*' ! -path '*/fr/*' ! -path '*/hu/*' ! -path '*/it/*' ! -path '*/lt/*' \ - ! -path '*/lv/*' ! -path '*/mk/*' ! -path '*/nl/*' ! -path '*/nn/*' ! -path '*/pl/*' \ - ! -path '*/pt/*' ! -path '*/ro/*' ! -path '*/ru/*' ! -path '*/sk/*' ! -path '*/sr/*' \ - ! -path '*/sv/*' ! -path '*/tr/*' ! -path '*/uk/*' -delete &>"${_NO_LOG}" - find /usr/share/i18n/charmaps ! -name 'UTF-8.gz' -delete &>"${_NO_LOG}" + fd -u --min-depth 2 -E '/be/' -E '/bg/' \ + -E '/cs/' -E '/da/' -E '/de/' -E '/en/' \ + -E '/el/' -E '/es/' -E '/fi/' -E '/fr/' \ + -E '/hu/' -E '/it/' -E '/lt/' -E '/lv/' \ + -E '/mk/' -E '/nl/' -E '/nn/' -E '/pl/' \ + -E '/pt/' -E '/ro/' -E '/ru/' -E '/sk/' \ + -E '/sr/' -E '/sv/' -E '/tr/' -E '/uk/' \ + . /usr/share/locale/ -X rm &>"${_NO_LOG}" + fd -u -t f -E 'UTF-8.gz' . /usr/share/i18n/charmaps -X rm &>"${_NO_LOG}" # remove packages from cache #shellcheck disable=SC2013 for i in $(grep -w -E 'reinstalled|installed|upgraded' /var/log/pacman.log | cut -d ' ' -f 4); do diff --git a/usr/lib/archboot/update/manage.sh b/usr/lib/archboot/update/manage.sh index 13bf84b83..678a08537 100644 --- a/usr/lib/archboot/update/manage.sh +++ b/usr/lib/archboot/update/manage.sh @@ -129,7 +129,7 @@ _create_initramfs() { # https://www.kernel.org/doc/Documentation/filesystems/ramfs-rootfs-initramfs.txt # compress image with zstd cd "${_ROOTFS_DIR}" || exit 1 - find . -mindepth 1 -printf '%P\0' | + fd . -u --min-depth 1 -0 | sort -z | LANG=C bsdtar --null -cnf - -T - | LANG=C bsdtar --null -cf - --format=newc @- | @@ -226,7 +226,7 @@ _new_environment() { _collect_files & _progress_wait "42" "84" "Collecting rootfs files in ${_W_DIR}..." "3.75" _progress "85" "Cleanup ${_W_DIR}..." - find "${_W_DIR}"/. -mindepth 1 -maxdepth 1 ! -name 'tmp' -exec rm -rf {} \; + fd -u -mindepth 1 -maxdepth 1 -E 'tmp' . "${_W_DIR}"/. -X rm -rf _clean_kernel_cache _ram_check # local switch, don't kexec on local image