feat(image): add overlay to /etc and use busybox getty for login prompt

This commit is contained in:
Lars Sjöström 2025-02-25 21:54:42 +01:00
parent 3374541b3a
commit 0ed83a6d27
No known key found for this signature in database
2 changed files with 20 additions and 27 deletions

View file

@ -1,7 +1,7 @@
set -ex -o pipefail
mkdir -p $out
mkdir -p $out/etc/repart.d $out/dev $out/proc $out/sys $out/tmp $out/root $out/run $out/boot $out/mnt
mkdir -p $out/etc/repart.d $out/dev $out/proc $out/sys $out/tmp $out/root $out/run $out/boot $out/mnt $out/home $out/srv
ln -sf ../usr/bin $out/bin
ln -sf ../usr/bin $out/sbin
ln -sf ../usr/lib $out/lib
@ -29,6 +29,9 @@ VERSION_ID={version}
BUILD_ID={version}
EOF
# replace agetty with busybox getty
sed -i 's#ExecStart=.*#ExecStart=-/sbin/getty -L %I 115200 vt100#' $out/usr/lib/systemd/system/serial-getty@.service
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]
@ -68,6 +71,21 @@ Options=defaults
WantedBy=multi-user.target
EOF
cat <<EOF > $out/usr/lib/systemd/system/etc.mount
[Unit]
Description=Overlay mount for /etc
Before=local-fs.target
[Mount]
What=overlay
Where=/etc
Type=overlay
Options=lowerdir=/etc,upperdir=/run/.rw-etc/upper,workdir=/run/.rw-etc/work
[Install]
WantedBy=local-fs.target
EOF
### install PatOS glibc
cp -P $glibcPatos/lib/*.so* $out/usr/lib/