getch 0.1.0 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data.tar.gz.sig +0 -0
  4. data/README.md +95 -22
  5. data/assets/network-stack.conf +63 -0
  6. data/bin/getch +12 -4
  7. data/lib/getch.rb +116 -66
  8. data/lib/getch/command.rb +19 -5
  9. data/lib/getch/config.rb +42 -0
  10. data/lib/getch/config/gentoo.rb +59 -0
  11. data/lib/getch/config/void.rb +49 -0
  12. data/lib/getch/filesystem.rb +5 -0
  13. data/lib/getch/filesystem/.mount.rb.swp +0 -0
  14. data/lib/getch/filesystem/clean.rb +58 -0
  15. data/lib/getch/filesystem/device.rb +61 -0
  16. data/lib/getch/filesystem/ext4.rb +1 -0
  17. data/lib/getch/filesystem/ext4/config.rb +8 -9
  18. data/lib/getch/filesystem/ext4/device.rb +2 -7
  19. data/lib/getch/filesystem/ext4/encrypt.rb +1 -0
  20. data/lib/getch/filesystem/ext4/encrypt/config.rb +8 -9
  21. data/lib/getch/filesystem/ext4/encrypt/deps.rb +3 -19
  22. data/lib/getch/filesystem/ext4/encrypt/device.rb +3 -8
  23. data/lib/getch/filesystem/ext4/encrypt/format.rb +3 -6
  24. data/lib/getch/filesystem/ext4/encrypt/mount.rb +5 -43
  25. data/lib/getch/filesystem/ext4/encrypt/partition.rb +29 -54
  26. data/lib/getch/filesystem/ext4/encrypt/void.rb +100 -0
  27. data/lib/getch/filesystem/ext4/format.rb +4 -6
  28. data/lib/getch/filesystem/ext4/mount.rb +7 -46
  29. data/lib/getch/filesystem/ext4/partition.rb +16 -39
  30. data/lib/getch/filesystem/ext4/void.rb +43 -0
  31. data/lib/getch/filesystem/lvm.rb +1 -0
  32. data/lib/getch/filesystem/lvm/config.rb +11 -15
  33. data/lib/getch/filesystem/lvm/deps.rb +4 -19
  34. data/lib/getch/filesystem/lvm/device.rb +33 -9
  35. data/lib/getch/filesystem/lvm/encrypt.rb +1 -0
  36. data/lib/getch/filesystem/lvm/encrypt/config.rb +9 -12
  37. data/lib/getch/filesystem/lvm/encrypt/deps.rb +4 -21
  38. data/lib/getch/filesystem/lvm/encrypt/device.rb +33 -9
  39. data/lib/getch/filesystem/lvm/encrypt/format.rb +3 -4
  40. data/lib/getch/filesystem/lvm/encrypt/mount.rb +7 -47
  41. data/lib/getch/filesystem/lvm/encrypt/partition.rb +30 -38
  42. data/lib/getch/filesystem/lvm/encrypt/void.rb +100 -0
  43. data/lib/getch/filesystem/lvm/format.rb +12 -8
  44. data/lib/getch/filesystem/lvm/mount.rb +7 -46
  45. data/lib/getch/filesystem/lvm/partition.rb +19 -31
  46. data/lib/getch/filesystem/lvm/void.rb +45 -0
  47. data/lib/getch/filesystem/mount.rb +56 -0
  48. data/lib/getch/filesystem/partition.rb +77 -0
  49. data/lib/getch/filesystem/zfs.rb +1 -0
  50. data/lib/getch/filesystem/zfs/config.rb +7 -8
  51. data/lib/getch/filesystem/zfs/deps.rb +24 -12
  52. data/lib/getch/filesystem/zfs/device.rb +54 -9
  53. data/lib/getch/filesystem/zfs/encrypt.rb +1 -0
  54. data/lib/getch/filesystem/zfs/encrypt/.mount.rb.swp +0 -0
  55. data/lib/getch/filesystem/zfs/encrypt/config.rb +11 -11
  56. data/lib/getch/filesystem/zfs/encrypt/deps.rb +24 -14
  57. data/lib/getch/filesystem/zfs/encrypt/device.rb +54 -9
  58. data/lib/getch/filesystem/zfs/encrypt/format.rb +84 -3
  59. data/lib/getch/filesystem/zfs/encrypt/mount.rb +8 -28
  60. data/lib/getch/filesystem/zfs/encrypt/partition.rb +26 -109
  61. data/lib/getch/filesystem/zfs/encrypt/void.rb +96 -0
  62. data/lib/getch/filesystem/zfs/format.rb +97 -4
  63. data/lib/getch/filesystem/zfs/mount.rb +10 -32
  64. data/lib/getch/filesystem/zfs/partition.rb +25 -106
  65. data/lib/getch/filesystem/zfs/void.rb +81 -0
  66. data/lib/getch/gentoo.rb +20 -16
  67. data/lib/getch/gentoo/boot.rb +24 -16
  68. data/lib/getch/gentoo/chroot.rb +16 -25
  69. data/lib/getch/gentoo/config.rb +67 -15
  70. data/lib/getch/gentoo/sources.rb +55 -13
  71. data/lib/getch/gentoo/stage.rb +0 -1
  72. data/lib/getch/gentoo/use.rb +43 -0
  73. data/lib/getch/gentoo/use_flag.rb +63 -0
  74. data/lib/getch/guard.rb +64 -0
  75. data/lib/getch/helpers.rb +133 -0
  76. data/lib/getch/log.rb +3 -2
  77. data/lib/getch/options.rb +46 -24
  78. data/lib/getch/version.rb +1 -1
  79. data/lib/getch/void.rb +59 -0
  80. data/lib/getch/void/boot.rb +80 -0
  81. data/lib/getch/void/chroot.rb +55 -0
  82. data/lib/getch/void/config.rb +87 -0
  83. data/lib/getch/void/stage.rb +70 -0
  84. metadata +46 -25
  85. metadata.gz.sig +0 -0
  86. data/.gitignore +0 -2
  87. data/CHANGELOG.md +0 -60
  88. data/Rakefile +0 -21
  89. data/bin/setup.sh +0 -90
  90. data/getch.gemspec +0 -25
