getch 0.0.9 → 0.1.5

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 (64) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data.tar.gz.sig +0 -0
  4. data/CHANGELOG.md +45 -0
  5. data/README.md +57 -11
  6. data/bin/setup.sh +4 -2
  7. data/lib/getch.rb +27 -10
  8. data/lib/getch/command.rb +25 -4
  9. data/lib/getch/config.rb +58 -0
  10. data/lib/getch/filesystem.rb +6 -0
  11. data/lib/getch/filesystem/clean.rb +58 -0
  12. data/lib/getch/filesystem/device.rb +61 -0
  13. data/lib/getch/filesystem/ext4/config.rb +8 -9
  14. data/lib/getch/filesystem/ext4/device.rb +2 -7
  15. data/lib/getch/filesystem/ext4/encrypt/config.rb +8 -9
  16. data/lib/getch/filesystem/ext4/encrypt/deps.rb +3 -19
  17. data/lib/getch/filesystem/ext4/encrypt/device.rb +3 -8
  18. data/lib/getch/filesystem/ext4/encrypt/format.rb +3 -5
  19. data/lib/getch/filesystem/ext4/encrypt/mount.rb +6 -43
  20. data/lib/getch/filesystem/ext4/encrypt/partition.rb +19 -38
  21. data/lib/getch/filesystem/ext4/format.rb +3 -5
  22. data/lib/getch/filesystem/ext4/mount.rb +7 -46
  23. data/lib/getch/filesystem/ext4/partition.rb +16 -39
  24. data/lib/getch/filesystem/lvm/config.rb +11 -15
  25. data/lib/getch/filesystem/lvm/deps.rb +5 -20
  26. data/lib/getch/filesystem/lvm/device.rb +33 -9
  27. data/lib/getch/filesystem/lvm/encrypt/config.rb +9 -12
  28. data/lib/getch/filesystem/lvm/encrypt/deps.rb +5 -22
  29. data/lib/getch/filesystem/lvm/encrypt/device.rb +33 -9
  30. data/lib/getch/filesystem/lvm/encrypt/format.rb +3 -3
  31. data/lib/getch/filesystem/lvm/encrypt/mount.rb +7 -46
  32. data/lib/getch/filesystem/lvm/encrypt/partition.rb +20 -31
  33. data/lib/getch/filesystem/lvm/format.rb +11 -7
  34. data/lib/getch/filesystem/lvm/mount.rb +7 -46
  35. data/lib/getch/filesystem/lvm/partition.rb +19 -31
  36. data/lib/getch/filesystem/mount.rb +56 -0
  37. data/lib/getch/filesystem/partition.rb +77 -0
  38. data/lib/getch/filesystem/zfs.rb +14 -0
  39. data/lib/getch/filesystem/zfs/config.rb +57 -0
  40. data/lib/getch/filesystem/zfs/deps.rb +95 -0
  41. data/lib/getch/filesystem/zfs/device.rb +58 -0
  42. data/lib/getch/filesystem/zfs/encrypt.rb +15 -0
  43. data/lib/getch/filesystem/zfs/encrypt/config.rb +67 -0
  44. data/lib/getch/filesystem/zfs/encrypt/deps.rb +97 -0
  45. data/lib/getch/filesystem/zfs/encrypt/device.rb +60 -0
  46. data/lib/getch/filesystem/zfs/encrypt/format.rb +104 -0
  47. data/lib/getch/filesystem/zfs/encrypt/mount.rb +51 -0
  48. data/lib/getch/filesystem/zfs/encrypt/partition.rb +66 -0
  49. data/lib/getch/filesystem/zfs/format.rb +113 -0
  50. data/lib/getch/filesystem/zfs/mount.rb +48 -0
  51. data/lib/getch/filesystem/zfs/partition.rb +65 -0
  52. data/lib/getch/gentoo.rb +11 -4
  53. data/lib/getch/gentoo/boot.rb +34 -16
  54. data/lib/getch/gentoo/chroot.rb +16 -25
  55. data/lib/getch/gentoo/config.rb +59 -7
  56. data/lib/getch/gentoo/sources.rb +54 -26
  57. data/lib/getch/gentoo/use.rb +43 -0
  58. data/lib/getch/gentoo/use_flag.rb +64 -0
  59. data/lib/getch/guard.rb +62 -0
  60. data/lib/getch/helpers.rb +31 -13
  61. data/lib/getch/options.rb +24 -9
  62. data/lib/getch/version.rb +1 -1
  63. metadata +40 -18
  64. metadata.gz.sig +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 05f332c1aa466828838d7968874705953bba34c2179426f4931a355d5c13963c
