feat(image): make /var stateful
This commit is contained in:
parent
e196cf729c
commit
e4ebf7ea7f
2 changed files with 44 additions and 2 deletions
|
@ -13,11 +13,28 @@ find rootfs/ -type d -exec chmod 755 {} \;
|
|||
mkdir rootfs/usr/lib/systemd/system/basic.target.wants
|
||||
ln -sf basic.target rootfs/usr/lib/systemd/system/default.target
|
||||
|
||||
# mount patos state
|
||||
cat <<EOF > rootfs/usr/lib/systemd/system/var.mount
|
||||
[Unit]
|
||||
Description=Mount for /var
|
||||
Before=local-fs.target
|
||||
|
||||
[Mount]
|
||||
What=/dev/disk/by-label/patos-state
|
||||
Where=/var
|
||||
Type=ext2
|
||||
Options=defaults
|
||||
|
||||
[Install]
|
||||
WantedBy=basic.target
|
||||
EOF
|
||||
ln -sf ../var.mount rootfs/usr/lib/systemd/system/basic.target.wants/var.mount
|
||||
|
||||
# enable dbus
|
||||
ln -sf ../dbus.service rootfs/usr/lib/systemd/system/basic.target.wants/dbus.service
|
||||
ln -sf ../dbus.socket rootfs/usr/lib/systemd/system/sockets.target.wants/dbus.socket
|
||||
|
||||
# generate machine-id
|
||||
# generate a temporary machine id
|
||||
$systemd/usr/bin/systemd-machine-id-setup --root=rootfs/
|
||||
|
||||
cat <<EOF > rootfs/etc/passwd
|
||||
|
|
|
@ -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/
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue