Skip to content
This repository has been archived by the owner on Mar 30, 2021. It is now read-only.

Commit

Permalink
Provide option to patch static kernel config file
Browse files Browse the repository at this point in the history
This is useful in certain scenarios where we want to build a kernel
based off an existing config file but also apply slightly different
values during compilation. It doesnt always make sense to keep
maintaining lists of static configs for each set of tweaks. This commit
allows one to pass in an ansible variable file filled with config
directives.
  • Loading branch information
msheiny committed Jan 11, 2018
1 parent aca5d1a commit fd8679a
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
10 changes: 10 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,13 @@ grsecurity_build_gpg_keys_ubuntu:
fingerprint: DB5D7CCAF3994E3395DA4D3EE8675DEECBEECEA3
- name: Thadeu Lima de Souza Cascardo (Canonical)
fingerprint: 279357DB6127376E6D1DF1BCAAD56799FBFD0D3E

# Apply additional file of kernel configuration options
# to be applied to an existing configuration. Format of the file will be
# yaml with each directive per-line. An example might look like:
#
# CONFIG_HYPERVISOR_GUEST: y
# CONFIG_PARAVIRT: y
# CONFIG_XEN: y
# CONFIG_XEN_DOM0: y
grsecurity_build_custom_config_applydiff: ''
14 changes: 14 additions & 0 deletions tasks/configure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,20 @@
src: "{{ grsecurity_build_custom_config if grsecurity_build_custom_config != '' else 'config-'+grsecurity_build_strategy }}"
dest: "{{ grsecurity_build_linux_source_directory }}/.config"

- name: Load up kernel arguments from provided vars file
include_vars:
file: "{{ grsecurity_build_custom_config_applydiff }}"
name: _grsec_patch_config
when: grsecurity_build_custom_config_applydiff != ''

- name: Optionally patch the baseline config
lineinfile:
line: "{{ item.key }}={{ item.value }}"
regexp: "^{{ item.key }}="
dest: "{{ grsecurity_build_linux_source_directory }}/.config"
with_dict: "{{ _grsec_patch_config|default({}) }}"
when: grsecurity_build_custom_config_applydiff != ''

- name: Ensure any new options are updated with defaults.
command: make olddefconfig
args:
Expand Down

0 comments on commit fd8679a

Please sign in to comment.