4
- data.tar.gz: 47fa91c9b9086013db895772f4faece39afe9f4377ad96a53c4b6aee3822f79b
3
+ metadata.gz: cb3fc628a7308969d14505c6f56623c11c5adda014841e162b264f189b5ad54c
4
+ data.tar.gz: ea50a6890b8c0c718ec38876809144fab98442daeddad2db85bc591a77996948
5
5
  SHA512:
6
- metadata.gz: 0450bc2fbc6e7b3835802dae660ee878da6890bb2181826057442d3de3c580ff0d68d1348ca1d395c0820ce8d9fa5770fdaaee384e67b2619c0fc37c72190f28
7
- data.tar.gz: 961a9019de0dc20e67da6042c2c61d2052cff31299f07c796fec71cb1b9a84e3db92cb1df276a5dd8de896faed53c967871e2d959fc3a317a7d2eccb9ba1622c
6
+ metadata.gz: 2395983c7fc521cc7867cdd54550177a2ed3f5eccdcd070f36eec256e73d06b8bfe961dc3f922fa9c5afac30d28e898625b32655ee89d45bc8e1da79dbf54d15
7
+ data.tar.gz: 1e8eeda1ff45f0d633820ced177fb6ae97645d5aa2e7f02e69279f0b9e611035269c23707f6677820886c92122a27e92d3906401a873fc60a1e1e9064c8de3bf
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
data/CHANGELOG.md CHANGED
@@ -1,3 +1,48 @@
1
+ ## 0.1.4, release 2021-06-20
2
+ * Install `iptables` by default.
3
+ * Control input for options `--disk`, `--format`, `--zoneinfo`, `--keymap`.
4
+ * Add a `/etc/portage/bashrc` to automatically signing kernel modules with `emerge`.
5
+ * Now clean properly another disk used with option `--separate-x DISK`.
6
+ * For ZFS, use `blockdev --getpbsz` to find correct bloc (sector) size.
7
+ * Populate `/etc/modules-load.d/` with modules found with `lsmod` (only few wifi's, flash usb related (ehci, ohci, xhci, etc)).
8
+ * Remove the package `dev-util/dwarves`.
9
+
10
+ ## 0.1.3, release 2021-05-17
11
+ * LVM use the format /dev/vg_name/lv_name for mount/format/fstab.
12
+ * Stop using `euse` from `gentoolkit`, use native Ruby code here.
13
+ * Optimization on package installation, they shouln't be installed more than once.
14
+ * Regroup use flags under Getch::Gentoo::UseFlag.
15
+ * Upd Bask v0.5 (zstd compression, better support for wifi...)
16
+ * Config for systemd-resolved, enable DNS over TLS with Quad9 (9.9.9.9)
17
+ * Add configs for systemd-network with DHCP for wifi and ethernet.
18
+ * Correct permissions (/home/[user] and /etc/portage)
19
+
20
+ ## 0.1.2, release 2021-05-12
21
+ * DOCS update.
22
+ * Keep Nano for those who need :)
23
+ * ZFS use the last version >=2.0 with kernel stable =5.10
24
+ * ZFS create a Log device and Cache device if getch is used with `--separate-cache`.
25
+ * GRUB or Systemd-boot can now be installed on separate disk with `--separate-boot`.
26
+ * Adding flag for ZFS `-o autotrim=on` (used with `zpool create`).
27
+ * Encrypted swap use: `cipher=aes-xts-plain64:sha256,size=512` by default.
28
+ * In the make.conf: add `-fomit-frame-pointer`, designed to reduce generated code size.
29
+
30
+ ## 0.1.1, release 2020-11-01
31
+ * Change mountpoint for the esp at /efi rather than /boot/efi
32
+ * Replace Garden by Bask https://github.com/szorfein/bask
33
+ * Correct option --username USERNAME, do not create a new partition.
34
+ * New set of options --separate-{boot,cache,home} to install them on another disk
35
+ * Refactor codes
36
+ * Add cpu name to COMMON_FLAGS
37
+ * Add cpuflags with app-portage/cpuid2cpuflags
38
+ + Use the whole disk space available for / when option --username is unset
39
+
40
+ ## 0.1.0, release 2020-10-15
41
+ * Add the (Zeta) filesystem ZFS
42
+ * `emerge --depclean` to save space.
43
+ * Add a message when getch have finish, keep /mnt/gentoo if you need to add something.
44
+ * Use systemd-detect-virt to detect a Virtual Guest.
45
+
1
46
  ## 0.0.9, release 2020-10-03
