chore: handle /var/cache/pacman

This commit is contained in:
Rudra Saraswat 2024-02-09 17:24:51 +05:30
parent deb302a20e
commit afd6cbb149
2 changed files with 13 additions and 7 deletions

View file

@ -9,8 +9,10 @@ run_latehook() {
# Detect if update downloaded.
if [[ -d /new_root/.update_rootfs ]]; then
# Available, rename old /usr and move new /usr to /.
mv /new_root/usr /new_root/.old.usr
mv /new_root/.update_rootfs/usr /new_root/usr
if [[ -d /new_root/.update_rootfs/usr ]]; then
mv /new_root/usr /new_root/.old.usr
mv /new_root/.update_rootfs/usr /new_root/usr
fi
# Same for /etc.
if [[ -d /new_root/.update_rootfs/etc ]]; then
@ -21,11 +23,15 @@ run_latehook() {
mv /new_root/.new.etc /new_root/etc
fi
# Same for /var/lib/pacman.
# Same for /var.
if [[ -d /new_root/.new.var.lib ]]; then
mv /new_root/var/lib /new_root/.old.var.lib
mv /new_root/var/lib /new_root/.old.var.lib
mv /new_root/.new.var.lib /new_root/var/lib
fi
if [[ -d /new_root/.update_rootfs/var/cache/pacman ]]; then
mv /new_root/var/cache/pacman /new_root/.old.var.cache.pacman
mv /new_root/.update_rootfs/var/cache/pacman /new_root/var/cache/pacman
fi
mv /new_root/.update_rootfs /new_root/.old.update_rootfs
touch /new_root/.successful-update