From c238db496225e010805a42b45130a6093ed5f3c8 Mon Sep 17 00:00:00 2001 From: Luke Childs Date: Mon, 29 Apr 2024 21:53:51 +0700 Subject: [PATCH 01/11] Add usb-instlaler skeleton --- packages/usb-installer/.gitignore | 1 + packages/usb-installer/build.sh | 60 +++++++++++++++++++++ packages/usb-installer/builder.Dockerfile | 4 ++ packages/usb-installer/run.sh | 10 ++++ packages/usb-installer/umbrel-os.Dockerfile | 53 ++++++++++++++++++ 5 files changed, 128 insertions(+) create mode 100644 packages/usb-installer/.gitignore create mode 100755 packages/usb-installer/build.sh create mode 100644 packages/usb-installer/builder.Dockerfile create mode 100755 packages/usb-installer/run.sh create mode 100644 packages/usb-installer/umbrel-os.Dockerfile diff --git a/packages/usb-installer/.gitignore b/packages/usb-installer/.gitignore new file mode 100644 index 0000000000..378eac25d3 --- /dev/null +++ b/packages/usb-installer/.gitignore @@ -0,0 +1 @@ +build diff --git a/packages/usb-installer/build.sh b/packages/usb-installer/build.sh new file mode 100755 index 0000000000..c6ac662cbe --- /dev/null +++ b/packages/usb-installer/build.sh @@ -0,0 +1,60 @@ +#!/usr/bin/env bash + +echo Creating disk image... +disk_size_mb=2048 +disk_size_sector=$(expr $disk_size_mb \* 1024 \* 1024 / 512) +disk_image="/data/build/disk.img" +dd if=/dev/zero of="${disk_image}" bs="${disk_size_sector}" count=512 + +echo Creating disk partitions... +gpt_efi="ef00" +gpt_root_amd64="8304" +sgdisk \ + --new 1:2048:+200M \ + --typecode 1:"${gpt_efi}" \ + --change-name 1:ESP \ + --new 2:0:0 \ + --typecode 2:"${gpt_root_amd64}" \ + --change-name 1:ROOTFS \ + "${disk_image}" + +disk_layout=$(fdisk -l "${disk_image}") +echo "${disk_layout}" + +echo Attaching partitions to loopback devices... +efi_start=$(echo "${disk_layout}" -l "${disk_image}" | grep EFI | awk '{print $2}') +efi_size=$(echo "${disk_layout}" -l "${disk_image}" | grep EFI | awk '{print $4}') +root_start=$(echo "${disk_layout}" -l "${disk_image}" | grep root | awk '{print $2}') +root_size=$(echo "${disk_layout}" -l "${disk_image}" | grep root | awk '{print $4}') +efi_device=$(losetup --offset $((512*efi_start)) --sizelimit $((512*efi_size)) --show --find "${disk_image}") +root_device=$(losetup --offset $((512*root_start)) --sizelimit $((512*root_size)) --show --find "${disk_image}") + +echo Formatting partitions... +mkfs.vfat -n "ESP" "${efi_device}" +mkfs.ext4 -L "ROOTFS" "${root_device}" + +echo Mounting partitions... +efi_mount_point="/mnt/efi" +root_mount_point="/mnt/root" +mkdir -p "${efi_mount_point}" +mkdir -p "${root_mount_point}" +mount "${efi_device}" "${efi_mount_point}" +mount -t ext4 "${root_device}" "${root_mount_point}" + +echo Extracting rootfs... +tar -xf /data/build/rootfs.tar --directory "${root_mount_point}" + +echo Copying boot directory over to ESP partition... +cp -r "${root_mount_point}/boot/." "${efi_mount_point}" +tree "${efi_mount_point}" +echo + +echo Unmounting partitions... +umount "${root_mount_point}" +umount "${efi_mount_point}" + +echo Detaching loopback devices... +losetup --detach "${efi_device}" +losetup --detach "${root_device}" + +echo Done! \ No newline at end of file diff --git a/packages/usb-installer/builder.Dockerfile b/packages/usb-installer/builder.Dockerfile new file mode 100644 index 0000000000..5c6938b5a8 --- /dev/null +++ b/packages/usb-installer/builder.Dockerfile @@ -0,0 +1,4 @@ +FROM debian:bookworm + +RUN apt-get -y update +RUN apt-get -y install fdisk gdisk qemu-utils dosfstools tree \ No newline at end of file diff --git a/packages/usb-installer/run.sh b/packages/usb-installer/run.sh new file mode 100755 index 0000000000..5a317fd5d0 --- /dev/null +++ b/packages/usb-installer/run.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash +set -euo pipefail + +mkdir -p build +docker build -f umbrel-os.Dockerfile --platform linux/amd64 -t umbrel-os . +docker export -o build/rootfs.tar $(docker run -d umbrel-os /bin/true) +docker build -f builder.Dockerfile -t umbrel-os:builder . +docker run -it --entrypoint /data/build.sh -v $PWD:/data --privileged umbrel-os:builder + +# qemu-system-x86_64 -net nic -net user -machine accel=tcg -m 2048 -hda build/disk.img -bios OVMF.fd \ No newline at end of file diff --git a/packages/usb-installer/umbrel-os.Dockerfile b/packages/usb-installer/umbrel-os.Dockerfile new file mode 100644 index 0000000000..a022d24dce --- /dev/null +++ b/packages/usb-installer/umbrel-os.Dockerfile @@ -0,0 +1,53 @@ +FROM debian:bullseye + +RUN echo "root:root" | chpasswd + +RUN apt-get -y update + +# Install Linux kernel +RUN apt-get -y install linux-image-amd64 + +# Install systemd +RUN apt-get -y install systemd-sysv + +# Install bootloader +# We want the latest version of systemd-boot from backports +RUN echo "" >> /etc/apt/sources.list +RUN echo "deb http://deb.debian.org/debian bullseye-backports main contrib non-free" >> /etc/apt/sources.list +RUN echo "deb-src http://deb.debian.org/debian bullseye-backports main contrib non-free" >> /etc/apt/sources.list +RUN apt-get update -y +RUN apt-get install -y -t bullseye-backports systemd-boot + +# We can't install the bootloader via `bootctl install` from Docker because it complains +# about an invalid ESP partition. We can't easily fix it with loopback mounts from a Docker +# build environment. Instead we just manually install the bootloader to /boot and +# migrate /boot to an ESP partition in a post processing step outside of Docker. +RUN mkdir -p "/boot/EFI/systemd/" +RUN mkdir -p "/boot/EFI/BOOT/" +RUN cp "/usr/lib/systemd/boot/efi/systemd-bootx64.efi" "/boot/EFI/systemd/systemd-bootx64.efi" +RUN cp "/usr/lib/systemd/boot/efi/systemd-bootx64.efi" "/boot/EFI/BOOT/bootx64.efi" + +# Generate boot config +RUN mkdir -p "/boot/loader/entries" + +RUN echo " \n\ +title Debian \n\ +linux $(ls /boot/vmlinuz-* | sed 's/\/boot//') \n\ +initrd $(ls /boot/initrd.img* | sed 's/\/boot//') \n\ +options root=LABEL=ROOTFS rw" | tee "/boot/loader/entries/debian.conf" + +RUN echo " \n\ +default debian \n\ +timeout 1 \n\ +console-mode max \n\ +editor no" | tee "/boot/loader/loader.conf" + +# Verify boot status +RUN bootctl --esp-path=/boot status + +RUN adduser --gecos "" --disabled-password umbrel +RUN echo "umbrel:umbrel" | chpasswd +RUN usermod -aG sudo umbrel + +# Copy in filesystem overlay +COPY overlay / \ No newline at end of file From 6097fa84a9df4c854497620276e7a7a8af5639fb Mon Sep 17 00:00:00 2001 From: Luke Childs Date: Mon, 29 Apr 2024 22:06:01 +0700 Subject: [PATCH 02/11] Use bookworm --- packages/usb-installer/umbrel-os.Dockerfile | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/packages/usb-installer/umbrel-os.Dockerfile b/packages/usb-installer/umbrel-os.Dockerfile index a022d24dce..9687631a99 100644 --- a/packages/usb-installer/umbrel-os.Dockerfile +++ b/packages/usb-installer/umbrel-os.Dockerfile @@ -1,4 +1,4 @@ -FROM debian:bullseye +FROM debian:bookworm RUN echo "root:root" | chpasswd @@ -11,12 +11,7 @@ RUN apt-get -y install linux-image-amd64 RUN apt-get -y install systemd-sysv # Install bootloader -# We want the latest version of systemd-boot from backports -RUN echo "" >> /etc/apt/sources.list -RUN echo "deb http://deb.debian.org/debian bullseye-backports main contrib non-free" >> /etc/apt/sources.list -RUN echo "deb-src http://deb.debian.org/debian bullseye-backports main contrib non-free" >> /etc/apt/sources.list -RUN apt-get update -y -RUN apt-get install -y -t bullseye-backports systemd-boot +RUN apt-get install -y systemd-boot # We can't install the bootloader via `bootctl install` from Docker because it complains # about an invalid ESP partition. We can't easily fix it with loopback mounts from a Docker From e91522fff8562fab85c51a9f2831248afd05afa1 Mon Sep 17 00:00:00 2001 From: Luke Childs Date: Mon, 29 Apr 2024 22:32:36 +0700 Subject: [PATCH 03/11] Make image smaller --- packages/usb-installer/build.sh | 6 ++++-- packages/usb-installer/umbrel-os.Dockerfile | 12 +++--------- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/packages/usb-installer/build.sh b/packages/usb-installer/build.sh index c6ac662cbe..19b9242853 100755 --- a/packages/usb-installer/build.sh +++ b/packages/usb-installer/build.sh @@ -1,7 +1,9 @@ #!/usr/bin/env bash -echo Creating disk image... -disk_size_mb=2048 +echo "Creating disk image..." +rootfs_tar_size="$(du --block-size 1M /data/build/rootfs.tar | awk '{print $1}')" +rootfs_buffer="256" +disk_size_mb="$((rootfs_tar_size + rootfs_buffer))" disk_size_sector=$(expr $disk_size_mb \* 1024 \* 1024 / 512) disk_image="/data/build/disk.img" dd if=/dev/zero of="${disk_image}" bs="${disk_size_sector}" count=512 diff --git a/packages/usb-installer/umbrel-os.Dockerfile b/packages/usb-installer/umbrel-os.Dockerfile index 9687631a99..ee2ffa28c0 100644 --- a/packages/usb-installer/umbrel-os.Dockerfile +++ b/packages/usb-installer/umbrel-os.Dockerfile @@ -1,17 +1,11 @@ -FROM debian:bookworm +FROM debian:bookworm-slim RUN echo "root:root" | chpasswd RUN apt-get -y update -# Install Linux kernel -RUN apt-get -y install linux-image-amd64 - -# Install systemd -RUN apt-get -y install systemd-sysv - -# Install bootloader -RUN apt-get install -y systemd-boot +# Install Linux kernel, systemd and bootloader +RUN apt-get install --yes --no-install-recommends linux-image-amd64 systemd-sysv systemd-boot # We can't install the bootloader via `bootctl install` from Docker because it complains # about an invalid ESP partition. We can't easily fix it with loopback mounts from a Docker From 950c7883678de3ebd477ca4ae62fd543310d888a Mon Sep 17 00:00:00 2001 From: Luke Childs Date: Mon, 29 Apr 2024 22:37:24 +0700 Subject: [PATCH 04/11] Add safer buffer --- packages/usb-installer/build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/usb-installer/build.sh b/packages/usb-installer/build.sh index 19b9242853..1830f96304 100755 --- a/packages/usb-installer/build.sh +++ b/packages/usb-installer/build.sh @@ -2,7 +2,7 @@ echo "Creating disk image..." rootfs_tar_size="$(du --block-size 1M /data/build/rootfs.tar | awk '{print $1}')" -rootfs_buffer="256" +rootfs_buffer="512" disk_size_mb="$((rootfs_tar_size + rootfs_buffer))" disk_size_sector=$(expr $disk_size_mb \* 1024 \* 1024 / 512) disk_image="/data/build/disk.img" From 1b51d18b34f949ec742321619d9e92b7f16b17f3 Mon Sep 17 00:00:00 2001 From: Luke Childs Date: Tue, 30 Apr 2024 01:04:00 +0700 Subject: [PATCH 05/11] Add custom tty --- .../etc/systemd/system/custom-tty.service | 14 +++++++++++ packages/usb-installer/overlay/opt/custom-tty | 24 +++++++++++++++++++ packages/usb-installer/umbrel-os.Dockerfile | 12 ++++++---- 3 files changed, 46 insertions(+), 4 deletions(-) create mode 100644 packages/usb-installer/overlay/etc/systemd/system/custom-tty.service create mode 100755 packages/usb-installer/overlay/opt/custom-tty diff --git a/packages/usb-installer/overlay/etc/systemd/system/custom-tty.service b/packages/usb-installer/overlay/etc/systemd/system/custom-tty.service new file mode 100644 index 0000000000..1606ac64f3 --- /dev/null +++ b/packages/usb-installer/overlay/etc/systemd/system/custom-tty.service @@ -0,0 +1,14 @@ +[Unit] +Description=Custom TTY +After=multi-user.target + +[Service] +ExecStart=/opt/custom-tty +StandardInput=tty +StandardOutput=tty +StandardError=tty +TTYPath=/dev/tty1 +Restart=on-failure + +[Install] +WantedBy=multi-user.target diff --git a/packages/usb-installer/overlay/opt/custom-tty b/packages/usb-installer/overlay/opt/custom-tty new file mode 100755 index 0000000000..83869d497e --- /dev/null +++ b/packages/usb-installer/overlay/opt/custom-tty @@ -0,0 +1,24 @@ +#!/usr/bin/env bash + +sleep 1 + +clear + +cat << 'EOF' + + ,;###GGGGGGGGGGl#Sp + ,##GGGlW""^' '`""%GGGG#S, + ,#GGG" "lGG#o + #GGl^ '$GG# + ,#GGb \GGG, + lGG" "GGG + #GGGlGGGl##p,,p##lGGl##p,,p###ll##GGGG + !GGGlW"""*GGGGGGG#""""WlGGGGG#W""*WGGGGS + "" "^ '" "" +EOF + +choice="" + +read -p "Do you want to install the dotfiles? [y/n] " choice + +echo $choice \ No newline at end of file diff --git a/packages/usb-installer/umbrel-os.Dockerfile b/packages/usb-installer/umbrel-os.Dockerfile index ee2ffa28c0..552bf5dc63 100644 --- a/packages/usb-installer/umbrel-os.Dockerfile +++ b/packages/usb-installer/umbrel-os.Dockerfile @@ -5,7 +5,7 @@ RUN echo "root:root" | chpasswd RUN apt-get -y update # Install Linux kernel, systemd and bootloader -RUN apt-get install --yes --no-install-recommends linux-image-amd64 systemd-sysv systemd-boot +RUN apt-get install --yes --no-install-recommends linux-image-amd64 systemd-sysv systemd-boot xz-utils # We can't install the bootloader via `bootctl install` from Docker because it complains # about an invalid ESP partition. We can't easily fix it with loopback mounts from a Docker @@ -23,11 +23,11 @@ RUN echo " \n\ title Debian \n\ linux $(ls /boot/vmlinuz-* | sed 's/\/boot//') \n\ initrd $(ls /boot/initrd.img* | sed 's/\/boot//') \n\ -options root=LABEL=ROOTFS rw" | tee "/boot/loader/entries/debian.conf" +options root=LABEL=ROOTFS rw quiet loglevel=1" | tee "/boot/loader/entries/debian.conf" RUN echo " \n\ default debian \n\ -timeout 1 \n\ +timeout 0 \n\ console-mode max \n\ editor no" | tee "/boot/loader/loader.conf" @@ -39,4 +39,8 @@ RUN echo "umbrel:umbrel" | chpasswd RUN usermod -aG sudo umbrel # Copy in filesystem overlay -COPY overlay / \ No newline at end of file +COPY overlay / + +RUN systemctl enable custom-tty.service +RUN systemctl mask console-getty.service +RUN systemctl mask getty@tty1.service \ No newline at end of file From 809392cde0d2ea776fe3106681347648f2ee9155 Mon Sep 17 00:00:00 2001 From: Luke Childs Date: Tue, 30 Apr 2024 01:39:18 +0700 Subject: [PATCH 06/11] Interactivity --- packages/usb-installer/overlay/opt/custom-tty | 22 ++++++++++++++----- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/packages/usb-installer/overlay/opt/custom-tty b/packages/usb-installer/overlay/opt/custom-tty index 83869d497e..15a594b7f9 100755 --- a/packages/usb-installer/overlay/opt/custom-tty +++ b/packages/usb-installer/overlay/opt/custom-tty @@ -15,10 +15,20 @@ cat << 'EOF' #GGGlGGGl##p,,p##lGGl##p,,p###ll##GGGG !GGGlW"""*GGGGGGG#""""WlGGGGG#W""*WGGGGS "" "^ '" "" + umbrelOS USB Installer EOF - -choice="" - -read -p "Do you want to install the dotfiles? [y/n] " choice - -echo $choice \ No newline at end of file +echo +echo "Installing umbrelOS will wipe your entire storage device." +echo +readarray -t devices < <(lsblk --nodeps --output NAME,VENDOR,MODEL,SIZE | sed '1d') +PS3="Select a storage device by number to install umbrelOS on: " +select device in "${devices[@]}" +do + if [[ -n "$device" ]] + then + echo "installing umbrelOS on: $device" + break + else + echo "Invalid choice, please try again." + fi +done \ No newline at end of file From f7d3e3460497bf1ba742ec06ba8f0c542b47c3a9 Mon Sep 17 00:00:00 2001 From: Luke Childs Date: Tue, 30 Apr 2024 02:03:43 +0700 Subject: [PATCH 07/11] Embed umbrelOS image --- packages/usb-installer/run.sh | 2 +- packages/usb-installer/umbrel-os.Dockerfile | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/usb-installer/run.sh b/packages/usb-installer/run.sh index 5a317fd5d0..35dcbd754c 100755 --- a/packages/usb-installer/run.sh +++ b/packages/usb-installer/run.sh @@ -2,7 +2,7 @@ set -euo pipefail mkdir -p build -docker build -f umbrel-os.Dockerfile --platform linux/amd64 -t umbrel-os . +docker build -f umbrel-os.Dockerfile --platform linux/amd64 -t umbrel-os ../ docker export -o build/rootfs.tar $(docker run -d umbrel-os /bin/true) docker build -f builder.Dockerfile -t umbrel-os:builder . docker run -it --entrypoint /data/build.sh -v $PWD:/data --privileged umbrel-os:builder diff --git a/packages/usb-installer/umbrel-os.Dockerfile b/packages/usb-installer/umbrel-os.Dockerfile index 552bf5dc63..e27de3c5c7 100644 --- a/packages/usb-installer/umbrel-os.Dockerfile +++ b/packages/usb-installer/umbrel-os.Dockerfile @@ -39,7 +39,9 @@ RUN echo "umbrel:umbrel" | chpasswd RUN usermod -aG sudo umbrel # Copy in filesystem overlay -COPY overlay / +COPY usb-installer/overlay / + +COPY os/build/umbrelos-amd64.img.xz / RUN systemctl enable custom-tty.service RUN systemctl mask console-getty.service From 5d95df1d251c3deb9b1b6a581ba5dba5c59f2137 Mon Sep 17 00:00:00 2001 From: Luke Childs Date: Tue, 30 Apr 2024 02:54:20 +0700 Subject: [PATCH 08/11] Reduce size --- packages/usb-installer/umbrel-os.Dockerfile | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/packages/usb-installer/umbrel-os.Dockerfile b/packages/usb-installer/umbrel-os.Dockerfile index e27de3c5c7..1e5b585c67 100644 --- a/packages/usb-installer/umbrel-os.Dockerfile +++ b/packages/usb-installer/umbrel-os.Dockerfile @@ -41,8 +41,21 @@ RUN usermod -aG sudo umbrel # Copy in filesystem overlay COPY usb-installer/overlay / +# Copy in umbrelOS image COPY os/build/umbrelos-amd64.img.xz / +# Configure TTY services RUN systemctl enable custom-tty.service RUN systemctl mask console-getty.service -RUN systemctl mask getty@tty1.service \ No newline at end of file +RUN systemctl mask getty@tty1.service + +# Reduce size +# We have to do this extremely aggreseively because we're close to GitHub's 2GB release asset limit +RUN apt-get clean && rm -rf /var/lib/apt/lists/* /var/cache/apt/archives/* /tmp/* /usr/share/man /usr/share/doc /usr/share/info /var/log/* +RUN find / -name '*.a' -delete && \ + find / -name '*.so*' -exec strip --strip-debug {} \; +RUN rm -rf /usr/lib/modules/6.1.0-20-amd64/kernel/drivers/gpu +RUN rm -rf /usr/lib/modules/6.1.0-20-amd64/kernel/drivers/net +RUN rm -rf /usr/lib/modules/6.1.0-20-amd64/kernel/drivers/infiniband +RUN rm -rf /usr/lib/modules/6.1.0-20-amd64/kernel/net +RUN rm -rf /usr/lib/modules/6.1.0-20-amd64/kernel/sound \ No newline at end of file From dc22f89f1a6428cc4625f893e6e0541b8fbbda64 Mon Sep 17 00:00:00 2001 From: Luke Childs Date: Tue, 30 Apr 2024 02:57:56 +0700 Subject: [PATCH 09/11] Rename --- packages/usb-installer/build.sh | 2 +- packages/usb-installer/run.sh | 10 +++++----- .../{umbrel-os.Dockerfile => usb-installer.Dockerfile} | 0 3 files changed, 6 insertions(+), 6 deletions(-) rename packages/usb-installer/{umbrel-os.Dockerfile => usb-installer.Dockerfile} (100%) diff --git a/packages/usb-installer/build.sh b/packages/usb-installer/build.sh index 1830f96304..4d0f04be4e 100755 --- a/packages/usb-installer/build.sh +++ b/packages/usb-installer/build.sh @@ -5,7 +5,7 @@ rootfs_tar_size="$(du --block-size 1M /data/build/rootfs.tar | awk '{print $1}') rootfs_buffer="512" disk_size_mb="$((rootfs_tar_size + rootfs_buffer))" disk_size_sector=$(expr $disk_size_mb \* 1024 \* 1024 / 512) -disk_image="/data/build/disk.img" +disk_image="/data/build/umbrelos-amd64-usb-installer.img" dd if=/dev/zero of="${disk_image}" bs="${disk_size_sector}" count=512 echo Creating disk partitions... diff --git a/packages/usb-installer/run.sh b/packages/usb-installer/run.sh index 35dcbd754c..b0ee76e0d1 100755 --- a/packages/usb-installer/run.sh +++ b/packages/usb-installer/run.sh @@ -2,9 +2,9 @@ set -euo pipefail mkdir -p build -docker build -f umbrel-os.Dockerfile --platform linux/amd64 -t umbrel-os ../ -docker export -o build/rootfs.tar $(docker run -d umbrel-os /bin/true) -docker build -f builder.Dockerfile -t umbrel-os:builder . -docker run -it --entrypoint /data/build.sh -v $PWD:/data --privileged umbrel-os:builder +docker build -f usb-installer.Dockerfile --platform linux/amd64 -t usb-installer ../ +docker export -o build/rootfs.tar $(docker run -d usb-installer /bin/true) +docker build -f builder.Dockerfile -t usb-installer:builder . +docker run -it --entrypoint /data/build.sh -v $PWD:/data --privileged usb-installer:builder -# qemu-system-x86_64 -net nic -net user -machine accel=tcg -m 2048 -hda build/disk.img -bios OVMF.fd \ No newline at end of file +# qemu-system-x86_64 -net nic -net user -machine accel=tcg -m 2048 -hda build/umbrelos-amd64-usb-installer.img -bios OVMF.fd \ No newline at end of file diff --git a/packages/usb-installer/umbrel-os.Dockerfile b/packages/usb-installer/usb-installer.Dockerfile similarity index 100% rename from packages/usb-installer/umbrel-os.Dockerfile rename to packages/usb-installer/usb-installer.Dockerfile From 9437599c170e074ac2403841407121edddc7ff01 Mon Sep 17 00:00:00 2001 From: Luke Childs Date: Tue, 30 Apr 2024 03:20:22 +0700 Subject: [PATCH 10/11] Clean up Dockerfile --- .../usb-installer/usb-installer.Dockerfile | 28 ++++++++----------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/packages/usb-installer/usb-installer.Dockerfile b/packages/usb-installer/usb-installer.Dockerfile index 1e5b585c67..39ec84b690 100644 --- a/packages/usb-installer/usb-installer.Dockerfile +++ b/packages/usb-installer/usb-installer.Dockerfile @@ -34,21 +34,6 @@ editor no" | tee "/boot/loader/loader.conf" # Verify boot status RUN bootctl --esp-path=/boot status -RUN adduser --gecos "" --disabled-password umbrel -RUN echo "umbrel:umbrel" | chpasswd -RUN usermod -aG sudo umbrel - -# Copy in filesystem overlay -COPY usb-installer/overlay / - -# Copy in umbrelOS image -COPY os/build/umbrelos-amd64.img.xz / - -# Configure TTY services -RUN systemctl enable custom-tty.service -RUN systemctl mask console-getty.service -RUN systemctl mask getty@tty1.service - # Reduce size # We have to do this extremely aggreseively because we're close to GitHub's 2GB release asset limit RUN apt-get clean && rm -rf /var/lib/apt/lists/* /var/cache/apt/archives/* /tmp/* /usr/share/man /usr/share/doc /usr/share/info /var/log/* @@ -58,4 +43,15 @@ RUN rm -rf /usr/lib/modules/6.1.0-20-amd64/kernel/drivers/gpu RUN rm -rf /usr/lib/modules/6.1.0-20-amd64/kernel/drivers/net RUN rm -rf /usr/lib/modules/6.1.0-20-amd64/kernel/drivers/infiniband RUN rm -rf /usr/lib/modules/6.1.0-20-amd64/kernel/net -RUN rm -rf /usr/lib/modules/6.1.0-20-amd64/kernel/sound \ No newline at end of file +RUN rm -rf /usr/lib/modules/6.1.0-20-amd64/kernel/sound + +# Copy in umbrelOS image +COPY os/build/umbrelos-amd64.img.xz / + +# Copy in filesystem overlay +COPY usb-installer/overlay / + +# Configure TTY services +RUN systemctl enable custom-tty.service +RUN systemctl mask console-getty.service +RUN systemctl mask getty@tty1.service \ No newline at end of file From 73596233f8a0c7f46a317adf6fc5be54b7abce86 Mon Sep 17 00:00:00 2001 From: Luke Childs Date: Tue, 30 Apr 2024 03:39:51 +0700 Subject: [PATCH 11/11] Implement flash --- packages/usb-installer/overlay/opt/custom-tty | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/packages/usb-installer/overlay/opt/custom-tty b/packages/usb-installer/overlay/opt/custom-tty index 15a594b7f9..8ed1ae9c1d 100755 --- a/packages/usb-installer/overlay/opt/custom-tty +++ b/packages/usb-installer/overlay/opt/custom-tty @@ -27,6 +27,14 @@ do if [[ -n "$device" ]] then echo "installing umbrelOS on: $device" + device_path="/dev/$(echo $device | awk '{print $1}')" + xz --decompress --stdout /umbrelos-amd64.img.xz | dd of=$device_path bs=4M status=progress + sync + echo + echo "umbrelOS has been installed!" + printf "Press any key to shutdown, remember to remove the USB drive before turning the device back on." + read -n 1 -s + poweroff break else echo "Invalid choice, please try again."