diff --git a/images/capi/packer/qemu/linux/ubuntu/http/22.04.efi.qemu/user-data.tmpl b/images/capi/packer/qemu/linux/ubuntu/http/22.04.efi.qemu/user-data.tmpl index 9969ff5116..12d6ee159b 100644 --- a/images/capi/packer/qemu/linux/ubuntu/http/22.04.efi.qemu/user-data.tmpl +++ b/images/capi/packer/qemu/linux/ubuntu/http/22.04.efi.qemu/user-data.tmpl @@ -101,8 +101,8 @@ autoinstall: late-commands: - apt install -y efibootmgr - efibootmgr -o $(efibootmgr | grep -oP 'Boot[0-9]+[*]\s+ubuntu' | grep -oP '000[0-9]+' | head -n 1) - - swapoff -a - - rm -f /swapfile - - sed -ri '/\sswap\s/s/^#?/#/' /etc/fstab - - apt-get purge --auto-remove -y - - rm -rf /var/lib/apt/lists/* + - curtin in-target --target=/target -- swapoff -a + - curtin in-target --target=/target -- rm -f /swap.img + - curtin in-target --target=/target -- sed -ri '/\sswap\s/s/^#?/#/' /etc/fstab + - curtin in-target --target=/target -- apt-get purge --auto-remove -y + - curtin in-target --target=/target -- apt-get clean diff --git a/images/capi/packer/qemu/linux/ubuntu/http/22.04.efi/user-data.tmpl b/images/capi/packer/qemu/linux/ubuntu/http/22.04.efi/user-data.tmpl index 39472f51ff..4f99c15587 100644 --- a/images/capi/packer/qemu/linux/ubuntu/http/22.04.efi/user-data.tmpl +++ b/images/capi/packer/qemu/linux/ubuntu/http/22.04.efi/user-data.tmpl @@ -99,8 +99,8 @@ autoinstall: # 4. Cleans up any packages that are no longer required # 5. Removes the cached list of packages late-commands: - - swapoff -a - - rm -f /swapfile - - sed -ri '/\sswap\s/s/^#?/#/' /etc/fstab - - apt-get purge --auto-remove -y - - rm -rf /var/lib/apt/lists/* + - curtin in-target --target=/target -- swapoff -a + - curtin in-target --target=/target -- rm -f /swap.img + - curtin in-target --target=/target -- sed -ri '/\sswap\s/s/^#?/#/' /etc/fstab + - curtin in-target --target=/target -- apt-get purge --auto-remove -y + - curtin in-target --target=/target -- apt-get clean diff --git a/images/capi/packer/qemu/linux/ubuntu/http/22.04/user-data.tmpl b/images/capi/packer/qemu/linux/ubuntu/http/22.04/user-data.tmpl index 8e49bd6d01..6c36a9b9a2 100644 --- a/images/capi/packer/qemu/linux/ubuntu/http/22.04/user-data.tmpl +++ b/images/capi/packer/qemu/linux/ubuntu/http/22.04/user-data.tmpl @@ -79,8 +79,8 @@ autoinstall: # 4. Cleans up any packages that are no longer required # 5. Removes the cached list of packages late-commands: - - swapoff -a - - rm -f /swapfile - - sed -ri '/\sswap\s/s/^#?/#/' /etc/fstab - - apt-get purge --auto-remove -y - - rm -rf /var/lib/apt/lists/* + - curtin in-target --target=/target -- swapoff -a + - curtin in-target --target=/target -- rm -f /swap.img + - curtin in-target --target=/target -- sed -ri '/\sswap\s/s/^#?/#/' /etc/fstab + - curtin in-target --target=/target -- apt-get purge --auto-remove -y + - curtin in-target --target=/target -- apt-get clean diff --git a/images/capi/packer/qemu/linux/ubuntu/http/23.04/user-data.tmpl b/images/capi/packer/qemu/linux/ubuntu/http/23.04/user-data.tmpl index 30edc45b19..6fa587cacb 100644 --- a/images/capi/packer/qemu/linux/ubuntu/http/23.04/user-data.tmpl +++ b/images/capi/packer/qemu/linux/ubuntu/http/23.04/user-data.tmpl @@ -86,8 +86,8 @@ autoinstall: # 4. Cleans up any packages that are no longer required # 5. Removes the cached list of packages late-commands: - - swapoff -a - - rm -f /swapfile - - sed -ri '/\sswap\s/s/^#?/#/' /etc/fstab - - apt-get purge --auto-remove -y - - rm -rf /var/lib/apt/lists/* + - curtin in-target --target=/target -- swapoff -a + - curtin in-target --target=/target -- rm -f /swap.img + - curtin in-target --target=/target -- sed -ri '/\sswap\s/s/^#?/#/' /etc/fstab + - curtin in-target --target=/target -- apt-get purge --auto-remove -y + - curtin in-target --target=/target -- apt-get clean diff --git a/images/capi/packer/qemu/linux/ubuntu/http/24.04.efi/user-data.tmpl b/images/capi/packer/qemu/linux/ubuntu/http/24.04.efi/user-data.tmpl index 0d43ca5e1b..f7ea50ed07 100644 --- a/images/capi/packer/qemu/linux/ubuntu/http/24.04.efi/user-data.tmpl +++ b/images/capi/packer/qemu/linux/ubuntu/http/24.04.efi/user-data.tmpl @@ -109,8 +109,8 @@ autoinstall: # 4. Cleans up any packages that are no longer required # 5. Removes the cached list of packages late-commands: - - swapoff -a - - rm -f /swapfile - - sed -ri '/\sswap\s/s/^#?/#/' /etc/fstab - - apt-get purge --auto-remove -y - - rm -rf /var/lib/apt/lists/* + - curtin in-target --target=/target -- swapoff -a + - curtin in-target --target=/target -- rm -f /swap.img + - curtin in-target --target=/target -- sed -ri '/\sswap\s/s/^#?/#/' /etc/fstab + - curtin in-target --target=/target -- apt-get purge --auto-remove -y + - curtin in-target --target=/target -- apt-get clean diff --git a/images/capi/packer/qemu/linux/ubuntu/http/24.04/user-data.tmpl b/images/capi/packer/qemu/linux/ubuntu/http/24.04/user-data.tmpl index 30edc45b19..6fa587cacb 100644 --- a/images/capi/packer/qemu/linux/ubuntu/http/24.04/user-data.tmpl +++ b/images/capi/packer/qemu/linux/ubuntu/http/24.04/user-data.tmpl @@ -86,8 +86,8 @@ autoinstall: # 4. Cleans up any packages that are no longer required # 5. Removes the cached list of packages late-commands: - - swapoff -a - - rm -f /swapfile - - sed -ri '/\sswap\s/s/^#?/#/' /etc/fstab - - apt-get purge --auto-remove -y - - rm -rf /var/lib/apt/lists/* + - curtin in-target --target=/target -- swapoff -a + - curtin in-target --target=/target -- rm -f /swap.img + - curtin in-target --target=/target -- sed -ri '/\sswap\s/s/^#?/#/' /etc/fstab + - curtin in-target --target=/target -- apt-get purge --auto-remove -y + - curtin in-target --target=/target -- apt-get clean diff --git a/images/capi/packer/qemu/linux/ubuntu/http/26.04.efi/user-data.tmpl b/images/capi/packer/qemu/linux/ubuntu/http/26.04.efi/user-data.tmpl index 0d43ca5e1b..f7ea50ed07 100644 --- a/images/capi/packer/qemu/linux/ubuntu/http/26.04.efi/user-data.tmpl +++ b/images/capi/packer/qemu/linux/ubuntu/http/26.04.efi/user-data.tmpl @@ -109,8 +109,8 @@ autoinstall: # 4. Cleans up any packages that are no longer required # 5. Removes the cached list of packages late-commands: - - swapoff -a - - rm -f /swapfile - - sed -ri '/\sswap\s/s/^#?/#/' /etc/fstab - - apt-get purge --auto-remove -y - - rm -rf /var/lib/apt/lists/* + - curtin in-target --target=/target -- swapoff -a + - curtin in-target --target=/target -- rm -f /swap.img + - curtin in-target --target=/target -- sed -ri '/\sswap\s/s/^#?/#/' /etc/fstab + - curtin in-target --target=/target -- apt-get purge --auto-remove -y + - curtin in-target --target=/target -- apt-get clean diff --git a/images/capi/packer/qemu/linux/ubuntu/http/26.04/user-data.tmpl b/images/capi/packer/qemu/linux/ubuntu/http/26.04/user-data.tmpl index 30edc45b19..6fa587cacb 100644 --- a/images/capi/packer/qemu/linux/ubuntu/http/26.04/user-data.tmpl +++ b/images/capi/packer/qemu/linux/ubuntu/http/26.04/user-data.tmpl @@ -86,8 +86,8 @@ autoinstall: # 4. Cleans up any packages that are no longer required # 5. Removes the cached list of packages late-commands: - - swapoff -a - - rm -f /swapfile - - sed -ri '/\sswap\s/s/^#?/#/' /etc/fstab - - apt-get purge --auto-remove -y - - rm -rf /var/lib/apt/lists/* + - curtin in-target --target=/target -- swapoff -a + - curtin in-target --target=/target -- rm -f /swap.img + - curtin in-target --target=/target -- sed -ri '/\sswap\s/s/^#?/#/' /etc/fstab + - curtin in-target --target=/target -- apt-get purge --auto-remove -y + - curtin in-target --target=/target -- apt-get clean