2
47
  * Add encryption on ext4 and lvm (BIOS,UEFI)
3
48
  * Correct KEYMAP="yes" with genkernel
data/README.md CHANGED
@@ -3,16 +3,17 @@ A CLI tool to install Gentoo.
3
3
 
4
4
  ## Description
5
5
  Actually, Getch support only the [AMD64 handbook](https://wiki.gentoo.org/wiki/Handbook:AMD64) and only with the last `stage3-amd64-systemd`.
6
- It also require a disk (only one for now) with a minimum of 20G.
7
6
 
8
- BIOS system will use Grub2 and UEFI, systemd-boot. Filesystem supported by Getch are for now:
9
- + ext4
10
- + lvm
7
+ BIOS system will use `Grub2` and `systemd-boot` for UEFI. Filesystem supported by Getch are for now:
8
+ + Ext4
9
+ + LVM
10
+ + ZFS
11
11
 
12
- I would also add disk encryption soon.
12
+ Encryption is also supported.
13
13
 
14
14
  The ISO images i was able to test and that works:
15
15
  + [Archlinux](https://www.archlinux.org/download/)
16
+ + [Archaeidae](https://github.com/szorfein/archaeidae): Custom Archiso that includes ZFS support.
16
17
 
17
18
  ## Install
18
19
  Getch is cryptographically signed, so add my public key (if you haven’t already) as a trusted certificate.
@@ -27,27 +28,72 @@ When you boot from an `iso`, you can install `ruby`, `getch` and correct your `P
27
28
  # sh <(curl -L https://raw.githubusercontent.com/szorfein/getch/master/bin/setup.sh)
28
29
  # source ~/.zshrc # or ~/.bashrc
29
30
 
31
+ If you want to try the master branch:
32
+
33
+ # git clone https://github.com/szorfein/getch
34
+ # cd getch
35
+ # ruby -I lib bin/getch -h
36
+
30
37
  ## Usage
38
+ Just ensure than the script is run with a root account.
39
+
40
+ # getch -h
31
41
 
32
- $ getch -h
42
+ After an install by Getch, take a look on the [wiki](https://github.com/szorfein/getch/wiki).
33
43
 
34
44
  ## Examples
35
45
  For a french user:
36
46
 
37
- # getch --username ninja --zoneinfo "Europe/Paris" --language fr_FR --keymap fr
38
-
39
- After an install by Getch, take a look on the [wiki](https://github.com/szorfein/getch/wiki).
47
+ # getch --zoneinfo "Europe/Paris" --language fr_FR --keymap fr
40
48
 
41
49
  Install Gentoo on LVM:
42
50
 
43
51
  # getch --format lvm --disk sda
44
52
 
53
+ Encrypt your disk with LVM with a french keymap
54
+
55
+ # getch --format lvm --encrypt --keymap fr
56
+
57
+ Encrypt with ext4 and create a home directory /home/ninja
58
+
59
+ # getch --format ext4 --encrypt --username ninja
60
+
61
+ With ZFS:
62
+
63
+ # getch --format zfs
64
+
45
65
  ## Troubleshooting
46
66
 
47
67
  #### LVM
48
- Unless than your older LVM volume group is named `vg0`, `getch` may fail to partition your disk, you have to clean your device before proceed with `vgremove` and `pvremove`.
68
+ Unless your old LVM volume group is also named `vg0`, `getch` may fail to partition your disk. You have to clean up your device before proceed with `vgremove` and `pvremove`. An short example how doing this with a volume group named `vg0`:
69
+
70
+ # vgdisplay | grep vg0
71
+ # vgremove -f vg0
72
+ # pvremove -f /dev/sdb
73
+
74
+ #### Encryption enable on BIOS with ext4
75
+ To decrypt your disk on BIOS system, you have to enter your password twice. One time for Grub and another time for Genkernel. [post](https://wiki.archlinux.org/index.php/GRUB#Encrypted_/boot).
76
+ Also with GRUB, only a `us` keymap is working.
77
+
78
+ #### ZFS
79
+ When Gentoo boot the first time, the pool may fail to start, it's happen when the pool has not been `export` to the ISO. So just `export` your pool from the genkernel shell:
80
+
81
+ The zpool name should be visible (rpool-150ed here), so enter in the Genkernel shell:
82
+
83
+ > shell
84
+ zpool import -f -N -R /mnt rpool-150ed
85
+ zpool export -a
86
+
87
+ Then, just reboot now, it's all.
88
+
89
+ *INFO*: To create the zpool, getch use the 5 fist characters from the `partuuid`, just replace `sdX` by your real device:
90
+
91
+ # ls -l /dev/disk/by-partuuid/ | grep sdX4
92
+ -> 150ed969...
93
+
94
+ The pool will be called `rpool-150ed`.
49
95
 
50
96
  ## Issues
51
97
  If need more support for your hardware (network, sound card, ...), you can submit a [new issue](https://github.com/szorfein/getch/issues/new) and post the output of the following command:
52
98
  + lspci
53
- + lsmod
99
+ + cat /proc/modules
data/bin/setup.sh CHANGED
@@ -72,10 +72,12 @@ set_shell() {
72
72
  [ -f ~/.zshrc ] && your_shell=~/.zshrc
73
73
 
74
74
  [ -f "$your_shell" ] && {
75
- if ! grep -q ".gem/ruby/[0-9.]*/bin" "$your_shell" ; then
75
+ if ! grep -q "ruby" "$your_shell" ; then
76
76
  echo "export PATH=\$PATH:$(ruby -e 'puts Gem.user_dir')/bin" >> "$your_shell"
77
77
  fi
78
- . "$your_shell"
78
+ if $(. "$your_shell") ; then
79
+ echo "Shell loaded"
80
+ fi
79
81
  }
80
82
  }
81
83
 
data/lib/getch.rb CHANGED
@@ -5,6 +5,8 @@ require_relative 'getch/filesystem'
5
5
  require_relative 'getch/command'
6
6
  require_relative 'getch/helpers'
7
7
  require_relative 'getch/log'
8
+ require_relative 'getch/config'
9
+ require_relative 'getch/guard'
8
10
 
9
11
  module Getch
10
12
 
@@ -15,6 +17,9 @@ module Getch
15
17
  disk: 'sda',
16
18
  fs: 'ext4',
17
19
  username: nil,
20
+ boot_disk: nil,
21
+ cache_disk: nil,
22
+ home_disk: nil,
18
23
  encrypt: false,
19
24
  verbose: false
20
25
  }
@@ -33,11 +38,13 @@ module Getch
33
38
  DEFAULT_FS = {
34
39
  true => {
35
40
  ext4: Getch::FileSystem::Ext4::Encrypt,
36
- lvm: Getch::FileSystem::Lvm::Encrypt
41
+ lvm: Getch::FileSystem::Lvm::Encrypt,
42
+ zfs: Getch::FileSystem::Zfs::Encrypt
37
43
  },
38
44
  false => {
39
45
  ext4: Getch::FileSystem::Ext4,
40
- lvm: Getch::FileSystem::Lvm
46
+ lvm: Getch::FileSystem::Lvm,
47
+ zfs: Getch::FileSystem::Zfs,
41
48
  }
42
49
  }.freeze
43
50
 
@@ -49,13 +56,17 @@ module Getch
49
56
 
50
57
  def self.resume_options(opts)
51
58
  puts "\nBuild Gentoo with the following args:\n"
52
- puts "lang: #{DEFAULT_OPTIONS[:language]}"
53
- puts "zoneinfo: #{DEFAULT_OPTIONS[:zoneinfo]}"
54
- puts "keymap: #{DEFAULT_OPTIONS[:keymap]}"
55
- puts "disk: #{DEFAULT_OPTIONS[:disk]}"
56
- puts "fs: #{DEFAULT_OPTIONS[:fs]}"
57
- puts "username: #{DEFAULT_OPTIONS[:username]}"
58
- puts "encrypt: #{DEFAULT_OPTIONS[:encrypt]}"
59
+ puts "Lang: #{DEFAULT_OPTIONS[:language]}"
60
+ puts "Zoneinfo: #{DEFAULT_OPTIONS[:zoneinfo]}"
61
+ puts "Keymap: #{DEFAULT_OPTIONS[:keymap]}"
62
+ puts "Disk: #{DEFAULT_OPTIONS[:disk]}"
63
+ puts "Filesystem: #{DEFAULT_OPTIONS[:fs]}"
64
+ puts "Username: #{DEFAULT_OPTIONS[:username]}"
65
+ puts "Encrypt: #{DEFAULT_OPTIONS[:encrypt]}"
66
+ puts
67
+ puts "separate-boot disk: #{DEFAULT_OPTIONS[:boot_disk]}"
68
+ puts "separate-cache disk: #{DEFAULT_OPTIONS[:cache_disk]}"
69
+ puts "separate-home disk: #{DEFAULT_OPTIONS[:home_disk]}"
59
70
  puts
60
71
  print "Continue? (n,y) "
61
72
  case gets.chomp
@@ -85,11 +96,16 @@ module Getch
85
96
  gentoo = Getch::Gentoo
86
97
  gentoo.stage3
87
98
  gentoo.config(options)
88
- gentoo.chroot
99
+ gentoo.chroot(options)
89
100
  gentoo.kernel
90
101
  gentoo.boot(options)
91
102
  end
92
103
 
104
+ def self.configure(options)
105
+ config = Getch::Config.new
106
+ config.network
107
+ end
108
+
93
109
  def self.main(argv)
94
110
  options = Options.new(argv)
95
111
  DEFAULT_OPTIONS.freeze
@@ -98,5 +114,6 @@ module Getch
98
114
  format(options.disk, options.fs, options.username)
99
115
  class_fs::Mount.new.run
100
116
  init_gentoo(options)
117
+ configure(options)
101
118
  end
102
119
  end
data/lib/getch/command.rb CHANGED
@@ -127,19 +127,21 @@ module Getch
127
127
  end
128
128
  end
129
129
 
130
- class Garden
130
+ class Bask
131
131
  def initialize(cmd)
132
132
  @gentoo = MOUNTPOINT
133
133
  @cmd = cmd
134
134
  @log = Getch::Log.new
135
+ @version = "0.5"
135
136
  end
136
137
 
137
138
  def run!
138
- @log.info "Running Garden: #{@cmd}"
139
+ download_bask if ! Dir.exist? "#{MOUNTPOINT}/root/bask-#{@version}"
140
+ @log.info "Running Bask: #{@cmd}"
139
141
  cmd = "chroot #{@gentoo} /bin/bash -c \"source /etc/profile \
140
142
  && env-update \
141
- && cd /root/garden-master \
142
- && ./kernel.sh #{@cmd} -k /usr/src/linux\""
143
+ && cd /root/bask-#{@version} \
144
+ && ./bask.sh #{@cmd} -k /usr/src/linux\""
143
145
  Open3.popen2e(cmd) do |stdin, stdout_err, wait_thr|
144
146
  while line = stdout_err.gets
145
147
  puts line
@@ -152,5 +154,24 @@ module Getch
152
154
  end
153
155
  end
154
156
  end
157
+
158
+ private
159
+
160
+ def download_bask
161
+ @log.info "Installing Bask..."
162
+ url = "https://github.com/szorfein/bask/archive/v#{@version}.tar.gz"
163
+ file = "bask-#{@version}.tar.gz"
164
+
165
+ Dir.chdir("#{MOUNTPOINT}/root")
166
+ Helpers::get_file_online(url, file)
167
+ Getch::Command.new("tar xzf #{file}").run!
168
+ end
169
+ end
170
+
171
+ class Chroot < Command
172
+ def initialize(cmd)
173
+ super
174
+ @cmd = "chroot #{MOUNTPOINT} /bin/bash -c \"source /etc/profile; #{cmd}\""
175
+ end
155
176
  end
156
177
  end
@@ -0,0 +1,58 @@
1
+ module Getch
2
+ class Config
3
+ def initialize
4
+ @systemd_net_dir = "#{MOUNTPOINT}/etc/systemd"
5
+ end
6
+
7
+ def network
8
+ ethernet
9
+ wifi
10
+ resolved
11
+ Getch::Chroot.new('systemctl enable systemd-networkd').run!
12
+ Getch::Chroot.new('systemctl enable systemd-resolved').run!
13
+ end
14
+
15
+ private
16
+
17
+ def ethernet
18
+ conf = "#{@systemd_net_dir}/network/20-ethernet.network"
19
+ datas = [
20
+ "[Match]",
21
+ "Name=en*",
22
+ "Name=eth*",
23
+ "[Network]",
24
+ "DHCP=yes",
25
+ "IPv6PrivacyExtensions=yes",
26
+ "[DHCP]",
27
+ "RouteMetric=512"
28
+ ]
29
+ File.write(conf, datas.join("\n"), mode: 'w')
30
+ end
31
+
32
+ def wifi
33
+ conf = "#{@systemd_net_dir}/network/20-wireless.network"
34
+ datas = [
35
+ "[Match]",
36
+ "Name=wlp*",
37
+ "Name=wlan*",
38
+ "[Network]",
39
+ "DHCP=yes",
40
+ "IPv6PrivacyExtensions=yes",
41
+ "[DHCP]",
42
+ "RouteMetric=1024",
43
+ ]
44
+ File.write(conf, datas.join("\n"), mode: 'w')
45
+ end
46
+
47
+ def resolved
48
+ conf = "#{@systemd_net_dir}/resolved.conf.d/dns_over_tls.conf"
49
+ datas = [
50
+ "[Resolve]",
51
+ "DNS=9.9.9.9#dns.quad9.net",
52
+ "DNSOverTLS=yes",
53
+ ]
54
+ Helpers::create_dir("#{@systemd_net_dir}/resolved.conf.d")
55
+ File.write(conf, datas.join("\n"), mode: 'w')
56
+ end
57
+ end
58
+ end
@@ -3,5 +3,11 @@ module Getch
3
3
  end
4
4
  end
5
5
 
6
+ require_relative 'filesystem/device'
7
+ require_relative 'filesystem/clean'
8
+ require_relative 'filesystem/partition'
9
+ require_relative 'filesystem/mount'
10
+
6
11
  require_relative 'filesystem/ext4'
7
12
  require_relative 'filesystem/lvm'
13
+ require_relative 'filesystem/zfs'
@@ -0,0 +1,58 @@
1
+ module Getch
2
+ module FileSystem
3
+ module Clean
4
+ def self.clean_hdd(disk)
5
+ return if ! disk
6
+ raise ArgumentError, "Disk #{disk} is no found." if ! File.exist? "/dev/#{disk}"
7
+ puts
8
+ print "Cleaning data on #{disk}, can be long, avoid this on Flash Memory (SSD,USB,...) ? [y,N] "
9
+ case gets.chomp
10
+ when /^y|^Y/
11
+ bloc=`blockdev --getbsz /dev/#{disk}`.chomp
12
+ Helpers::sys("dd if=/dev/urandom of=/dev/#{disk} bs=#{bloc} status=progress")
13
+ else
14
+ return
15
+ end
16
+ end
17
+
18
+ def self.clean_struct(disk)
19
+ return if ! disk
20
+ raise ArgumentError, "Disk #{disk} is no found." if ! File.exist? "/dev/#{disk}"
21
+ Helpers::sys("sgdisk -Z /dev/#{disk}")
22
+ Helpers::sys("wipefs -a /dev/#{disk}")
23
+ end
24
+
25
+ def self.hdd(*disks)
26
+ disks.each { |d|
27
+ clean_struct(d)
28
+ clean_hdd(d)
29
+ }
30
+ end
31
+ # See https://wiki.archlinux.org/index.php/Solid_state_drive/Memory_cell_clearing
32
+ # for SSD
33
+ def self.sdd
34
+ end
35
+
36
+ def self.external_disk(root_disk, *disks)
37
+ disks.each { |d|
38
+ unless d && d != "" && d != nil && d == root_disk
39
+ hdd(d)
40
+ end
41
+ }
42
+ end
43
+
44
+ def self.old_vg(disk, vg)
45
+ oldvg = `vgdisplay | grep #{vg}`.chomp
46
+ Helpers::sys("vgremove -f #{vg}") if oldvg != ''
47
+ Helpers::sys("pvremove -f #{disk}") if oldvg != '' and File.exist? disk
48
+ end
49
+
50
+ def self.old_zpool
51
+ oldzpool = `zpool status | grep pool:`.gsub(/pool: /, '').delete(' ').split("\n")
52
+ if oldzpool[0] != "" and $?.success?
53
+ oldzpool.each { |p| Helpers::sys("zpool destroy #{p}") if p }
54
+ end
55
+ end
56
+ end
57
+ end
58
+ end