Skip to content

Commit 861da8b

Browse files
authored
Merge pull request #22 from lima-vm/lima-overlay
Add `lima-overlay` service running before `lima/cloud-init-local`
2 parents b56b3be + c3e5052 commit 861da8b

File tree

1 file changed

+22
-9
lines changed

1 file changed

+22
-9
lines changed

genapkovl-lima.sh

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -73,19 +73,32 @@ rc_add networking default
7373

7474
rc_add sshd default
7575

76-
rc_add local default
76+
# lima-overlay must run with the boot filesystem, so has to run before
77+
# cloud-init or lima-init because the boot script will remap /etc and
78+
# /var/lib to the data volume.
79+
80+
mkdir -p "${tmp}/etc/init.d/"
81+
makefile root:root 0755 "$tmp/etc/init.d/lima-overlay" << EOF
82+
#!/sbin/openrc-run
83+
84+
depend() {
85+
after localmount
86+
before cloud-init-local lima-init-local sshd
87+
provide lima-overlay
88+
}
7789
78-
mkdir -p "${tmp}/etc/local.d/"
79-
makefile root:root 0755 "$tmp/etc/local.d/lima.start" << EOF
80-
sed -i 's/#UsePAM no/UsePAM yes/g' /etc/ssh/sshd_config
81-
rc-service --ifstarted sshd reload
90+
start() {
91+
sed -i 's/#UsePAM no/UsePAM yes/g' /etc/ssh/sshd_config
8292
83-
if ! grep -q BUILD_ID /etc/os-release; then
84-
echo "BUILD_ID=\"${LIMA_BUILD_ID}\"" >> /etc/os-release
85-
echo "VARIANT_ID=\"${LIMA_VARIANT_ID}\"" >> /etc/os-release
86-
fi
93+
echo "BUILD_ID=\"${LIMA_BUILD_ID}\"" >> /etc/os-release
94+
echo "VARIANT_ID=\"${LIMA_VARIANT_ID}\"" >> /etc/os-release
95+
96+
eend 0
97+
}
8798
EOF
8899

100+
rc_add lima-overlay default
101+
89102
mkdir -p "$tmp"/etc/pam.d
90103
cp /home/build/sshd.pam "${tmp}/etc/pam.d/sshd"
91104

0 commit comments

Comments
 (0)