Unverified Commit 0f786baf authored by r-vdp's avatar r-vdp
Browse files

etc: remove unneeded temporary directions after putting in place the new etc

parent a2d4cea9
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -276,6 +276,22 @@ in

        # Unmount the top /etc mount to atomically reveal the new mount.
        umount --lazy --recursive /etc

        # Unmount the temporary mount
        umount --lazy "$tmpEtcMount"
        rmdir "$tmpEtcMount"

        # Unmount old metadata mounts
        # For some reason, `findmnt /tmp --submounts` does not show the nested
        # mounts. So we'll just find all mounts of type erofs and filter on the
        # name of the mountpoint.
        findmnt --type erofs --list --kernel --output TARGET | while read -r mountPoint; do
          if [[ "$mountPoint" =~ ^/tmp/nixos-etc-metadata\..{10}$ &&
                "$mountPoint" != "$tmpMetadataMount" ]]; then
            umount --lazy $mountPoint
            rmdir "$mountPoint"
          fi
        done
      fi
    '' else ''
      # Set up the statically computed bits of /etc.