Block packages in image-builder
This commit adds support for block packages via apt to image builder. Signed-off-by: Sreejith Punnapuzha <Sreejith.Punnapuzha@outlook.com> Change-Id: Ia7504504c4415b38af862429a9e1f51a50da0bae
This commit is contained in:
parent
9f71952feb
commit
0d53a12526
@ -71,6 +71,8 @@ ubuntu_packages:
|
|||||||
- wget
|
- wget
|
||||||
- xfsprogs
|
- xfsprogs
|
||||||
- xz-utils
|
- xz-utils
|
||||||
|
unapproved_packages: # provide the exact name of the packages that need to be blocked
|
||||||
|
- unattended-upgrades
|
||||||
repos:
|
repos:
|
||||||
- register_repo_with_rootfs: true
|
- register_repo_with_rootfs: true
|
||||||
name: Ubuntu
|
name: Ubuntu
|
||||||
|
@ -25,6 +25,11 @@
|
|||||||
suffix: multistrap
|
suffix: multistrap
|
||||||
register: multistrap_tempdir
|
register: multistrap_tempdir
|
||||||
|
|
||||||
|
- name: "Configure apt with unapproved packages"
|
||||||
|
template:
|
||||||
|
src: unapproved-packages.j2
|
||||||
|
dest: "{{ multistrap_tempdir.path }}/pref.conf"
|
||||||
|
|
||||||
- name: "write out multistrap config"
|
- name: "write out multistrap config"
|
||||||
template:
|
template:
|
||||||
src: multistrap.conf.j2
|
src: multistrap.conf.j2
|
||||||
@ -61,6 +66,18 @@
|
|||||||
# cmd: |
|
# cmd: |
|
||||||
# chroot {{ rootfs_root }} update-grub
|
# chroot {{ rootfs_root }} update-grub
|
||||||
|
|
||||||
|
- name: "Configure apt with unapproved packages"
|
||||||
|
template:
|
||||||
|
src: unapproved-packages.j2
|
||||||
|
dest: "{{ rootfs_root }}/etc/apt/preferences.d/unapproved-packages.pref"
|
||||||
|
|
||||||
|
- name: "Configure apt to remove unapproved packages from update"
|
||||||
|
ansible.builtin.lineinfile:
|
||||||
|
path: "{{ rootfs_root }}/etc/apt/apt.conf.d/01autoremove"
|
||||||
|
insertafter: "multiverse/metapackages"
|
||||||
|
line: ' "{{ item }}";'
|
||||||
|
with_items: "{{ unapproved_packages }}"
|
||||||
|
|
||||||
- name: "Lock sources.list to prevent conflict and duplicates with multistrap repo list"
|
- name: "Lock sources.list to prevent conflict and duplicates with multistrap repo list"
|
||||||
shell: |
|
shell: |
|
||||||
set -e
|
set -e
|
||||||
|
@ -14,6 +14,8 @@ unpack=true
|
|||||||
# enable MultiArch for the specified architectures
|
# enable MultiArch for the specified architectures
|
||||||
# default is empty
|
# default is empty
|
||||||
#multiarch=allowed
|
#multiarch=allowed
|
||||||
|
# apt preferences file
|
||||||
|
aptpreferences=pref.conf
|
||||||
# the order of sections is not important.
|
# the order of sections is not important.
|
||||||
# the bootstrap option determines which repository
|
# the bootstrap option determines which repository
|
||||||
# is used to calculate the list of Priority: required packages.
|
# is used to calculate the list of Priority: required packages.
|
||||||
|
@ -0,0 +1,6 @@
|
|||||||
|
{% for package in unapproved_packages %}
|
||||||
|
Package: {{ package }}
|
||||||
|
Pin: origin *
|
||||||
|
Pin-Priority: -1
|
||||||
|
|
||||||
|
{% endfor %}
|
Loading…
x
Reference in New Issue
Block a user