Преглед на файлове

Make linux.system.kernel functional

tags/2016.12
Filip Pytloun преди 9 години
родител
ревизия
281034a655
променени са 2 файла, в които са добавени 49 реда и са изтрити 50 реда
  1. +27
    -0
      README.rst
  2. +22
    -50
      linux/system/kernel.sls

+ 27
- 0
README.rst Целия файл

@@ -134,6 +134,33 @@ Enable autologin on tty1 (may work only for Ubuntu 14.04):

To disable set autologin to `false`.

Kernel
~~~~~~

Install always up to date LTS kernel and headers from Ubuntu trusty:

.. code-block:: yaml

linux:
system:
kernel:
type: generic
lts: trusty
headers: true

Install specific kernel version and ensure all other kernel packages are
not present. Also install extra modules and headers for this kernel:

.. code-block:: yaml

linux:
system:
kernel:
type: generic
extra: true
headers: true
version: 4.2.0-22

Repositories
~~~~~~~~~~~~


+ 22
- 50
linux/system/kernel.sls Целия файл

@@ -3,71 +3,43 @@

{%- if system.kernel is defined %}

Basic kernel:

linux:
system:
kernel:
hold: true
versions:
generic:
headers: true


linux:
system:
kernel:
source:
engine: pkg
repo: from_repo
version: 1.13.42
hold: true
headers: true
generic: true

linux-headers-3.13.0-34
linux-image-3.13.0-34-generic
linux-headers-3.13.0-34-generic

{%- if system.kernel.get('source', {'engine': 'pkg'}).engine == 'pkg' %}

{%- if system.kernel.version is defined %}

linux_kernel_package:
pkg.installed:
- name: linux-image-{{ system.kernel.version }}
- names:
- linux-image-{{ system.kernel.version }}-{{ system.kernel.type|default('generic') }}
{%- if system.kernel.get('headers', False) %}
- linux-headers-{{ system.kernel.version }}-{{ system.kernel.type|default('generic') }}
{%- endif %}
{%- if system.kernel.get('extra', False) %}
- linux-extra-{{ system.kernel.version }}-{{ system.kernel.type|default('generic') }}
{%- endif %}
- refresh: true

{%- else %}

linux_kernel_package:
pkg.latest:
- name: linux-image-generic
- refresh: true

{%- endif %}

{%- if system.kernel.headers is defined %}
{%- if system.kernel.version is defined %}

linux_kernel_package:
pkg.installed:
- name: linux-image-{{ system.kernel.version }}
- version:
- refresh: true
# Not very Salt-ish.. :-(
linux_kernel_old_absent:
cmd.wait:
- name: "apt-get purge -y --no-input $(dpkg -l '*linux-image-[0-9]*' '*linux-headers-[0-9]*' '*linux-extra-[0-9]*' | grep -E '^ii' | awk '{print $2}' | grep -v '{{ system.kernel.version }}')"
- watch:
- pkg: linux_kernel_package

{%- else %}

linux_kernel_package:
pkg.latest:
- name: linux-image-generic
- names:
- linux-image-{{ system.kernel.type|default('generic') }}{% if system.kernel.get('lts', False) %}-lts-{{ system.kernel.lts }}{% endif %}
{%- if system.kernel.get('headers', False) %}
- linux-headers-{{ system.kernel.type|default('generic') }}{% if system.kernel.get('lts', False) %}-lts-{{ system.kernel.lts }}{% endif %}
{%- endif %}
{%- if system.kernel.get('extra', False) %}
- linux-extra-{{ system.kernel.type|default('generic') }}{% if system.kernel.get('lts', False) %}-lts-{{ system.kernel.lts }}{% endif %}
{%- endif %}
- refresh: true

{%- endif %}
{%- endif %}

{%- endif %}

{%- endif %}

{%- endif %}

Loading…
Отказ
Запис