Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cloud-Init support #797

Draft
wants to merge 4 commits into
base: arm64
Choose a base branch
from
Draft

Cloud-Init support #797

wants to merge 4 commits into from

Conversation

paulober
Copy link

@paulober paulober commented Oct 9, 2024

This PR adds basic cloud-init support to Raspberry Pi OS.

install -v -m 755 files/cloud-init-custom.deb "${ROOTFS_DIR}/tmp/cloud-init.deb"

on_chroot << EOF
SUDO_USER="${FIRST_USER_NAME}" dpkg -i /tmp/cloud-init.deb || true
Copy link
Member

@XECDesign XECDesign Oct 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This won't be relevant when we update the package in our repo, so this is just a general heads up. Instead of using dpkg -i and following it up with apt, you could use apt-get install -y /tmp/cloud-init.deb directly and that will resolve dependencies and install the relevant packages in one step. The trick is that apt-get assumes that you're giving it package names unless it detects that you're giving it a path. I'm guessing it's checking for the presence of a / character, so if the file is in the current directory you'd use ./file.deb.

You could probably even just put '/tmp/cloud-init.deb' in 02-packages, but I haven't tried that, so I'm not sure.

As is, using || true means you ignore potential legitimate errors. Also, we normally nudge people towards apt rather than apt-get because it's more user friendly and handles some things automatically which apt-get doesn't, but in non-interactive scripts such as this one, apt-get is still the way to go. In other words, apt-get for scripting and apt otherwise.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, thanks for explaining. I'll update this for the current state.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just tried it and when using apt-get install -y /tmp/cloud-init.deb I got a message Note: using cloud-init instead of /tmp/cloud-init.deb

Copy link
Member

@XECDesign XECDesign Oct 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm guessing the package was updated without bumping the version number? We normally add +rpt1 to the version string to signify that it contains our patches.

@paulober
Copy link
Author

Ref to required PR before merge: canonical/cloud-init#5827

Also requires custom NetworkManager and custom cloud-init package in Raspberry Pi OS repositories.

Signed-off-by: paulober <44974737+paulober@users.noreply.github.com>
Signed-off-by: paulober <44974737+paulober@users.noreply.github.com>
Signed-off-by: paulober <44974737+paulober@users.noreply.github.com>
Signed-off-by: paulober <44974737+paulober@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants