summaryrefslogtreecommitdiff
path: root/modules/syslinux
diff options
context:
space:
mode:
Diffstat (limited to 'modules/syslinux')
-rw-r--r--modules/syslinux/files/mkinitcpio.linux14
-rw-r--r--modules/syslinux/lib/facter/blkid.rb18
-rw-r--r--modules/syslinux/lib/facter/efibootmgr.rb21
-rw-r--r--modules/syslinux/lib/facter/partid.rb16
-rw-r--r--modules/syslinux/manifests/init.pp119
-rw-r--r--modules/syslinux/templates/syslinux.cfg.epp60
6 files changed, 0 insertions, 248 deletions
diff --git a/modules/syslinux/files/mkinitcpio.linux b/modules/syslinux/files/mkinitcpio.linux
deleted file mode 100644
index 81554d7..0000000
--- a/modules/syslinux/files/mkinitcpio.linux
+++ /dev/null
@@ -1,14 +0,0 @@
-# mkinitcpio preset file for the 'linux' package
-
-ALL_config="/etc/mkinitcpio.conf"
-ALL_kver="/boot/efi/EFI/arch/vmlinuz-linux"
-
-PRESETS=('default' 'fallback')
-
-#default_config="/etc/mkinitcpio.conf"
-default_image="/boot/efi/EFI/arch/initramfs-linux.img"
-#default_options=""
-
-#fallback_config="/etc/mkinitcpio.conf"
-fallback_image="/boot/efi/EFI/arch/initramfs-linux-fallback.img"
-fallback_options="-S autodetect"
diff --git a/modules/syslinux/lib/facter/blkid.rb b/modules/syslinux/lib/facter/blkid.rb
deleted file mode 100644
index 0940707..0000000
--- a/modules/syslinux/lib/facter/blkid.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-Facter.add('blkid') do
- setcode do
- lines = Facter::Core::Execution.execute('blkid').split("\n")
- out = {}
- lines.each do |line|
- a = line.match(/^([^:]*):(.*)/)
- d = {}
- remaining = a[2]
- while m = remaining.match(/ (\w*)="([^"]*)"/) do
- d[m[1]] = m[2]
- remaining = m.post_match
- end
- out[a[1]] = d
- end
- out
- end
-end
-
diff --git a/modules/syslinux/lib/facter/efibootmgr.rb b/modules/syslinux/lib/facter/efibootmgr.rb
deleted file mode 100644
index 81a3dc3..0000000
--- a/modules/syslinux/lib/facter/efibootmgr.rb
+++ /dev/null
@@ -1,21 +0,0 @@
-if Facter::Core::Execution.which('efibootmgr') then
- Facter.add('efi') do
- setcode do
- out = {}
- data = Facter::Core::Execution.execute('efibootmgr')
- boots = {}
- data.split("\n").each do |item|
- if a = item.match(/BootOrder: (.*)/) then
- out['BootOrder'] = a[1].split(',')
- elsif a = item.match(/(\w*): (.*)/) then
- out[a[1]] = a[2]
- elsif a = item.match(/Boot(\d*)(\*?) (.*)/)
- # a[2] contains if it's active
- boots[a[1]] = a[3]
- end
- end
- out['boots'] = boots
- out
- end
- end
-end
diff --git a/modules/syslinux/lib/facter/partid.rb b/modules/syslinux/lib/facter/partid.rb
deleted file mode 100644
index 53fc37c..0000000
--- a/modules/syslinux/lib/facter/partid.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-Facter.add('partinfo') do
- setcode do
- obj = {}
- Dir.entries('/sys/class/block/').each do |entry|
- if entry == '.' or entry == '..' then next end
- path = "/sys/class/block/#{entry}/partition"
- if File.file?(path) then
- obj[entry] = {
- 'partid' => File.read(path).strip(),
- 'device' => File.basename(File.dirname(File.readlink("/sys/class/block/#{entry}"))),
- }
- end
- end
- obj
- end
-end
diff --git a/modules/syslinux/manifests/init.pp b/modules/syslinux/manifests/init.pp
deleted file mode 100644
index 8428b5c..0000000
--- a/modules/syslinux/manifests/init.pp
+++ /dev/null
@@ -1,119 +0,0 @@
-type Bootentry = Struct[{
- 'label' => String,
- 'type' => Enum['linux','com'],
- # linux specific
- 'extra_args' => Optional[String],
- 'initrd' => Optional[String],
- # com specific
- 'com' => Optional[String],
-}]
-
-class syslinux (
- String $kernel = 'linux',
- String $efi_root = '/boot/efi',
- String $bootentry = 'syslinux',
-
- Hash[String,Bootentry,1] $boot_entries,
- String $default_boot_entry = $boot_entries.map |$k, $_| { $k }[0],
-) {
-
- $efi_dev = $facts['mountpoints'][$efi_root]
- if ! $efi_dev {
- fail("A device needs to be mounted on efi_root [${efi_root}]")
- }
- # $efi_dev['device']
-
- ensure_packages ([
- $kernel,
- mkinitcpio,
- syslinux,
- efibootmgr,
- ], {
- ensure => installed,
- })
-
- file { "/etc/mkinitcpio.d/${kernel}.preset":
- ensure => file,
- source => "puppet:///modules/${module_name}/mkinitcpio.${kernel}",
- }
-
- # cp -r /usr/lib/syslinux/efi64 ${efi_root}/EFI/syslinux
-
- $device = $facts['mountpoints']['/']['device']
- $partuuid = $facts['blkid'][$device]['PARTUUID']
-
- $entries = $boot_entries.map |$key, $entry| {
- case $entry['type'] {
- 'linux': {
- $extra_args = $entry['extra_args']
- $initrd = $entry['initrd']
- $hash = {
- 'APPEND' => "root=PARTUUID=${partuuid} rw ${extra_args}",
- 'INITRD' => "../arch/${initrd}",
- 'LINUX' => "../arch/vmlinuz-${kernel}",
- }
- }
- 'com': {
- $com = $entry['com']
- $hash = {
- 'COM32' => "${com}.c32",
- }
- }
- }
-
- $common = { 'MENU LABEL' => $entry['label'], }
- [$key, $common + $hash]
- }.convert_to(Hash)
-
- file { "${efi_root}/EFI/syslinux/syslinux.cfg":
- content => epp("${module_name}/syslinux.cfg.epp", {
- 'default' => $default_boot_entry,
- 'entries' => $entries,
- })
- }
-
- file { "${efi_root}/EFI/arch":
- ensure => directory,
- }
-
- $has_syslinux = $facts['efi']['boots'].any |$_, $value| {
- $value == $bootentry
- }
-
- $partition = $facts['partinfo'][basename($efi_dev['device'])]
-
- if ! $has_syslinux {
- $efi_device = $partition['device']
- $partid = $partition['partid']
- exec { "efibootmgr --disk '/dev/${efi_device}' --part ${partid} --create --label '${bootentry}' --loader /EFI/syslinux/syslinux.efi":
- path => [ '/usr/bin', '/bin', ],
- }
- }
-
- file { '/usr/libexec':
- ensure => directory,
- }
-
- file { '/usr/libexec/move-kernel':
- ensure => file,
- mode => '0555',
- content => @("EOF"/$)
- #!/bin/sh
- IFS='\n' read data
- cp "/\$data" "${efi_root}/EFI/arch/vmlinuz-${kernel}"
- | EOF
- }
-
- pacman::hook { 'install-kernel':
- priority => 60, # something less than /usr/share/libalpm/hooks/90-mkinitcpio-install.hook
- trigger => {
- type => 'Path',
- operation => [ 'Install', 'Upgrade' ],
- target => [ 'usr/lib/modules/*/vmlinuz', ],
- },
- description => 'Moving kernel to EFI',
- when => 'PostTransaction',
- exec => '/usr/libexec/move-kernel',
- needsTargets => true ,
- }
-}
diff --git a/modules/syslinux/templates/syslinux.cfg.epp b/modules/syslinux/templates/syslinux.cfg.epp
deleted file mode 100644
index 0d0b946..0000000
--- a/modules/syslinux/templates/syslinux.cfg.epp
+++ /dev/null
@@ -1,60 +0,0 @@
-<%- | String $default,
- Hash $entries,
-| -%>
-# Config file for Syslinux -
-# /boot/syslinux/syslinux.cfg
-#
-# Comboot modules:
-# * menu.c32 - provides a text menu
-# * vesamenu.c32 - provides a graphical menu
-# * chain.c32 - chainload MBRs, partition boot sectors, Windows bootloaders
-# * hdt.c32 - hardware detection tool
-# * reboot.c32 - reboots the system
-#
-# To Use: Copy the respective files from /usr/lib/syslinux to /boot/syslinux.
-# If /usr and /boot are on the same file system, symlink the files instead
-# of copying them.
-#
-# If you do not use a menu, a 'boot:' prompt will be shown and the system
-# will boot automatically after 5 seconds.
-#
-# Please review the wiki: https://wiki.archlinux.org/index.php/Syslinux
-# The wiki provides further configuration examples
-
-DEFAULT <%= $default %>
-PROMPT 0 # Set to 1 if you always want to display the boot: prompt
-TIMEOUT 50
-# You can create syslinux keymaps with the keytab-lilo tool
-#KBDMAP de.ktl
-
-# Menu Configuration
-# Either menu.c32 or vesamenu32.c32 must be copied to /boot/syslinux
-UI menu.c32
-#UI vesamenu.c32
-
-# Refer to http://syslinux.zytor.com/wiki/index.php/Doc/menu
-MENU TITLE Arch Linux
-#MENU BACKGROUND splash.png
-MENU COLOR border 30;44 #40ffffff #a0000000 std
-MENU COLOR title 1;36;44 #9033ccff #a0000000 std
-MENU COLOR sel 7;37;40 #e0ffffff #20ffffff all
-MENU COLOR unsel 37;44 #50ffffff #a0000000 std
-MENU COLOR help 37;40 #c0ffffff #a0000000 std
-MENU COLOR timeout_msg 37;40 #80ffffff #00000000 std
-MENU COLOR timeout 1;37;40 #c0ffffff #00000000 std
-MENU COLOR msg07 37;40 #90ffffff #a0000000 std
-MENU COLOR tabmsg 31;40 #30ffffff #00000000 std
-
-# boot sections follow
-#
-# TIP: If you want a 1024x768 framebuffer, add "vga=773" to your kernel line.
-#
-#-*
-
-
-<%- $entries.each |$name, $entry| { -%>
-LABEL <%= $name %>
- <%- $entry.each |$k, $v| { -%>
- <%= $k %> <%= $v %>
- <%- } -%>
-<%- } -%>