Skip to content

Commit 9da8978

Browse files
committed
openbsd: run cloud-init from /etc/rc.local
- do not modify the system /etc/rc. - print the logs in the serial console
1 parent 33eff42 commit 9da8978

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

plugins/package/cloud-init/tasks/77-cloud-init.sh

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,12 @@ done
2323
chroot $TARGET ldconfig /usr/local/lib
2424
PKG_PATH="https://mirror.csclub.uwaterloo.ca/pub/OpenBSD/${OS_VERSION}/packages/amd64/" chroot $TARGET sh -c 'cd /tmp/cloud-init; ./tools/build-on-openbsd'
2525

26-
gsed -i "/^echo 'starting network'/i \/usr\/local\/bin\/cloud-init --debug init -l" $TARGET/etc/rc
27-
gsed -i "/^reorder_libs$/i \/usr\/local\/bin\/cloud-init --debug init" $TARGET/etc/rc
28-
gsed -i "/.*rc.local.*/i \/usr\/local\/bin\/cloud-init --debug modules --mode config" $TARGET/etc/rc
29-
gsed -i "/^date/i \/usr\/local\/bin\/cloud-init --debug modules --mode final" $TARGET/etc/rc
30-
31-
cat $TARGET/etc/rc
26+
echo "#!/bin/sh" > $TARGET/etc/rc.local
27+
echo "/usr/local/bin/cloud-init init -l" >> $TARGET/etc/rc.local
28+
echo "/usr/local/bin/cloud-init init" >> $TARGET/etc/rc.local
29+
echo "/usr/local/bin/cloud-init modules --mode config" >> $TARGET/etc/rc.local
30+
echo "/usr/local/bin/cloud-init modules --mode final" >> $TARGET/etc/rc.local
31+
cat /var/log/cloud-init.log > /dev/tty00
32+
echo "exit 0" >> $TARGET/etc/rc.local
3233

3334
rm -r $TARGET/tmp/cloud-init

0 commit comments

Comments
 (0)