Implement immutability

This commit is contained in:
Rudra Saraswat 2023-05-07 11:46:13 +05:30
parent 038f5d2abf
commit 3ead61252c
2 changed files with 32 additions and 11 deletions

View file

@ -209,6 +209,7 @@ description = f'''
This command is not meant to be used by regular users. This command is not meant to be used by regular users.
{colors.bold}{colors.fg.cyan}available commands{colors.reset}: {colors.bold}{colors.fg.cyan}available commands{colors.reset}:
{colors.bold}help{colors.reset} Show this help message and exit.
{colors.bold}help{colors.reset} Show this help message and exit. {colors.bold}help{colors.reset} Show this help message and exit.
{colors.bold}version{colors.reset} Show version information and exit. {colors.bold}version{colors.reset} Show version information and exit.

View file

@ -29,10 +29,14 @@ run_latehook() {
# Only copy non-existent files. # Only copy non-existent files.
cp -a -n /new_root/mnt/iso-update/squashfs-root/etc/* /new_root/etc cp -a -n /new_root/mnt/iso-update/squashfs-root/etc/* /new_root/etc
# Update pacman config. # Update pacman config, and other system files that aren't
# supposed to be edited.
cp /new_root/mnt/iso-update/squashfs-root/etc/pacman.conf /new_root/etc cp /new_root/mnt/iso-update/squashfs-root/etc/pacman.conf /new_root/etc
rm -rf /new_root/etc/pacman.d rm -rf /new_root/etc/pacman.d
cp -r /new_root/mnt/iso-update/squashfs-root/etc/pacman.d /new_root/etc cp -r /new_root/mnt/iso-update/squashfs-root/etc/pacman.d /new_root/etc
cp /new_root/mnt/iso-update/squashfs-root/etc/blend_release /new_root/etc
cp /new_root/mnt/iso-update/squashfs-root/etc/os-release /new_root/etc
cp /new_root/mnt/iso-update/squashfs-root/etc/lsb-release /new_root/etc
# Successful update. # Successful update.
rm -f /new_root/mnt/iso-update/.etc-stage rm -f /new_root/mnt/iso-update/.etc-stage
@ -41,5 +45,21 @@ run_latehook() {
# Create overlay directories # Create overlay directories
rm -rf /new_root/.blend-overlays /new_root/.blendrw rm -rf /new_root/.blend-overlays /new_root/.blendrw
mkdir -p /new_root/.blend-overlays/{usr,varlib,etcpacman}
for i in usr varlibpacman; do
rm -rf /new_root/.blend-overlays/$i
mkdir -p /new_root/.blend-overlays/$i
mkdir -p /new_root/.blend-overlays/$i.workdir
done
mount -t overlay overlay -o lowerdir=/new_root/usr:/new_root/.blend-overlays/usr /new_root/usr
mount -t overlay overlay -o lowerdir=/new_root/var/lib/pacman:/new_root/.blend-overlays/varlibpacman /new_root/var/lib/pacman
mkdir -p /new_root/.blendrw
mount "$(findmnt /new_root)" /new_root/.blendrw
mount -t overlay overlay -o lowerdir=/new_root/usr,upperdir=/new_root/.blend-overlays/usr,workdir=/new_root/.blend-overlays/usr.workdir
/new_root/.blendrw/usr
mount -t overlay overlay -o lowerdir=/new_root/var/lib/pacman,upperdir=/new_root/.blend-overlays/varlibpacman,workdir=/new_root/.blend-overlays/varlibpacman.workdir
/new_root/.blendrw/var/lib/pacman
} }