Skip to content

Commit

Permalink
Merge pull request #2387 from OSInside/no_busy_state_for_overlay
Browse files Browse the repository at this point in the history
Create live persistent storage without busy state
  • Loading branch information
schaefi authored Nov 5, 2023
2 parents 232b691 + cf12543 commit 3abc4a3
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 16 deletions.
11 changes: 9 additions & 2 deletions dracut/modules.d/90kiwi-live/kiwi-live-lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ function mountIso {
function mountCompressedContainerFromIso {
local iso_mount_point=$1
local overlay_base
local squashfs_container
overlay_base=$(getOverlayBaseDirectory)
local container_mount_point="${overlay_base}/squashfs_container"
squashfs_container="${iso_mount_point}/${live_dir}/${squash_image}"
Expand Down Expand Up @@ -205,8 +206,14 @@ function preparePersistentOverlayDiskBoot {
if ! mount -L cow "${overlay_mount_point}"; then
partitions_before_cow_part=$(_partition_count)
echo -e "n\np\n\n\n\nw\nq" | fdisk "${isodiskdev}"
if ! partprobe "${isodiskdev}"; then
return 1
if type partprobe &> /dev/null;then
if ! partprobe "${isodiskdev}"; then
return 1
fi
else
if ! partx -u "${isodiskdev}"; then
return 1
fi
fi
if [ "$(_partition_count)" -le "${partitions_before_cow_part}" ];then
return 1
Expand Down
22 changes: 11 additions & 11 deletions dracut/modules.d/90kiwi-live/kiwi-live-root.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,6 @@ initGlobalDevices "$1"
# live options and their default values
initGlobalOptions

# mount ISO device
iso_mount_point=$(mountIso)

# mount squashfs compressed container
container_mount_point=$(
mountCompressedContainerFromIso "${iso_mount_point}"
)

# mount readonly root filesystem from container
mountReadOnlyRootImageFromContainer "${container_mount_point}"

# prepare overlay for generated systemd LiveOS_rootfs service
declare isodiskdev=${isodiskdev}
if getargbool 0 rd.live.overlay.persistent && [ -n "${isodiskdev}" ]; then
Expand All @@ -43,6 +32,17 @@ else
prepareTemporaryOverlay
fi

# mount ISO device
iso_mount_point=$(mountIso)

# mount squashfs compressed container
container_mount_point=$(
mountCompressedContainerFromIso "${iso_mount_point}"
)

# mount readonly root filesystem from container
mountReadOnlyRootImageFromContainer "${container_mount_point}"

need_shutdown

exit 0
2 changes: 1 addition & 1 deletion dracut/modules.d/90kiwi-live/module-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ install() {
local dmsquashdir=
inst_multiple -o checkmedia
inst_multiple \
umount dmsetup blockdev blkid lsblk dd losetup \
umount dmsetup partx blkid lsblk dd losetup \
grep cut partprobe find wc fdisk tail mkfs.ext4 mkfs.xfs \
dialog cat mountpoint

Expand Down
2 changes: 1 addition & 1 deletion dracut/modules.d/99kiwi-lib/kiwi-partitions-lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function create_partitions {
if type partprobe &> /dev/null;then
partprobe "${disk_device}"
else
blockdev --rereadpt "${disk_device}"
partx -u "${disk_device}"
fi
}

Expand Down
2 changes: 1 addition & 1 deletion dracut/modules.d/99kiwi-lib/module-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ depends() {
install() {
declare moddir=${moddir}
inst_multiple \
blkid blockdev dd mkdir rmdir \
blkid partx blockdev dd mkdir rmdir \
grep cut tail head tr bc true false mountpoint \
basename partprobe sfdisk sgdisk mkswap readlink lsblk \
btrfs xfs_growfs resize2fs \
Expand Down

0 comments on commit 3abc4a3

Please sign in to comment.