fix: copy over /etc files correctly

This commit is contained in:
Rudra B.S. 2023-11-22 13:30:36 +05:30
parent 0976e092b5
commit 8238f67f79

View file

@ -36,7 +36,7 @@ run_latehook() {
cp /new_root/.update_rootfs/etc/pacman.conf /new_root/.new_etc/pacman.conf cp /new_root/.update_rootfs/etc/pacman.conf /new_root/.new_etc/pacman.conf
rm -rf /new_root/.new_etc/pacman.d rm -rf /new_root/.new_etc/pacman.d
cp -a /new_root/.update_rootfs/etc/pacman.d /new_root/.new_etc/pacman.d cp -a /new_root/.update_rootfs/etc/pacman.d /new_root/.new_etc/pacman.d
(cd /new_root/.update_rootfs/etc && find . -type f -print0 | grep -Fxvz -f <(cd "/new_root/.new_etc" && find . -type f -print0) | xargs -0 sh -c 'cp "$@" /new_root/.new_etc' sh) (cd /new_root/.update_rootfs/etc && find . -type f -print0 | grep -Fxvz -f <(cd "/new_root/.new_etc" && find . -type f -print0) | xargs -n 1 -0 sh -c 'mkdir -p "/new_root/.new_etc/$(dirname "$1")"; cp "$1" /new_root/.new_etc/$(dirname "$1")' sh)
mv /new_root/etc /new_root/.old.etc || : mv /new_root/etc /new_root/.old.etc || :
mv /new_root/.new_etc /new_root/etc mv /new_root/.new_etc /new_root/etc