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

Ubuntu: PR 20231109b #161

Merged
merged 6 commits into from
Nov 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions ubuntu/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ packer build -var customize_script=my-changes.sh -var ubuntu_series=jammy \
the VM. For example, you can install packages using `apt-get`, call out to
ansible, or whatever you want.

Building using make:

```shell
make custom-cloudimg.tar.gz SERIES=jammy
```

#### Accessing external files from you script

If you want to put or use some files in the image, you can put those in the `http` directory.
Expand Down
6 changes: 5 additions & 1 deletion ubuntu/scripts/cloudimg/cleanup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# cleanup.sh - Clean up what we did to be able to build the image.
#
# Copyright (C) 2022 Canonical
# Copyright (C) 2023 Canonical
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
Expand Down Expand Up @@ -32,3 +32,7 @@ sed -i s/^root:[^:]*/root:*/ /etc/shadow
rm -r /root/.ssh
rm -r /root/.cache
rm -r /etc/ssh/ssh_host_*

# Final Clean-up
apt-get autoremove --purge -yq
apt-get clean -yq
7 changes: 4 additions & 3 deletions ubuntu/scripts/cloudimg/setup-boot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# setup-boot.sh - Set up the image after initial boot
#
# Copyright (C) 2022 Canonical
# Copyright (C) 2023 Canonical
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
Expand Down Expand Up @@ -31,9 +31,10 @@ fi
# Reset cloud-init, so that it can run again when MAAS deploy the image.
cloud-init clean --logs

# Update apt listins first as they might be stale
apt-get update -q

# The cloud image for qemu has a kernel already. Remove it, since the user
# should either install a kernel in the customize script, or let MAAS install
# the right kernel when deploying.
apt-get remove --purge -y linux-virtual 'linux-image-*'
apt-get autoremove --purge -yq
apt-get clean -yq
3 changes: 2 additions & 1 deletion ubuntu/scripts/setup-bootloader
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#
# Author: Alexsander de Souza <[email protected]>
#
# Copyright (C) 2021 Canonical
# Copyright (C) 2023 Canonical
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
Expand All @@ -25,6 +25,7 @@ export DEBIAN_FRONTEND=noninteractive
rm /var/cache/debconf/config.dat
dpkg --configure -a

# Ensure the existence of linux-image-generic for non-cloudimg images.
apt-get -y install linux-image-generic

grub-install \
Expand Down
2 changes: 1 addition & 1 deletion ubuntu/ubuntu-cloudimg.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ source "qemu" "cloudimg" {
boot_wait = "2s"
cpus = 2
disk_image = true
disk_size = "4G"
disk_size = "6G"
format = "qcow2"
headless = var.headless
http_directory = var.http_directory
Expand Down