Skip to content

Commit

Permalink
openbsd: run cloud-init from /etc/rc.local
Browse files Browse the repository at this point in the history
- do not modify the system /etc/rc.
- print the logs in the serial console
  • Loading branch information
goneri committed Dec 4, 2021
1 parent 33eff42 commit 9da8978
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions plugins/package/cloud-init/tasks/77-cloud-init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,12 @@ done
chroot $TARGET ldconfig /usr/local/lib
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'

gsed -i "/^echo 'starting network'/i \/usr\/local\/bin\/cloud-init --debug init -l" $TARGET/etc/rc
gsed -i "/^reorder_libs$/i \/usr\/local\/bin\/cloud-init --debug init" $TARGET/etc/rc
gsed -i "/.*rc.local.*/i \/usr\/local\/bin\/cloud-init --debug modules --mode config" $TARGET/etc/rc
gsed -i "/^date/i \/usr\/local\/bin\/cloud-init --debug modules --mode final" $TARGET/etc/rc

cat $TARGET/etc/rc
echo "#!/bin/sh" > $TARGET/etc/rc.local
echo "/usr/local/bin/cloud-init init -l" >> $TARGET/etc/rc.local
echo "/usr/local/bin/cloud-init init" >> $TARGET/etc/rc.local
echo "/usr/local/bin/cloud-init modules --mode config" >> $TARGET/etc/rc.local
echo "/usr/local/bin/cloud-init modules --mode final" >> $TARGET/etc/rc.local
cat /var/log/cloud-init.log > /dev/tty00
echo "exit 0" >> $TARGET/etc/rc.local

rm -r $TARGET/tmp/cloud-init

0 comments on commit 9da8978

Please sign in to comment.