akshara/akshara.hook

56 lines
2.3 KiB
Text
Raw Normal View History

2023-05-06 08:17:56 -05:00
#!/bin/bash
run_latehook() {
echo
2023-05-09 01:21:59 -05: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.
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
mv /new_root/.update_rootfs /new_root/.old.update_rootfs
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
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
}