From df342efd348d37fd4d0218d767650813a6d0c6f3 Mon Sep 17 00:00:00 2001 From: Alan Baghumian Date: Tue, 14 Nov 2023 12:30:15 -0800 Subject: [PATCH] Ubuntu: PR 20231109b (#161) Some minor housekeeping, updated copyright years, added some comments and moved clean-up commands to its respective script. --- ubuntu/scripts/cloudimg/cleanup.sh | 6 +++++- ubuntu/scripts/cloudimg/setup-boot.sh | 7 ++++--- ubuntu/scripts/setup-bootloader | 3 ++- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/ubuntu/scripts/cloudimg/cleanup.sh b/ubuntu/scripts/cloudimg/cleanup.sh index 996e1b07..4c0247fd 100644 --- a/ubuntu/scripts/cloudimg/cleanup.sh +++ b/ubuntu/scripts/cloudimg/cleanup.sh @@ -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 @@ -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 diff --git a/ubuntu/scripts/cloudimg/setup-boot.sh b/ubuntu/scripts/cloudimg/setup-boot.sh index 8cd36d1d..01ecad88 100644 --- a/ubuntu/scripts/cloudimg/setup-boot.sh +++ b/ubuntu/scripts/cloudimg/setup-boot.sh @@ -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 @@ -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 diff --git a/ubuntu/scripts/setup-bootloader b/ubuntu/scripts/setup-bootloader index 5dd7af1f..aec7f461 100644 --- a/ubuntu/scripts/setup-bootloader +++ b/ubuntu/scripts/setup-bootloader @@ -4,7 +4,7 @@ # # Author: Alexsander de Souza # -# 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 @@ -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 \