#!/bin/bash run_latehook() { echo # Remove /new_root/.successful-update if exists rm -f /new_root/.successful-update /new_root/.update # Detect if update downloaded. if [[ -d /new_root/.update_rootfs ]]; then # Available, rename old /usr and move new /usr to /. 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 mv /new_root/.update_rootfs/etc /new_root/usr/etc fi if [[ -d /new_root/.new.etc ]]; then mv /new_root/etc /new_root/.old.etc mv /new_root/.new.etc /new_root/etc fi # Same for /var. if [[ -d /new_root/.new.var.lib ]]; then 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 fi for i in usr varlibpacman usrlocal; do rm -rf /new_root/.blend-overlays/$i.workdir mkdir -p /new_root/.blend-overlays/$i mkdir -p /new_root/.blend-overlays/$i.workdir done mount -t overlay overlay -o index=off -o metacopy=off -o ro,lowerdir=/new_root/usr,upperdir=/new_root/.blend-overlays/usr,workdir=/new_root/.blend-overlays/usr.workdir /new_root/usr mount -t overlay overlay -o index=off -o metacopy=off -o ro,lowerdir=/new_root/var/lib/pacman,upperdir=/new_root/.blend-overlays/varlibpacman,workdir=/new_root/.blend-overlays/varlibpacman.workdir /new_root/var/lib/pacman mount -t overlay overlay -o rw,lowerdir=/new_root/usr/local,upperdir=/new_root/.blend-overlays/usrlocal,workdir=/new_root/.blend-overlays/usrlocal.workdir /new_root/usr/local }