feat(image): make /var stateful

This commit is contained in:
Lars Sjöström 2025-02-25 13:39:02 +01:00
parent e196cf729c
commit e4ebf7ea7f
No known key found for this signature in database
2 changed files with 44 additions and 2 deletions

View file

@ -1,7 +1,7 @@
set -ex -o pipefail
mkdir -p $out
mkdir -p $out/etc $out/dev $out/proc $out/sys $out/tmp $out/root $out/run $out/boot
mkdir -p $out/etc/repart.d $out/dev $out/proc $out/sys $out/tmp $out/root $out/run $out/boot
ln -sf ../usr/bin $out/bin
ln -sf ../usr/bin $out/sbin
ln -sf ../usr/lib $out/lib
@ -27,6 +27,31 @@ VERSION_CODENAME=pre-alpha
VERSION_ID="0.0.1"
EOF
sed -i 's#After=\(.*\)#After=sysroot.mount \1#' $out/usr/lib/systemd/system/systemd-repart.service
cat <<EOF > $out/etc/repart.d/10-esp.conf
[Partition]
Type=esp
Format=vfat
EOF
cat <<EOF > $out/etc/repart.d/22-root.conf
[Partition]
Type=root
EOF
#FIXME: use btrfs instead on ext2(busybox) but need the btrfs tools in rootfs.
cat <<EOF > $out/etc/repart.d/40-var.conf
[Partition]
Type=var
UUID=4d21b016-b534-45c2-a9fb-5c16e091fd2d
Format=ext2
Label=patos-state
Minimize=off
FactoryReset=yes
SizeMinBytes=1G
SplitName=-
EOF
### install PatOS glibc
cp -P $glibcPatos/lib/*.so* $out/usr/lib/