class Getch::FileSystem::Lvm::Config
Public Class Methods
new()
click to toggle source
Calls superclass method
Getch::FileSystem::Lvm::Device::new
# File lib/getch/filesystem/lvm/config.rb, line 5 def initialize super gen_uuid @root_dir = MOUNTPOINT @init = '/usr/lib/systemd/systemd' end
Public Instance Methods
fstab()
click to toggle source
# File lib/getch/filesystem/lvm/config.rb, line 12 def fstab file = "#{@root_dir}/etc/fstab" datas = data_fstab File.write(file, datas.join("\n")) end
grub()
click to toggle source
# File lib/getch/filesystem/lvm/config.rb, line 31 def grub return if @efi file = "#{@root_dir}/etc/default/grub" cmdline = [ "GRUB_CMDLINE_LINUX=\"resume=#{@lv_swap} root=#{@lv_root} init=#{@init} dolvm rw\"" ] File.write("#{file}", cmdline.join("\n"), mode: 'a') end
systemd_boot()
click to toggle source
# File lib/getch/filesystem/lvm/config.rb, line 18 def systemd_boot return if !@efi esp = '/efi' dir = "#{@root_dir}/#{esp}/loader/entries/" datas_gentoo = [ 'title Gentoo Linux', 'linux /vmlinuz', 'initrd /initramfs', "options resume=#{@lv_swap} root=#{@lv_root} init=#{@init} dolvm rw" ] File.write("#{dir}/gentoo.conf", datas_gentoo.join("\n")) end
Private Instance Methods
data_fstab()
click to toggle source
# File lib/getch/filesystem/lvm/config.rb, line 47 def data_fstab efi = @dev_esp ? "UUID=#{@uuid_esp} /efi vfat noauto,noatime 1 2" : '' boot = @dev_boot ? "UUID=#{@uuid_boot} /boot ext4 noauto,noatime 1 2" : '' swap = "#{@lv_swap} none swap discard 0 0" root = "#{@lv_root} / ext4 defaults 0 1" home = @lv_home ? "#{@lv_home} /home/#{@user} ext4 defaults 0 2" : '' [ efi, boot, swap, root, home ] end
gen_uuid()
click to toggle source
# File lib/getch/filesystem/lvm/config.rb, line 42 def gen_uuid @uuid_boot = `lsblk -o "UUID" #{@dev_boot} | tail -1`.chomp() if @dev_boot @uuid_esp = `lsblk -o "UUID" #{@dev_esp} | tail -1`.chomp() if @dev_esp end