Merge "Handle kernel boot options"
diff --git a/README.rst b/README.rst
index 6f67de2..59750a2 100644
--- a/README.rst
+++ b/README.rst
@@ -341,6 +341,41 @@
             mode: 700
             makedirs: true
 
+Ensure presence of file by specifying it's source:
+
+.. code-block:: yaml
+
+    linux:
+      system:
+        file:
+          /tmp/test.txt:
+            source: http://example.com/test.txt
+            user: root
+            group: root
+            file_mode: 700
+            dir_mode: 700
+            encoding: utf-8
+            hash: <<md5 hash>>
+            makedirs: true
+
+Ensure presence of file by specifying it's contents:
+
+.. code-block:: yaml
+
+    linux:
+      system:
+        file:
+          /tmp/test.txt:
+            contents: |
+              line1
+              line2
+            user: root
+            group: root
+            file_mode: 700
+            dir_mode: 700
+            encoding: utf-8
+            hash: <<md5 hash>>
+            makedirs: true
 Kernel
 ~~~~~~
 
diff --git a/linux/files/atop.systemd b/linux/files/atop.service
similarity index 100%
rename from linux/files/atop.systemd
rename to linux/files/atop.service
diff --git a/linux/network/resolv.sls b/linux/network/resolv.sls
index db1a463..caecee3 100644
--- a/linux/network/resolv.sls
+++ b/linux/network/resolv.sls
@@ -6,10 +6,13 @@
   - source: salt://linux/files/resolv.conf
   - mode: 644
   - template: jinja
+  - follow_symlinks: false
+  - require:
+    - service: resolvconf_service
 
-linux_resolvconf_disable:
-  cmd.run:
-  - name: resolvconf --disable-updates
-  - onlyif: resolvconf --updates-are-enabled
+resolvconf_service:
+  service.dead:
+    - name: resolvconf
+    - enable: false
 
 {%- endif %}
diff --git a/linux/system/file.sls b/linux/system/file.sls
new file mode 100644
index 0000000..24ca394
--- /dev/null
+++ b/linux/system/file.sls
@@ -0,0 +1,34 @@
+{%- from "linux/map.jinja" import system with context %}
+{%- if system.enabled %}
+
+{%- for file_name, file in system.file.iteritems() %}
+
+{{ file_name }}:
+  file.managed:
+    {%- if file.source is defined %}
+    - source: {{ file.source }}
+    {%- endif %}
+    {%- if file.contents is defined %}
+    - contents: {{ file.contents }}
+    {%- endif %}
+    - makedirs: {{ file.get('makedirs', 'True') }}
+    - user: {{ file.get('user', 'root') }}
+    - group: {{ file.get('group', 'root') }}
+    {%- if file.file_mode is defined %}
+    - file_mode: {{ file.file_mode }}
+    {%- endif %}
+    {%- if file.dir_mode is defined %}
+    - dir_mode: {{ file.dir_mode }}
+    {%- endif %}
+    {%- if file.encoding is defined %}
+    - encoding: {{ file.encoding }}
+    {%- endif %}
+    {%- if file.hash is defined %}
+    - source_hash: {{ file.hash }}
+    {%- else %}
+    - skip_verify: True
+    {%- endif %}
+
+{%- endfor %}
+
+{%- endif %}
\ No newline at end of file
diff --git a/linux/system/hugepages.sls b/linux/system/hugepages.sls
index 669e254..59bf813 100644
--- a/linux/system/hugepages.sls
+++ b/linux/system/hugepages.sls
@@ -3,7 +3,7 @@
 include:
   - linux.system.grub
 
-{%- if "pse" in grains.cpu_flags or "pdpe1gb" in grains.cpu_flags %}
+{%- if "pse" in grains.cpu_flags or "pdpe1gb" in grains.cpu_flags or "aarch64" in grains.cpuarch %}
 
 /etc/default/grub.d/90-hugepages.cfg:
   file.managed:
diff --git a/linux/system/init.sls b/linux/system/init.sls
index f97ccf9..8594d48 100644
--- a/linux/system/init.sls
+++ b/linux/system/init.sls
@@ -102,6 +102,9 @@
 {%- if system.directory is defined %}
 - linux.system.directory
 {%- endif %}
+{%- if system.file is defined %}
+- linux.system.file
+{%- endif %}
 {%- if system.ld is defined %}
 - linux.system.ld
 {%- endif %}
diff --git a/linux/system/kernel.sls b/linux/system/kernel.sls
index b1c3f3b..226a540 100644
--- a/linux/system/kernel.sls
+++ b/linux/system/kernel.sls
@@ -40,7 +40,7 @@
 # Not very Salt-ish.. :-(
 linux_kernel_old_absent:
   cmd.wait:
-  - name: "apt-get purge -y $(dpkg -l '*linux-image-[0-9]*' '*linux-headers-[0-9]*' '*linux-image-extra-[0-9]*' | grep -E '^ii' | awk '{print $2}' | grep -v '{{ system.kernel.version }}')"
+  - name: "dpkg -l '*linux-generic-*[0-9]*' '*linux-image-*[0-9]*' '*linux-headers-*[0-9]*' '*linux-image-extra-*[0-9]*' | grep -E '^ii' | awk '{print $2}' | grep -v '{{ system.kernel.version }}' | xargs dpkg --purge --force-depends"
   - watch:
     - pkg: linux_kernel_package