Skip to content
Permalink
Browse files

Fix USB ISO image

  • Loading branch information...
ibuildthecloud committed May 10, 2019
1 parent 6dd7627 commit a75e55af06fc870f4cc5400167dfeaba39c510be
Showing with 35 additions and 7 deletions.
  1. +2 −1 images/06-iso/Dockerfile
  2. +4 −0 images/06-iso/wrapper
  3. +13 −2 install.sh
  4. +7 −1 overlay/libexec/k3os/live
  5. +9 −3 overlay/libexec/k3os/mode-disk
@@ -31,9 +31,10 @@ RUN cd /usr/src/kernel && \
COPY --from=tar /output/userspace.tar /usr/src/tars/
RUN tar xvf /usr/src/tars/userspace.tar --strip-components=1 -C /usr/src/iso

COPY wrapper /usr/bin/
RUN mkdir -p /output && \
cd /usr/src/iso && \
grub-mkrescue -o /output/k3os.iso . -V K3OS && \
grub-mkrescue --xorriso=/usr/bin/wrapper -o /output/k3os.iso . -V K3OS && \
[ -e /output/k3os.iso ] # grub-mkrescue doesn't exit non-zero on failure
CMD ["run-kvm.sh"]
@@ -0,0 +1,4 @@
#!/bin/bash
A="$(echo "$@" | sed 's!-hfsplus -apm-block-size 2048 -hfsplus-file-creator-type chrp tbxj /System/Library/CoreServices/.disk_label -hfs-bless-by i /System/Library/CoreServices/boot.efi!!')"
echo $A >> /tmp/args
exec xorriso $A
@@ -3,6 +3,7 @@ set -e

PROG=$0
PROGS="dd curl mkfs.ext4 mkfs.vfat fatlabel parted partprobe grub-install"
DISTRO=/run/k3os/iso

if [ "$K3OS_DEBUG" = true ]; then
set -x
@@ -114,9 +115,8 @@ do_mount()
mount ${BOOT} ${TARGET}/boot/efi
fi

DISTRO=/run/k3os/iso
mkdir -p $DISTRO
mount -o ro $ISO_DEVICE $DISTRO
mount -t iso9660 -o ro $ISO_DEVICE $DISTRO
}

do_copy()
@@ -198,6 +198,17 @@ EOF
get_iso()
{
ISO_DEVICE=$(blkid -L K3OS || true)
if [ -z "${ISO_DEVICE}" ]; then
for i in $(lsblk -o NAME,TYPE -n | grep -w disk | awk '{print $1}'); do
mkdir -p ${DISTRO}
if mount -t iso9660 -o ro /dev/$i ${DISTRO}; then
ISO_DEVICE="/dev/$i"
umount ${DISTRO}
break
fi
done
fi

if [ -z "${ISO_DEVICE}" ] && [ -n "$K3OS_INSTALL_ISO_URL" ]; then
TEMP_FILE=$(mktemp k3os.XXXXXXXX.iso)
get_url ${K3OS_INSTALL_ISO_URL} ${TEMP_FILE}
@@ -14,7 +14,13 @@ EOF

K3OS_ISO=$(blkid -L K3OS || true)
if [ -n "$K3OS_ISO" ]; then
mount -o ro $(blkid -L K3OS) /.base
mount -t iso9660 -o ro $(blkid -L K3OS) /.base
else
for i in $(lsblk -o NAME,TYPE -n | grep -w disk | awk '{print $1}'); do
if mount -t iso9660 /dev/$i /.base; then
break
fi
done
fi

setup_kernel
@@ -19,9 +19,15 @@ setup_mounts()

if [ -e $TARGET/k3os/system/growpart ]; then
read DEV NUM < $TARGET/k3os/system/growpart
umount /run/k3os/target
grow $DEV $NUM || true
mount -L K3OS_STATE /run/k3os/target
if [ ! -e "${DEV}${NUM}" ]; then
DEV=$(blkid -L K3OS_STATE | sed 's![0-9][0-9]*$!!')
NUM=$(blkid -L K3OS_STATE | sed 's!.*[^0-9]!!')
fi
if [ -e "${DEV}${NUM}" ]; then
umount /run/k3os/target
grow $DEV $NUM || true
mount -L K3OS_STATE /run/k3os/target
fi
rm -f $TARGET/k3os/system/growpart
fi
}

0 comments on commit a75e55a

Please sign in to comment.
You can’t perform that action at this time.