@@ -0,0 +1,96 @@
1
+ require_relative '../../../helpers'
2
+
3
+ module Getch
4
+ module FileSystem
5
+ module Zfs
6
+ module Encrypt
7
+ class Void < Device
8
+ include Helpers::Void
9
+ attr_reader :boot_disk
10
+
11
+ def initialize
12
+ super
13
+ hostid
14
+ zfs_zed # mountpoint for zfs
15
+ end
16
+
17
+ # Fstab contain:
18
+ # > /efi noauto
19
+ # > swap
20
+ # > /boot zfs-legacy
21
+ # > /tmp
22
+ def fstab
23
+ conf = "#{MOUNTPOINT}/etc/fstab"
24
+ File.write(conf, "\n", mode: 'w', chmod: 0644)
25
+ line_fstab(@dev_esp, "/efi vfat noauto,rw,relatime 0 0") if @dev_esp
26
+ add_line(conf, "/dev/mapper/cryptswap none swap sw 0 0")
27
+ add_line(conf, "##{@boot_pool_name}/BOOT/#{@n} /boot zfs defaults 0 0") if @dev_boot
28
+ add_line(conf, "tmpfs /tmp tmpfs defaults,nosuid,nodev 0 0")
29
+ end
30
+
31
+ def config_dracut
32
+ conf = "#{MOUNTPOINT}/etc/dracut.conf.d/zfs.conf"
33
+ # dracut: value+= should be surrounding by white space
34
+ content = [
35
+ "hostonly=\"yes\"",
36
+ "omit_dracutmodules+=\" btrfs lvm \"",
37
+ "install_items+=\" /etc/crypttab \"",
38
+ ""
39
+ ]
40
+ File.write(conf, content.join("\n"), mode: 'w', chmod: 0644)
41
+ end
42
+
43
+ def kernel_cmdline_dracut
44
+ #command "zfs set mountpoint=legacy #{@boot_pool_name}/BOOT/#{@n}"
45
+ end
46
+
47
+ def config_grub
48
+ grub_cmdline("root=zfs:#{@pool_name}/ROOT/#{@n}", "zfs_force=1")
49
+ end
50
+
51
+ def finish
52
+ zed_update_path
53
+ puts "+ Enter in your system: chroot /mnt /bin/bash"
54
+ puts "+ Reboot with: shutdown -r now"
55
+ end
56
+
57
+ def crypttab
58
+ line_crypttab("cryptswap", @dev_swap, "/dev/urandom", "swap,discard,cipher=aes-xts-plain64:sha256,size=512")
59
+ end
60
+
61
+ private
62
+
63
+ def line_crypttab(mapname, dev, point, rest)
64
+ conf = "#{MOUNTPOINT}/etc/crypttab"
65
+ device = s_uuid(dev)
66
+ raise "No partuuid for #{dev} #{device}" if !device
67
+ raise "Bad partuuid for #{dev} #{device}" if device.kind_of? Array
68
+ add_line(conf, "#{mapname} PARTUUID=#{device} #{point} #{rest}")
69
+ end
70
+
71
+ def zfs_zed
72
+ service_dir = "/etc/runit/runsvdir/default/"
73
+
74
+ Helpers::mkdir("#{MOUNTPOINT}/etc/zfs/zfs-list.cache")
75
+ Helpers::touch("#{MOUNTPOINT}/etc/zfs/zfs-list.cache/#{@boot_pool_name}") if @dev_boot
76
+ Helpers::touch("#{MOUNTPOINT}/etc/zfs/zfs-list.cache/#{@pool_name}")
77
+ fork { command "/etc/sv/zed/run" }
78
+ command "ln -fs /etc/sv/zed #{service_dir}"
79
+ end
80
+
81
+ def zed_update_path
82
+ Dir.glob("#{MOUNTPOINT}/etc/zfs/zfs-list.cache/*").each { |f|
83
+ if !system("sed", "-Ei", "s|#{MOUNTPOINT}/?|/|", f)
84
+ raise "System exec sed"
85
+ end
86
+ }
87
+ end
88
+
89
+ def hostid
90
+ command "zgenhostid $(hostid)"
91
+ end
92
+ end
93
+ end
94
+ end
95
+ end
96
+ end
@@ -1,19 +1,112 @@
1
1
  module Getch
