chore: more clean up
This commit is contained in:
parent
529061df5e
commit
e5367bac84
2 changed files with 16 additions and 12 deletions
pkgs/rootfs
|
@ -19,17 +19,6 @@ ln -sf /etc/os-release ./etc/initrd-release
|
|||
# set default target to initrd inside initrd
|
||||
ln -sf initrd.target ./usr/lib/systemd/system/default.target
|
||||
|
||||
# generate crypttab and fstab under /run
|
||||
mkdir ./usr/lib/systemd/system/systemd-repart.service.d
|
||||
cat <<EOF > ./usr/lib/systemd/system/systemd-repart.service.d/override.conf
|
||||
[Unit]
|
||||
After=sysroot-run.mount
|
||||
Requires=sysroot-run.mount
|
||||
|
||||
[Service]
|
||||
ExecStart=systemd-repart --dry-run=no --generate-crypttab=/run/crypttab --generate-fstab=/run/fstab
|
||||
EOF
|
||||
|
||||
# bind mount /run to /sysroot/run
|
||||
cat <<EOF > ./usr/lib/systemd/system/sysroot-run.mount
|
||||
[Unit]
|
||||
|
@ -44,6 +33,19 @@ EOF
|
|||
mkdir ./usr/lib/systemd/system/initrd-fs.target.requires/
|
||||
ln -sf ../sysroot-run.mount ./usr/lib/systemd/system/initrd-fs.target.requires/sysroot-run.mount
|
||||
|
||||
# repart: generate crypttab and fstab under /run
|
||||
mkdir ./usr/lib/systemd/system/systemd-repart.service.d
|
||||
cat <<EOF > ./usr/lib/systemd/system/systemd-repart.service.d/override.conf
|
||||
[Unit]
|
||||
After=sysroot-run.mount
|
||||
Requires=sysroot-run.mount
|
||||
|
||||
[Service]
|
||||
Environment=SYSTEMD_REPART_MKFS_OPTIONS_BTRFS=--nodiscard
|
||||
ExecStart=
|
||||
ExecStart=systemd-repart --dry-run=no --generate-crypttab=/run/crypttab --generate-fstab=/run/fstab
|
||||
EOF
|
||||
|
||||
# gen initrd
|
||||
find . -print0 | cpio --null --owner=root:root -o --format=newc | xz -9 --check=crc32 > ../initrd.xz
|
||||
|
||||
|
|
|
@ -46,6 +46,7 @@ ExecStart=
|
|||
ExecStart=-/sbin/getty -L %I 115200 vt100
|
||||
EOF
|
||||
|
||||
# Configure systemd-repart
|
||||
cat <<EOF > $out/etc/repart.d/10-esp.conf
|
||||
[Partition]
|
||||
Type=esp
|
||||
|
@ -73,7 +74,7 @@ SplitName=-
|
|||
EOF
|
||||
|
||||
# as rootfs is read-only we need to configure the fstab and cryptsetup generators to look
|
||||
# for config under /run (which are generated by systemd-repart)
|
||||
# for config under /run (which are generated by systemd-repart in initrd)
|
||||
rm -f $out/etc/systemd/system.conf
|
||||
cat <<EOF > $out/etc/systemd/system.conf
|
||||
[Manager]
|
||||
|
@ -81,6 +82,7 @@ DefaultEnvironment=PATH=/bin:/sbin:/usr/bin
|
|||
ManagerEnvironment=PATH=/bin:/sbin:/usr/bin SYSTEMD_CRYPTTAB=/run/crypttab SYSTEMD_SYSROOT_FSTAB=/run/fstab SYSTEMD_FSTAB=/run/fstab
|
||||
EOF
|
||||
|
||||
# Overlay mount for /etc which makes it read-write in runtime
|
||||
cat <<EOF > $out/usr/lib/systemd/system/etc.mount
|
||||
[Unit]
|
||||
Description=Overlay mount for /etc
|
||||
|
|
Loading…
Add table
Reference in a new issue