summaryrefslogtreecommitdiff
path: root/manifests/init.pp
diff options
context:
space:
mode:
Diffstat (limited to 'manifests/init.pp')
-rw-r--r--manifests/init.pp41
1 files changed, 40 insertions, 1 deletions
diff --git a/manifests/init.pp b/manifests/init.pp
index 8428b5c..d7bd375 100644
--- a/manifests/init.pp
+++ b/manifests/init.pp
@@ -42,14 +42,27 @@ class syslinux (
$device = $facts['mountpoints']['/']['device']
$partuuid = $facts['blkid'][$device]['PARTUUID']
+
+ $cpus = $facts['processors']['models']
+ $has_amd = $cpus.any |$i| { $i =~ /AMD/ }
+ $has_intel = $cpus.any |$i| { $i =~ /Intel/ }
+
+ if $has_amd { ensure_packages(['amd-ucode']) }
+ if $has_intel { ensure_packages(['intel-ucode']) }
+
$entries = $boot_entries.map |$key, $entry| {
case $entry['type'] {
'linux': {
$extra_args = $entry['extra_args']
$initrd = $entry['initrd']
+ $initrd_multi = [
+ if $has_amd { '../amd-ucode.img' },
+ if $has_intel { '../intel-ucode.img' },
+ "../arch/${initrd}",
+ ].filter |$i| { $i != undef }.join(',')
$hash = {
'APPEND' => "root=PARTUUID=${partuuid} rw ${extra_args}",
- 'INITRD' => "../arch/${initrd}",
+ 'INITRD' => $initrd_multi,
'LINUX' => "../arch/vmlinuz-${kernel}",
}
}
@@ -99,11 +112,23 @@ class syslinux (
mode => '0555',
content => @("EOF"/$)
#!/bin/sh
+ # File managed by Puppet
IFS='\n' read data
cp "/\$data" "${efi_root}/EFI/arch/vmlinuz-${kernel}"
| EOF
}
+ file { '/usr/libexec/move-ucode':
+ ensure => file,
+ mode => '0555',
+ content => @("EOF"/$)
+ #!/bin/sh
+ # File managed by Puppet
+ IFS='\n' read data
+ cp "/\$data" "${efi_root}/EFI/"
+ | EOF
+ }
+
pacman::hook { 'install-kernel':
priority => 60, # something less than /usr/share/libalpm/hooks/90-mkinitcpio-install.hook
trigger => {
@@ -116,4 +141,18 @@ class syslinux (
exec => '/usr/libexec/move-kernel',
needsTargets => true ,
}
+
+
+ pacman::hook { 'install-ucode-initrd':
+ priority => 60,
+ trigger => {
+ type => 'Path',
+ operation => [ 'Install', 'Upgrade' ],
+ target => [ 'boot/*-ucode.img', ],
+ },
+ description => 'Moving µCode-updates to EFI',
+ when => 'PostTransaction',
+ exec => '/usr/libexec/move-ucode',
+ needsTargets => true ,
+ }
}