From 1323bb68f739878ee74b0229d11df9524bf61a67 Mon Sep 17 00:00:00 2001 From: "Rudra B.S." Date: Tue, 21 Nov 2023 15:59:47 +0530 Subject: [PATCH] feat: make /var/lib operations atomic --- akshara.hook | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/akshara.hook b/akshara.hook index 5104ee6..20f4acb 100755 --- a/akshara.hook +++ b/akshara.hook @@ -31,8 +31,9 @@ run_latehook() { cp -a /new_root/etc /new_root/.new_etc (cd /new_root/.new_etc && find . -type f -print0 | grep -Fxvz -f <(cd "/new_root/.update_rootfs/etc" && find . -type f) | xargs -0 rm -f) (cd /new_root/.new_etc && find . -type l -print0 | grep -Fxvz -f <(cd "/new_root/.update_rootfs/etc" && find . -type l) | xargs -0 rm -f) - (cd /new_root/var/lib && find . -maxdepth 1 -type d -print0 | grep -Fxvz -f <(cd "/new_root/.update_rootfs/var/lib" && find . -maxdepth 1 -type d) | xargs -0 -n 2 rm -rf)/ - (cd /new_root/.update_rootfs/var/lib && find . -maxdepth 1 -type d -print0 | grep -Fxvz -f <(cd "/new_root/var/lib" && find . -maxdepth 1 -type d) | xargs -0 -n 2 sh -c 'cp -r "$@" /new_root/var/lib' sh) + mkdir /.old.varlib + (cd /new_root/var/lib && find . -maxdepth 1 -type d -print0 | grep -Fxvz -f <(cd "/new_root/.update_rootfs/var/lib" && find . -maxdepth 1 -type d) | xargs -0 sh -c 'mv "$@" /new_root/.old.varlib' sh) + (cd /new_root/.update_rootfs/var/lib && find . -maxdepth 1 -type d -print0 | grep -Fxvz -f <(cd "/new_root/var/lib" && find . -maxdepth 1 -type d) | xargs -0 sh -c 'mv "$@" /new_root/var/lib' sh) cp /new_root/.update_rootfs/etc/pacman.conf /new_root/.new_etc/pacman.conf rm -rf /new_root/.new_etc/pacman.d cp -a /new_root/.update_rootfs/etc/pacman.d /new_root/.new_etc/pacman.d