2
2
  module FileSystem
3
3
  module Zfs
4
- class Format < Getch::FileSystem::Zfs::Device
4
+ class Format < Device
5
5
  def initialize
6
6
  super
7
- @state = Getch::States.new()
7
+ @log = Getch::Log.new
8
+ @state = Getch::States.new
9
+ if ! @id
10
+ @log.info "Research pool id for #{@dev_root}..."
11
+ @id = Helpers::pool_id(@dev_root)
12
+ @boot_pool_name = "bpool-#{@id}"
13
+ @pool_name = "rpool-#{@id}"
14
+ end
8
15
  format
9
16
  end
10
17
 
18
+ private
19
+
11
20
  def format
12
21
  return if STATES[:format]
13
- system("mkfs.fat -F32 #{@dev_boot_efi}") if @dev_boot_efi
14
- system("mkswap -f #{@dev_swap}")
22
+ raise "Error, no id found for #{@dev_root}." if ! @id
23
+ @log.info "Create #{@id} for #{@pool_name}"
24
+ system("mkfs.fat -F32 #{@dev_esp}") if @dev_esp
25
+ zfs
26
+ cache
27
+ datasets
15
28
  @state.format
16
29
  end
30
+
31
+ def zfs
32
+ bloc=`blockdev --getpbsz #{@dev_root}`
33
+ ashift = case bloc
34
+ when /8096/
35
+ 13
36
+ when /4096/
37
+ 12
38
+ else # 512
39
+ 9
40
+ end
41
+
42
+ Helpers::mkdir(MOUNTPOINT)
43
+ @log.debug("ashift found for #{bloc} - #{ashift}")
44
+
45
+ if @dev_boot
46
+ # https://openzfs.github.io/openzfs-docs/Getting%20Started/Ubuntu/Ubuntu%2020.04%20Root%20on%20ZFS.html
47
+ @log.info("Creating boot pool on #{@pool_name}")
48
+ exec("zpool create -f \\
49
+ -o ashift=#{ashift} -o autotrim=on -d \\
50
+ -o feature@async_destroy=enabled \\
51
+ -o feature@bookmarks=enabled \\
52
+ -o feature@embedded_data=enabled \\
53
+ -o feature@empty_bpobj=enabled \\
54
+ -o feature@enabled_txg=enabled \\
55
+ -o feature@extensible_dataset=enabled \\
56
+ -o feature@filesystem_limits=enabled \\
57
+ -o feature@hole_birth=enabled \\
58
+ -o feature@large_blocks=enabled \\
59
+ -o feature@lz4_compress=enabled \\
60
+ -o feature@spacemap_histogram=enabled \\
61
+ -O acltype=posixacl -O canmount=off -O compression=lz4 \\
62
+ -O devices=off -O normalization=formD -O atime=off -O xattr=sa \\
63
+ -O mountpoint=/boot -R #{MOUNTPOINT} \\
64
+ #{@boot_pool_name} #{@dev_boot}
65
+ ")
66
+ end
67
+
68
+ exec("zpool create -f -o ashift=#{ashift} -o autotrim=on \\
69
+ -O acltype=posixacl -O canmount=off -O compression=lz4 \\
70
+ -O dnodesize=auto -O normalization=formD -O atime=off \\
71
+ -O xattr=sa -O mountpoint=/ -R #{MOUNTPOINT} \\
72
+ #{@pool_name} #{@dev_root}
73
+ ")
74
+ end
75
+
76
+ def cache
77
+ system("mkswap -f #{@dev_swap}")
78
+ if @dev_log
79
+ exec("zpool add #{@pool_name} log #{@dev_log}")
80
+ end
81
+ if @dev_cache
82
+ exec("zpool add #{@pool_name} cache #{@dev_cache}")
83
+ end
84
+ end
85
+
86
+ def datasets
87
+ exec("zfs create -o canmount=off -o mountpoint=none #{@pool_name}/ROOT")
88
+ exec("zfs create -o canmount=off -o mountpoint=none #{@boot_pool_name}/BOOT") if @dev_boot
89
+
90
+ exec("zfs create -o canmount=noauto -o mountpoint=/ #{@pool_name}/ROOT/#{@n}")
91
+ exec("zfs create -o canmount=noauto -o mountpoint=/boot #{@boot_pool_name}/BOOT/#{@n}") if @dev_boot
92
+
93
+ exec("zfs create -o canmount=off #{@pool_name}/ROOT/#{@n}/usr")
94
+ exec("zfs create #{@pool_name}/ROOT/#{@n}/usr/src")
95
+ exec("zfs create -o canmount=off #{@pool_name}/ROOT/#{@n}/var")
96
+ exec("zfs create #{@pool_name}/ROOT/#{@n}/var/log")
97
+ exec("zfs create #{@pool_name}/ROOT/#{@n}/var/db")
98
+ exec("zfs create #{@pool_name}/ROOT/#{@n}/var/tmp")
99
+
100
+ exec("zfs create -o canmount=off -o mountpoint=/ #{@pool_name}/USERDATA")
101
+ exec("zfs create -o canmount=on -o mountpoint=/root #{@pool_name}/USERDATA/root")
102
+ if @user
103
+ exec("zfs create -o canmount=on -o mountpoint=/home/#{@user} #{@pool_name}/USERDATA/#{@user}")
104
+ end
105
+ end
106
+
107
+ def exec(cmd)
108
+ Getch::Command.new(cmd).run!
109
+ end
17
110
  end
18
111
  end
19
112
  end
@@ -1,15 +1,11 @@
1
- require 'fileutils'
2
-
3
1
  module Getch
4
2
  module FileSystem
5
3
  module Zfs
6
- class Mount < Getch::FileSystem::Zfs::Device
4
+ class Mount < Device
7
5
  def initialize
8
6
  super
9
- @root_dir = MOUNTPOINT
10
- @boot_dir = "#{@root_dir}/boot"
11
- @boot_efi_dir = "#{@root_dir}/boot/efi"
12
- @state = Getch::States.new()
7
+ @mount = Getch::FileSystem::Mount.new
8
+ @state = Getch::States.new
13
9
  @log = Getch::Log.new
14
10
  end
15
11
 
@@ -18,48 +14,30 @@ module Getch
18
14
  exec("zpool export -a")
19
15
  exec("rm -rf #{MOUNTPOINT}/*")
20
16
  exec("zpool import -N -R #{MOUNTPOINT} #{@pool_name}")
21
- exec("zpool import -N -R #{MOUNTPOINT} #{@boot_pool_name}") if @dev_boot
22
- mount_swap
17
+ exec("zpool import -f -N -R #{MOUNTPOINT} #{@boot_pool_name}") if @dev_boot
18
+ @mount.swap(@dev_swap)
23
19
  mount_root
24
20
  mount_boot
25
- mount_boot_efi
21
+ @mount.esp(@dev_esp)
26
22
  exec("zfs mount -a")
27
23
  @state.mount
28
24
  end
29
25
 
30
26
  private
31
27
 
32
- def mount_swap
33
- if Helpers::grep?('/proc/swaps', /^\/dev/)
34
- exec("swapoff #{@dev_swap}")
35
- end
36
-
37
- exec("swapon #{@dev_swap}")
38
- end
39
-
40
28
  def mount_root
41
- Helpers::mkdir(@root_dir)
42
- exec("zfs mount #{@pool_name}/ROOT/gentoo")
43
- end
44
-
45
- def mount_boot_efi
46
- return if ! @dev_boot_efi
47
- Helpers::mkdir(@boot_efi_dir)
48
- exec("mount #{@dev_boot_efi} #{@boot_efi_dir}")
29
+ Helpers::mkdir(MOUNTPOINT)
30
+ exec("zfs mount #{@pool_name}/ROOT/#{@n}")
49
31
  end
50
32
 
51
33
  def mount_boot
52
34
  return if ! @dev_boot
53
- Helpers::mkdir(@boot_dir)
54
- exec("zfs mount #{@boot_pool_name}/BOOT/gentoo")
35
+ exec("zfs mount #{@boot_pool_name}/BOOT/#{@n}")
55
36
  end
56
37
 
57
38
  def exec(cmd)
58
39
  @log.info("==> #{cmd}")
59
- system(cmd)
60
- unless $?.success?
61
- raise "Error with #{cmd}"
62
- end
40
+ Helpers::sys(cmd)
63
41
  end
64
42
  end
65
43
  end
@@ -1,9 +1,11 @@
1
1
  module Getch
2
2
  module FileSystem
3
3
  module Zfs
4
- class Partition < Getch::FileSystem::Zfs::Device
4
+ class Partition < Device
5
5
  def initialize
6
6
  super
7
+ @clean = Getch::FileSystem::Clean
8
+ @partition = Getch::FileSystem::Partition.new
7
9
  @state = Getch::States.new()
8
10
  @log = Getch::Log.new()
9
11
  run_partition
@@ -11,126 +13,43 @@ module Getch
11
13
 
12
14
  def run_partition
13
15
  return if STATES[:partition ]
14
- clear_struct
15
- cleaning
16
+ @clean.old_zpool
17
+ @clean.hdd(@disk)
18
+ @clean.external_disk(@disk, @boot_disk, @cache_disk, @home_disk)
19
+
16
20
  partition
17
- zfs
21
+ cache
18
22
  @state.partition
19
23
  end
20
24
 
21
25
  private
22
26
 
23
- def clear_struct
24
- oldvg = `vgdisplay | grep #{@vg}`.chomp
25
- oldzpool = `zpool status | grep pool:`.gsub(/pool: /, '').delete(' ').split("\n")
26
- if oldzpool[0] != "" and $?.success?
27
- oldzpool.each { |p| exec("zpool destroy #{p}") if p }
28
- end
29
- exec("vgremove -f #{@vg}") if oldvg != '' # remove older volume group
30
- exec("pvremove -f #{@dev_root}") if oldvg != '' and File.exist? @dev_root # remove older volume group
31
-
32
- exec("sgdisk -Z /dev/#{@disk}")
33
- exec("wipefs -a /dev/#{@disk}")
34
- end
35
-
36
- # See https://wiki.archlinux.org/index.php/Solid_state_drive/Memory_cell_clearing
37
- # for SSD
38
- def cleaning
39
- @bloc=`blockdev --getbsz /dev/#{@disk}`.chomp
40
- puts
41
- print "Cleaning data on #{@disk}, can be long, avoid this on Flash Memory (SSD,USB,...) ? (n,y) "
42
- case gets.chomp
43
- when /^y|^Y/
44
- exec("dd if=/dev/urandom of=/dev/#{@disk} bs=#{@bloc} status=progress")
45
- else
46
- return
47
- end
48
- end
49
-
50
27
  def partition
51
- mem=`awk '/MemTotal/ {print $2}' /proc/meminfo`.chomp + 'K'
52
- if Helpers::efi?
53
- exec("sgdisk -n1:1M:+260M -t1:EF00 /dev/#{@disk}")
54
- exec("sgdisk -n2:0:+#{mem} -t2:8200 /dev/#{@disk}")
55
- exec("sgdisk -n3:0:+0 -t3:BF00 /dev/#{@disk}")
28
+ if @efi
29
+ @partition.efi(@dev_esp)
30
+ @partition.boot(@dev_boot) if Getch::OPTIONS[:os] == 'void'
31
+ @partition.swap(@dev_swap) if !@cache_disk
32
+ @partition.root(@dev_root, "BF00") if @root_part != 1
56
33
  else
57
- exec("sgdisk -n1:1MiB:+1MiB -t1:EF02 /dev/#{@disk}")
58
- exec("sgdisk -n2:0:+2G -t2:BE00 /dev/#{@disk}") # boot pool GRUB
59
- exec("sgdisk -n3:0:+#{mem} -t3:8200 /dev/#{@disk}")
60
- exec("sgdisk -n4:0:+0 -t4:BF00 /dev/#{@disk}")
34
+ @partition.gpt(@dev_gpt)
35
+ # Boot pool for GRUB2
36
+ @partition.boot(@dev_boot)
37
+ @partition.swap(@dev_swap) if !@cache_disk
38
+ @partition.root(@dev_root, "BF00") if @root_part != 1
61
39
  end
62
40
  end
63
41
 
64
- def zfs
65
- ashift = case @bloc
66
- when 8096
67
- 13
68
- when 4096
69
- 12
70
- else # 512
71
- 9
72
- end
73
-
74
- Helpers::mkdir(MOUNTPOINT)
75
-
76
- @log.debug("ashift found for #{@bloc} - #{ashift}")
77
- if ! Helpers::efi?
78
- # https://openzfs.github.io/openzfs-docs/Getting%20Started/Ubuntu/Ubuntu%2020.04%20Root%20on%20ZFS.html
79
- @log.info("Creating boot pool on #{@pool_name}")
80
- exec("zpool create -f \\
81
- -o ashift=#{ashift} -d \\
82
- -o feature@async_destroy=enabled \\
83
- -o feature@bookmarks=enabled \\
84
- -o feature@embedded_data=enabled \\
85
- -o feature@empty_bpobj=enabled \\
86
- -o feature@enabled_txg=enabled \\
87
- -o feature@extensible_dataset=enabled \\
88
- -o feature@filesystem_limits=enabled \\
89
- -o feature@hole_birth=enabled \\
90
- -o feature@large_blocks=enabled \\
91
- -o feature@lz4_compress=enabled \\
92
- -o feature@spacemap_histogram=enabled \\
93
- -O acltype=posixacl -O canmount=off -O compression=lz4 \\
94
- -O devices=off -O normalization=formD -O atime=off -O xattr=sa \\
95
- -O mountpoint=/boot -R #{MOUNTPOINT} \\
96
- #{@boot_pool_name} #{@dev_boot}
97
- ")
42
+ def cache
43
+ if @cache_disk
44
+ mem=`awk '/MemTotal/ {print $2}' /proc/meminfo`.chomp + 'K'
45
+ exec("sgdisk -n1:0:+#{mem} -t1:8200 /dev/#{@cache_disk}")
46
+ exec("sgdisk -n2:0:+4G -t2:BF07 /dev/#{@cache_disk}")
47
+ exec("sgdisk -n3:0:0 -t3:BF00 /dev/#{@cache_disk}")
98
48
  end
99
-
100
- exec("zpool create -f -o ashift=#{ashift} \\
101
- -O acltype=posixacl -O canmount=off -O compression=lz4 \\
102
- -O dnodesize=auto -O normalization=formD -O atime=off \\
103
- -O xattr=sa -O mountpoint=/ -R #{MOUNTPOINT} \\
104
- #{@pool_name} #{@dev_root}
105
- ")
106
-
107
- add_datasets
108
- end
109
-
110
- def add_datasets
111
- exec("zfs create -o canmount=off -o mountpoint=none #{@pool_name}/ROOT")
112
- exec("zfs create -o canmount=off -o mountpoint=none #{@boot_pool_name}/BOOT") if @dev_boot
113
-
114
- exec("zfs create -o canmount=noauto -o mountpoint=/ #{@pool_name}/ROOT/gentoo")
115
- # set bootfs
116
- #exec("zpool set bootfs=#{@pool_name}/ROOT/gentoo #{@pool_name}")
117
- exec("zfs create -o canmount=noauto -o mountpoint=/boot #{@boot_pool_name}/BOOT/gentoo") if @dev_boot
118
-
119
- exec("zfs create -o canmount=off #{@pool_name}/ROOT/gentoo/usr")
120
- exec("zfs create #{@pool_name}/ROOT/gentoo/usr/src")
121
- exec("zfs create -o canmount=off #{@pool_name}/ROOT/gentoo/var")
122
- exec("zfs create #{@pool_name}/ROOT/gentoo/var/log")
123
- exec("zfs create #{@pool_name}/ROOT/gentoo/var/db")
124
- exec("zfs create #{@pool_name}/ROOT/gentoo/var/tmp")
125
-
126
- exec("zfs create -o canmount=off -o mountpoint=/ #{@pool_name}/USERDATA")
127
- exec("zfs create -o canmount=on -o mountpoint=/root #{@pool_name}/USERDATA/root")
128
- exec("zfs create -o canmount=on -o mountpoint=/home/#{@user} #{@pool_name}/USERDATA/#{@user}") if @user
129
49
  end
130
50
 
131
- # Follow https://wiki.archlinux.org/index.php/Partitioning
132
51
  # Partition_efi
133
- # /boot/efi - EFI system partition - 260MB
52
+ # /efi - EFI system partition - 260MB
134
53
  # / - Root
135
54
 
136
55
  # Partition_bios