diff options
-rw-r--r-- | host/initramfs/extfs.nix | 16 | ||||
-rw-r--r-- | host/rootfs/etc/s6-rc/ext/up | 1 |
2 files changed, 12 insertions, 5 deletions
diff --git a/host/initramfs/extfs.nix b/host/initramfs/extfs.nix index dec4017..5c5850f 100644 --- a/host/initramfs/extfs.nix +++ b/host/initramfs/extfs.nix @@ -1,7 +1,7 @@ # SPDX-FileCopyrightText: 2021-2022 Alyssa Ross <hi@alyssa.is> # SPDX-License-Identifier: MIT -{ config, runCommand, tar2ext4 }: +{ config, runCommand, e2fsprogs, tar2ext4 }: let netvm = import ../../vm/sys/net { @@ -14,9 +14,10 @@ let in runCommand "ext.ext4" { - nativeBuildInputs = [ tar2ext4 ]; + nativeBuildInputs = [ e2fsprogs ]; } '' - mkdir -p svc/data/appvm-{catgirl,lynx} + mkdir -p root/svc/data/appvm-{catgirl,lynx} + cd root tar -C ${netvm} -c data | tar -C svc -x chmod +w svc/data @@ -24,6 +25,11 @@ runCommand "ext.ext4" { tar -C ${appvm-catgirl} -c . | tar -C svc/data/appvm-catgirl -x tar -C ${appvm-lynx} -c . | tar -C svc/data/appvm-lynx -x - tar -cf ext.tar svc - tar2ext4 -i ext.tar -o $out + mkfs.ext4 -d . $out 16T + resize2fs -M $out + + # The generated image will have all files owned by the uid and gid + # mkfs.ext4 was run as, so we need to normalize ownership to root. + find -exec echo $'set_inode_field {} uid 0\nset_inode_field {} gid 0' ';' | + debugfs -wf - $out '' diff --git a/host/rootfs/etc/s6-rc/ext/up b/host/rootfs/etc/s6-rc/ext/up index c189471..78b2637 100644 --- a/host/rootfs/etc/s6-rc/ext/up +++ b/host/rootfs/etc/s6-rc/ext/up @@ -2,5 +2,6 @@ # SPDX-FileCopyrightText: 2021-2022 Alyssa Ross <hi@alyssa.is> if { /etc/mdev/wait ext } +foreground { fsck.ext4 -fp /dev/ext } if { resize2fs /dev/ext } mount /dev/ext /ext |