2023-05-06 08:17:56 -05:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
run_latehook() {
|
|
|
|
echo
|
2023-05-09 01:21:59 -05:00
|
|
|
|
2023-11-17 14:21:53 -06:00
|
|
|
# Remove /new_root/.successful-update if exists
|
2024-02-10 01:00:18 -06:00
|
|
|
rm -f /new_root/.successful-update /new_root/.update
|
2023-05-09 01:21:59 -05:00
|
|
|
|
2023-05-06 08:17:56 -05:00
|
|
|
# Detect if update downloaded.
|
2023-11-17 14:21:53 -06:00
|
|
|
if [[ -d /new_root/.update_rootfs ]]; then
|
2023-05-06 08:17:56 -05:00
|
|
|
# Available, rename old /usr and move new /usr to /.
|
2024-02-09 05:54:51 -06:00
|
|
|
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
|
2023-05-12 02:12:46 -05:00
|
|
|
|
2024-02-09 02:25:45 -06:00
|
|
|
# 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
|
2023-06-10 08:17:45 -05:00
|
|
|
|
2024-10-09 09:39:45 -05:00
|
|
|
# Same for /opt
|
|
|
|
if [[ -d /new_root/.update_rootfs/opt ]]; then
|
|
|
|
mv /new_root/opt /new_root/.old.opt
|
|
|
|
mv /new_root/.update_rootfs/opt /new_root/opt
|
|
|
|
fi
|
|
|
|
|
2024-02-09 05:54:51 -06:00
|
|
|
# Same for /var.
|
2024-02-09 02:25:45 -06:00
|
|
|
if [[ -d /new_root/.new.var.lib ]]; then
|
2024-02-09 05:54:51 -06:00
|
|
|
mv /new_root/var/lib /new_root/.old.var.lib
|
2024-02-09 02:25:45 -06:00
|
|
|
mv /new_root/.new.var.lib /new_root/var/lib
|
|
|
|
fi
|
2024-02-09 05:54:51 -06:00
|
|
|
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
|
2023-11-20 00:55:24 -06:00
|
|
|
|
|
|
|
mv /new_root/.update_rootfs /new_root/.old.update_rootfs
|
2023-11-17 14:21:53 -06:00
|
|
|
touch /new_root/.successful-update
|
2023-05-09 01:21:59 -05:00
|
|
|
fi
|
2023-11-24 11:50:05 -06:00
|
|
|
|
2024-02-10 01:10:29 -06:00
|
|
|
for i in usr varlibpacman usrlocal; do
|
2024-02-09 10:33:41 -06:00
|
|
|
rm -rf /new_root/.blend-overlays/$i.workdir
|
2023-11-24 11:50:05 -06:00
|
|
|
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
|
2024-02-10 01:10:29 -06:00
|
|
|
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
|
2023-05-06 08:17:56 -05:00
|
|
|
}
|