Skip to content

Commit

Permalink
Merge pull request #997 from NeroReflex/fix_root
Browse files Browse the repository at this point in the history
  • Loading branch information
ruineka authored Jul 27, 2024
2 parents 25a3eab + b4bd858 commit cb9493e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions build-image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ Subsystem sftp /usr/lib/ssh/sftp-server
echo "
LABEL=frzr_root /frzr_root btrfs defaults,x-initrd.mount,subvolid=5,rw,noatime,nodatacow 0 2
LABEL=frzr_root /home btrfs defaults,x-systemd.rw-only,subvol=/home,rw,noatime,nodatacow,nofail 0 0
overlay /root overlay defaults,x-systemd.requires-mounts-for=/frzr_root,x-systemd.requires-mounts-for=/sysroot/frzr_root,x-initrd.mount,lowerdir=/sysroot/root,upperdir=/sysroot/frzr_root/deployments_data/${SYSTEM_NAME}-${VERSION}/root_overlay/upperdir,workdir=/sysroot/frzr_root/deployments_data/${SYSTEM_NAME}-${VERSION}/root_overlay/workdir,index=off,metacopy=off,xino=off,redirect_dir=off,comment=rootoverlay 0 0
overlay /boot overlay defaults,x-systemd.requires-mounts-for=/frzr_root,x-systemd.requires-mounts-for=/sysroot/frzr_root,x-initrd.mount,lowerdir=/sysroot/frzr_root/kernels/boot:/sysroot/frzr_root/device_quirks/${SYSTEM_NAME}-${VERSION}/boot:/sysroot/boot,upperdir=/sysroot/frzr_root/deployments_data/${SYSTEM_NAME}-${VERSION}/boot_overlay/upperdir,workdir=/sysroot/frzr_root/deployments_data/${SYSTEM_NAME}-${VERSION}/boot_overlay/workdir,index=off,metacopy=off,xino=off,redirect_dir=off,comment=bootoverlay 0 0
overlay /usr overlay defaults,x-systemd.requires-mounts-for=/frzr_root,x-systemd.requires-mounts-for=/sysroot/frzr_root,x-initrd.mount,lowerdir=/sysroot/frzr_root/kernels/usr:/sysroot/frzr_root/device_quirks/${SYSTEM_NAME}-${VERSION}/usr:/sysroot/usr,upperdir=/sysroot/frzr_root/deployments_data/${SYSTEM_NAME}-${VERSION}/usr_overlay/upperdir,workdir=/sysroot/frzr_root/deployments_data/${SYSTEM_NAME}-${VERSION}/usr_overlay/workdir,index=off,metacopy=off,xino=off,redirect_dir=off,comment=usroverlay 0 0
overlay /etc overlay defaults,x-systemd.requires-mounts-for=/frzr_root,x-systemd.requires-mounts-for=/sysroot/frzr_root,x-initrd.mount,x-systemd.rw-only,lowerdir=/sysroot/frzr_root/kernels/etc:/sysroot/frzr_root/device_quirks/${SYSTEM_NAME}-${VERSION}/etc:/sysroot/etc,upperdir=/sysroot/frzr_root/deployments_data/${SYSTEM_NAME}-${VERSION}/etc_overlay/upperdir,workdir=/sysroot/frzr_root/deployments_data/${SYSTEM_NAME}-${VERSION}/etc_overlay/workdir,index=off,metacopy=off,xino=off,redirect_dir=off,comment=etcoverlay 0 0
Expand Down
11 changes: 8 additions & 3 deletions rootfs/usr/lib/frzr.d/install-0004-overlays.migration
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ post_install() {

# clear the old /usr overlay
if [ -d "${SUBVOL_DATA}/usr_overlay" ]; then
rm -rf "${SUBVOL_DATA}/usr_overlay"
rmdir "${SUBVOL_DATA}/usr_overlay"
fi

# clear the old /boot overlay
if [ -d "${SUBVOL_DATA}/boot_overlay" ]; then
rm -rf "${SUBVOL_DATA}/boot_overlay"
rmdir "${SUBVOL_DATA}/boot_overlay"
fi
else
echo "No previous overlay found: creating the overlay"
Expand All @@ -52,6 +52,9 @@ post_install() {
mkdir -p "${SUBVOL_DATA}/etc_overlay/workdir"
mkdir -p "${SUBVOL_DATA}/var_overlay/upperdir"
mkdir -p "${SUBVOL_DATA}/var_overlay/workdir"
mkdir -p "${SUBVOL_DATA}/root_overlay"
mkdir -p "${SUBVOL_DATA}/root_overlay/upperdir"
mkdir -p "${SUBVOL_DATA}/root_overlay/workdir"
btrfs subvol create "${SUBVOL_DATA}/usr_overlay"
mkdir "${SUBVOL_DATA}/usr_overlay/upperdir"
mkdir "${SUBVOL_DATA}/usr_overlay/workdir"
Expand All @@ -62,7 +65,7 @@ post_install() {
btrfs property set -fts "${SUBVOL_DATA}/usr_overlay" ro true
btrfs property set -fts "${SUBVOL_DATA}/boot_overlay" ro true

if [ ! -d "${MOUNT_PATH}/usr" ] && [ -d "${MOUNT_PATH}/etc" ] && [ -z $sysroot_snapshot ] && [ -d "${MOUNT_PATH}/.etc" ] && [ -z $sysroot_snapshot ]; then
if [ ! -d "${MOUNT_PATH}/usr" ] && [ -d "${MOUNT_PATH}/etc" ] && [ -z "$sysroot_snapshot" ] && [ -d "${MOUNT_PATH}/.etc" ]; then
echo "Cloning the /etc overlay upperdir from '${MOUNT_PATH}/etc/' to '${SUBVOL_DATA}/etc_overlay/upperdir'..."
cp -a "${MOUNT_PATH}/etc" "${SUBVOL_DATA}/etc_overlay/"
rm -rf "${SUBVOL_DATA}/etc_overlay/upperdir"
Expand Down Expand Up @@ -90,4 +93,6 @@ post_install() {
echo "Clearing up pacman old pacman gnupg overlay in '${SUBVOL_DATA}/etc_overlay/upperdir/pacman.d/gnupg'..."
rm -rf "${SUBVOL_DATA}/etc_overlay/upperdir/pacman.d/gnupg"
fi

echo "OK"
}

0 comments on commit cb9493e

Please sign in to comment.