Sha256: 0239c3c562b8bc17c679a8ee4c177f02c0694b0281b2dd254d50854986a77990

Contents?: true

Size: 1.46 KB

Versions: 3

Compression:

Stored size: 1.46 KB

Contents

module Getch
  module FileSystem
    module Ext4
      class Partition < Getch::FileSystem::Ext4::Device
        def initialize
          super
          @state = Getch::States.new()
          @clean = Getch::FileSystem::Clean
          @partition = Getch::FileSystem::Partition.new
          run_partition
        end

        def run_partition
          return if STATES[:partition ]
          @clean.struct(@disk, @cache_disk, @home_disk)
          @clean.hdd(@disk, @cache_disk, @home_disk)
          if Helpers::efi?
            partition_efi
          else
            partition_bios
          end
          @state.partition
        end

        private

        # Follow https://wiki.archlinux.org/index.php/Partitioning
        def partition_efi
          # /efi   - EFI system partition - 260MB
          # swap   - Linux Swap - size of the ram
          # /      - Root
          # /home  - Home
          @partition.efi(@dev_esp)
          @partition.swap(@dev_swap)
          @partition.root(@dev_root, "8304")
          @partition.home(@dev_home, "8302") if @dev_home
        end

        def partition_bios
          # None      - Bios Boot Partition - 1MiB
          # /         - Root
          # swap      - Linux Swap - size of the ram
          # /home     - Home
          @partition.gpt(@dev_gpt)
          @partition.swap(@dev_swap)
          @partition.root(@dev_root, "8304")
          @partition.home(@dev_home, "8302") if @dev_home
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
getch-0.1.3 lib/getch/filesystem/ext4/partition.rb
getch-0.1.2 lib/getch/filesystem/ext4/partition.rb
getch-0.1.1 lib/getch/filesystem/ext4/partition.rb