getch 0.0.7 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) 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 +43 -4
  5. data/README.md +61 -8
  6. data/bin/setup.sh +5 -3
  7. data/lib/getch.rb +38 -13
  8. data/lib/getch/command.rb +138 -16
  9. data/lib/getch/filesystem.rb +7 -0
  10. data/lib/getch/filesystem/clean.rb +51 -0
  11. data/lib/getch/filesystem/device.rb +61 -0
  12. data/lib/getch/filesystem/ext4.rb +1 -0
  13. data/lib/getch/filesystem/ext4/config.rb +9 -9
  14. data/lib/getch/filesystem/ext4/device.rb +2 -7
  15. data/lib/getch/filesystem/ext4/encrypt/config.rb +70 -47
  16. data/lib/getch/filesystem/ext4/encrypt/deps.rb +25 -12
  17. data/lib/getch/filesystem/ext4/encrypt/device.rb +5 -9
  18. data/lib/getch/filesystem/ext4/encrypt/format.rb +10 -6
  19. data/lib/getch/filesystem/ext4/encrypt/mount.rb +6 -43
  20. data/lib/getch/filesystem/ext4/encrypt/partition.rb +57 -55
  21. data/lib/getch/filesystem/ext4/format.rb +10 -6
  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.rb +14 -0
  25. data/lib/getch/filesystem/lvm/config.rb +63 -0
  26. data/lib/getch/filesystem/lvm/deps.rb +48 -0
  27. data/lib/getch/filesystem/lvm/device.rb +43 -0
  28. data/lib/getch/filesystem/lvm/encrypt.rb +15 -0
  29. data/lib/getch/filesystem/lvm/encrypt/config.rb +74 -0
  30. data/lib/getch/filesystem/lvm/encrypt/deps.rb +53 -0
  31. data/lib/getch/filesystem/lvm/encrypt/device.rb +46 -0
  32. data/lib/getch/filesystem/lvm/encrypt/format.rb +32 -0
  33. data/lib/getch/filesystem/lvm/encrypt/mount.rb +25 -0
  34. data/lib/getch/filesystem/lvm/encrypt/partition.rb +80 -0
  35. data/lib/getch/filesystem/lvm/format.rb +29 -0
  36. data/lib/getch/filesystem/lvm/mount.rb +23 -0
  37. data/lib/getch/filesystem/lvm/partition.rb +69 -0
  38. data/lib/getch/filesystem/mount.rb +56 -0
  39. data/lib/getch/filesystem/partition.rb +77 -0
  40. data/lib/getch/filesystem/zfs.rb +14 -0
  41. data/lib/getch/filesystem/zfs/config.rb +57 -0
  42. data/lib/getch/filesystem/zfs/deps.rb +97 -0
  43. data/lib/getch/filesystem/zfs/device.rb +58 -0
  44. data/lib/getch/filesystem/zfs/encrypt.rb +15 -0
  45. data/lib/getch/filesystem/zfs/encrypt/config.rb +67 -0
  46. data/lib/getch/filesystem/zfs/encrypt/deps.rb +100 -0
  47. data/lib/getch/filesystem/zfs/encrypt/device.rb +60 -0
  48. data/lib/getch/filesystem/zfs/encrypt/format.rb +105 -0
  49. data/lib/getch/filesystem/zfs/encrypt/mount.rb +51 -0
  50. data/lib/getch/filesystem/zfs/encrypt/partition.rb +65 -0
  51. data/lib/getch/filesystem/zfs/format.rb +114 -0
  52. data/lib/getch/filesystem/zfs/mount.rb +48 -0
  53. data/lib/getch/filesystem/zfs/partition.rb +64 -0
  54. data/lib/getch/gentoo.rb +2 -2
  55. data/lib/getch/gentoo/boot.rb +25 -14
  56. data/lib/getch/gentoo/chroot.rb +18 -30
  57. data/lib/getch/gentoo/config.rb +38 -11
  58. data/lib/getch/gentoo/sources.rb +34 -40
  59. data/lib/getch/gentoo/stage.rb +1 -1
  60. data/lib/getch/helpers.rb +35 -13
  61. data/lib/getch/log.rb +54 -0
  62. data/lib/getch/options.rb +24 -8
  63. data/lib/getch/version.rb +1 -1
  64. metadata +51 -18
  65. metadata.gz.sig +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: eb6075f7c63fb0a9b3d9cae63e24aae84cb3c90947985aa54ba48bc0dd284dcc
4
- data.tar.gz: 26ad192fed5685f42e62d400706d6127c3d28a0fc5ce67296da6ef758955de25
3
+ metadata.gz: 476822c82abc15e37ab19b3e111b4b4109beb127fb775a9075757948c9e202a4
4
+ data.tar.gz: 1a2290c23d28c9fb0fa45ac47882698ad4f61dfe10f699804ab53162ea337e00
5
5
  SHA512:
6
- metadata.gz: fe321ca0175f95f07c68026269830932609ba2fe5a1757efb7228bc26a069c4f5c322b21c534d05077c98a4dddfb0ed33bb2aa2fb30b1bc2df234e25b47acb56
7
- data.tar.gz: 5b3540c9a1f07162bfbb3e4772f78c0b74b9525ec74fed7ce71c507da5f58befc85e6f8198abc595b49fa767abc77349f56b0ab9790d56730c45771365268fb0
6
+ metadata.gz: 6b299fd1b7b9daa4be76a482ed768e85c2372c847a7f18e4ffaebf173d8d80fddbfe9b4fccc42f3037e51d53751acaf7d12f26e87b7e68fad385d280223c8471
7
+ data.tar.gz: 2e97a961aaa0e8a5380fa61f1dafaa958d8941287d2c16e6d493038e6bb52f94153aeb35d5762f1b8347eef8f85f0be496ca372fac6ff070caaf03b94c237b0e
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
data/CHANGELOG.md CHANGED
@@ -1,7 +1,46 @@
1
- * Repair GRUB/fstab for BIOS system, add config and all
2
- * New option --encrypt (LVM/EXT4/LUKS for now)
3
- * Adding LVM
4
- * Create a swap volume equal to the memory installed
1
+ ## 0.1.2, release 2021-05-12
2
+ * DOCS update.
3
+ * Keep Nano for those who need :)
4
+ * ZFS use the last version >=2.0 with kernel stable =5.10
5
+ * ZFS create a Log device and Cache device if getch is used with `--separate-cache`.
6
+ * GRUB or Systemd-boot can now be installed on separate disk with `--separate-boot`.
7
+ * Adding flag for ZFS `-o autotrim=on` (used with `zpool create`).
8
+ * Encrypted swap use: `cipher=aes-xts-plain64:sha256,size=512` by default.
9
+ * In the make.conf: add `-fomit-frame-pointer`, designed to reduce generated code size.
10
+
11
+ ## 0.1.1, release 2020-11-01
12
+ * Change mountpoint for the esp at /efi rather than /boot/efi
13
+ * Replace Garden by Bask https://github.com/szorfein/bask
14
+ * Correct option --username USERNAME, do not create a new partition.
15
+ * New set of options --separate-{boot,cache,home} to install them on another disk
16
+ * Refactor codes
17
+ * Add cpu name to COMMON_FLAGS
18
+ * Add cpuflags with app-portage/cpuid2cpuflags
19
+ + Use the whole disk space available for / when option --username is unset
20
+
21
+ ## 0.1.0, release 2020-10-15
22
+ * Add the (Zeta) filesystem ZFS
23
+ * `emerge --depclean` to save space.
24
+ * Add a message when getch have finish, keep /mnt/gentoo if you need to add something.
25
+ * Use systemd-detect-virt to detect a Virtual Guest.
26
+
27
+ ## 0.0.9, release 2020-10-03
28
+ * Add encryption on ext4 and lvm (BIOS,UEFI)
29
+ * Correct KEYMAP="yes" with genkernel
30
+ * Renaming option keyboard with keymap
31
+ * GPG verification for ebuild
32
+
33
+ ## 0.0.8, release 2020-09-30
34
+ * Adding LVM via the option fs, `--fs lvm`.
35
+ * Systemd-boot use the value of PARTUUID without initramfs.
36
+ * Include lib logger.
37
+ * Enhance functions to call program system Emerge, Make, ...
38
+
39
+ ## 0.0.7, release 2020-09-22
40
+ * Correct fstab.
41
+ * Repair GRUB/fstab for BIOS system, add secure cmdline.
42
+ * Create a swap volume equal to the memory installed.
43
+ * Add vim and sudo
5
44
 
6
45
  ## 0.0.6, release 2020-09-19
7
46
  * Add support for QEMU guest with KVM and Virtio driver
data/README.md CHANGED
@@ -3,15 +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
- Filesystem supported by Getch are: (the list will evolve...)
9
- + ext4 with GRUB2 for BIOS based system and systemd-boot for UEFI systems.
7
+ BIOS system will use `Grub2` and `systemd-boot` for UEFI. Filesystem supported by Getch are for now:
8
+ + Ext4
9
+ + LVM
10
+ + ZFS
10
11
 
11
- I would also add disk encryption soon.
12
+ Encryption is also supported.
12
13
 
13
14
  The ISO images i was able to test and that works:
14
15
  + [Archlinux](https://www.archlinux.org/download/)
16
+ + [Archaeidae](https://github.com/szorfein/archaeidae): Custom Archiso that includes ZFS support.
15
17
 
16
18
  ## Install
17
19
  Getch is cryptographically signed, so add my public key (if you haven’t already) as a trusted certificate.
@@ -23,19 +25,70 @@ With `gem` installed:
23
25
 
24
26
  When you boot from an `iso`, you can install `ruby`, `getch` and correct your `PATH=` directly with the `bin/setup.sh`:
25
27
 
26
- # curl https://raw.githubusercontent.com/szorfein/getch/master/bin/setup.sh | sh
28
+ # sh <(curl -L https://raw.githubusercontent.com/szorfein/getch/master/bin/setup.sh)
27
29
  # source ~/.zshrc # or ~/.bashrc
28
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
+
29
37
  ## Usage
38
+ Just ensure than the script is run with a root account.
39
+
40
+ # getch -h
30
41
 
31
- $ getch -h
42
+ After an install by Getch, take a look on the [wiki](https://github.com/szorfein/getch/wiki).
32
43
 
33
44
  ## Examples
34
45
  For a french user:
35
46
 
36
- # getch --username ninja --zoneinfo "Europe/Paris" --language fr_FR --keyboard fr
47
+ # getch --zoneinfo "Europe/Paris" --language fr_FR --keymap fr
37
48
 
38
- After an install by Getch, take a look on the [wiki](https://github.com/szorfein/getch/wiki).
49
+ Install Gentoo on LVM:
50
+
51
+ # getch --format lvm --disk sda
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
+
65
+ ## Troubleshooting
66
+
67
+ #### LVM
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 two times. One time for Grub and another time for the initramfs (Genkernel). [post](https://wiki.archlinux.org/index.php/GRUB#Encrypted_/boot).
76
+ Also with GRUB, only a `us` keymap is working.
77
+
78
+ #### With ZFS
79
+ When Gentoo boot, the pool may fail to start, it's happen when the pool has not been `export` to the ISO. So just reboot on your ISO:
80
+
81
+ You need the partuuid, pool are create with the first 5 characters, just replace `sdX` by your real device:
82
+
83
+ # ls -l /dev/disk/by-partuuid/ | grep sdX4
84
+ -> 150ed969...
85
+ # zpool import -N -R /mnt rpool-150ed
86
+
87
+ And export them correctly:
88
+
89
+ # zpool export -a
90
+
91
+ It's all.
39
92
 
40
93
  ## Issues
41
94
  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:
data/bin/setup.sh CHANGED
@@ -26,7 +26,7 @@ search_ruby() {
26
26
  else
27
27
  echo "Install ruby"
28
28
  if hash pacman 2>/dev/null ; then
29
- pacman -Syy libyaml ruby ruby-irb ruby-reline rubygems
29
+ pacman -Syy --noconfirm libyaml ruby ruby-irb ruby-reline rubygems
30
30
  elif hash emerge 2>/dev/null ; then
31
31
  emerge -av dev-lang/ruby
32
32
  elif hash apt-get 2>/dev/null ; then
@@ -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
@@ -4,16 +4,20 @@ require_relative 'getch/gentoo'
4
4
  require_relative 'getch/filesystem'
5
5
  require_relative 'getch/command'
6
6
  require_relative 'getch/helpers'
7
+ require_relative 'getch/log'
7
8
 
8
9
  module Getch
9
10
 
10
11
  DEFAULT_OPTIONS = {
11
12
  language: 'en_US',
12
13
  zoneinfo: 'US/Eastern',
13
- keyboard: 'us',
14
+ keymap: 'us',
14
15
  disk: 'sda',
15
16
  fs: 'ext4',
16
17
  username: nil,
18
+ boot_disk: nil,
19
+ cache_disk: nil,
20
+ home_disk: nil,
17
21
  encrypt: false,
18
22
  verbose: false
19
23
  }
@@ -29,19 +33,38 @@ module Getch
29
33
  }
30
34
 
31
35
  MOUNTPOINT = "/mnt/gentoo".freeze
32
- OPTIONS_FS = {
33
- 'ext4' => DEFAULT_OPTIONS[:encrypt] ? Getch::FileSystem::Ext4::Encrypt : Getch::FileSystem::Ext4
36
+ DEFAULT_FS = {
37
+ true => {
38
+ ext4: Getch::FileSystem::Ext4::Encrypt,
39
+ lvm: Getch::FileSystem::Lvm::Encrypt,
40
+ zfs: Getch::FileSystem::Zfs::Encrypt
41
+ },
42
+ false => {
43
+ ext4: Getch::FileSystem::Ext4,
44
+ lvm: Getch::FileSystem::Lvm,
45
+ zfs: Getch::FileSystem::Zfs,
46
+ }
34
47
  }.freeze
35
48
 
49
+ def self.class_fs
50
+ encrypt = DEFAULT_OPTIONS[:encrypt]
51
+ fs = DEFAULT_OPTIONS[:fs].to_sym
52
+ DEFAULT_FS[encrypt][fs]
53
+ end
54
+
36
55
  def self.resume_options(opts)
37
56
  puts "\nBuild Gentoo with the following args:\n"
38
- puts "lang: #{DEFAULT_OPTIONS[:language]}"
39
- puts "zoneinfo: #{DEFAULT_OPTIONS[:zoneinfo]}"
40
- puts "keyboard: #{DEFAULT_OPTIONS[:keyboard]}"
41
- puts "disk: #{DEFAULT_OPTIONS[:disk]}"
42
- puts "fs: #{DEFAULT_OPTIONS[:fs]}"
43
- puts "username: #{DEFAULT_OPTIONS[:username]}"
44
- puts "encrypt: #{DEFAULT_OPTIONS[:encrypt]}"
57
+ puts "Lang: #{DEFAULT_OPTIONS[:language]}"
58
+ puts "Zoneinfo: #{DEFAULT_OPTIONS[:zoneinfo]}"
59
+ puts "Keymap: #{DEFAULT_OPTIONS[:keymap]}"
60
+ puts "Disk: #{DEFAULT_OPTIONS[:disk]}"
61
+ puts "Filesystem: #{DEFAULT_OPTIONS[:fs]}"
62
+ puts "Username: #{DEFAULT_OPTIONS[:username]}"
63
+ puts "Encrypt: #{DEFAULT_OPTIONS[:encrypt]}"
64
+ puts
65
+ puts "separate-boot disk: #{DEFAULT_OPTIONS[:boot_disk]}"
66
+ puts "separate-cache disk: #{DEFAULT_OPTIONS[:cache_disk]}"
67
+ puts "separate-home disk: #{DEFAULT_OPTIONS[:home_disk]}"
45
68
  puts
46
69
  print "Continue? (n,y) "
47
70
  case gets.chomp
@@ -54,12 +77,14 @@ module Getch
54
77
 
55
78
  def self.format(disk, fs, user)
56
79
  return if STATES[:format] and STATES[:partition]
80
+ log = Log.new
57
81
  puts
58
82
  print "Partition and format disk #{disk}, this will erase all data, continue? (n,y) "
59
83
  case gets.chomp
60
84
  when /^y|^Y/
61
- OPTIONS_FS[fs]::Partition.new
62
- OPTIONS_FS[fs]::Format.new
85
+ log.info("Partition start")
86
+ class_fs::Partition.new
87
+ class_fs::Format.new
63
88
  else
64
89
  exit 1
65
90
  end
@@ -80,7 +105,7 @@ module Getch
80
105
  resume_options(options)
81
106
  Getch::States.new # Update States
82
107
  format(options.disk, options.fs, options.username)
83
- OPTIONS_FS[DEFAULT_OPTIONS[:fs]]::Mount.new.run
108
+ class_fs::Mount.new.run
84
109
  init_gentoo(options)
85
110
  end
86
111
  end
data/lib/getch/command.rb CHANGED
@@ -4,14 +4,22 @@ module Getch
4
4
  class Command
5
5
  def initialize(cmd)
6
6
  @cmd = cmd
7
- @block_size = 512
7
+ @block_size = 1024
8
+ @log = Getch::Log.new
8
9
  end
9
10
 
10
11
  def run!
11
- puts "Running command: " + @cmd.gsub(/\"/, '')
12
+ @log.info "Running command: " + @cmd.gsub(/\"/, '')
12
13
 
13
- Open3.popen3(@cmd) do |stdin, stdout, stderr|
14
+ Open3.popen3(@cmd) do |stdin, stdout, stderr, wait_thr|
14
15
  stdin.close_write
16
+ code = wait_thr.value
17
+
18
+ # only stderr
19
+ begin
20
+ @log.debug stderr.readline until stderr.eof.nil?
21
+ rescue EOFError
22
+ end
15
23
 
16
24
  begin
17
25
  files = [stdout, stderr]
@@ -24,25 +32,20 @@ module Getch
24
32
  # writable = ready[1]
25
33
  # exceptions = ready[2]
26
34
 
27
- readable.each do |f|
28
- fileno = f.fileno
29
-
30
- begin
31
- data = f.read_nonblock(@block_size)
32
-
33
- # Do something with the data...
34
- puts "#{data}" if DEFAULT_OPTIONS[:verbose]
35
- rescue EOFError
36
- puts "fileno: #{fileno} EOF"
37
- end
38
- end
35
+ display_lines(readable)
39
36
  end
40
37
  end
41
38
  rescue IOError => e
42
39
  puts "IOError: #{e}"
43
40
  end
41
+
42
+ unless code.success?
43
+ @log.fatal "Running #{@cmd}"
44
+ exit 1
45
+ end
46
+
47
+ @log.debug "Done - #{@cmd} - #{code}"
44
48
  end
45
- puts "Done"
46
49
  end
47
50
 
48
51
  private
@@ -51,5 +54,124 @@ module Getch
51
54
  def all_eof(files)
52
55
  files.find { |f| !f.eof }.nil?
53
56
  end
57
+
58
+ def display_lines(block)
59
+ block.each do |f|
60
+ begin
61
+ data = f.read_nonblock(@block_size)
62
+ puts data if DEFAULT_OPTIONS[:verbose]
63
+ rescue EOFError
64
+ puts ""
65
+ rescue => e
66
+ puts "Fatal - #{e}"
67
+ end
68
+ end
69
+ end
70
+ end
71
+
72
+ # Use system, the only ruby method to display stdout with colors !
73
+ class Emerge
74
+ def initialize(cmd)
75
+ @gentoo = MOUNTPOINT
76
+ @cmd = cmd
77
+ @log = Getch::Log.new
78
+ end
79
+
80
+ def run!
81
+ @log.info "Running emerge: #{@cmd}"
82
+ system("chroot", @gentoo, "/bin/bash", "-c", "source /etc/profile && #{@cmd}")
83
+ read_exit
84
+ end
85
+
86
+ def pkg!
87
+ @log.info "Running emerge pkg: #{@cmd}"
88
+ system("chroot", @gentoo, "/bin/bash", "-c", "source /etc/profile && emerge --changed-use #{@cmd}")
89
+ read_exit
90
+ end
91
+
92
+ private
93
+
94
+ def read_exit
95
+ if $?.exitstatus > 0
96
+ @log.fatal "Running #{@cmd}"
97
+ else
98
+ @log.info "Done #{@cmd}"
99
+ end
100
+ end
101
+ end
102
+
103
+ class Make
104
+ def initialize(cmd)
105
+ @gentoo = MOUNTPOINT
106
+ @cmd = cmd
107
+ @log = Getch::Log.new
108
+ end
109
+
110
+ def run!
111
+ @log.info "Running Make: #{@cmd}"
112
+ cmd = "chroot #{@gentoo} /bin/bash -c \"source /etc/profile \
113
+ && env-update \
114
+ && cd /usr/src/linux \
115
+ && #{@cmd}\""
116
+ Open3.popen2e(cmd) do |stdin, stdout_err, wait_thr|
117
+ while line = stdout_err.gets
118
+ puts line
119
+ end
120
+
121
+ exit_status = wait_thr.value
122
+ unless exit_status.success?
123
+ @log.fatal "Running #{cmd}"
124
+ exit 1
125
+ end
126
+ end
127
+ end
128
+ end
129
+
130
+ class Bask
131
+ def initialize(cmd)
132
+ @gentoo = MOUNTPOINT
133
+ @cmd = cmd
134
+ @log = Getch::Log.new
135
+ @version = "0.4"
136
+ end
137
+
138
+ def run!
139
+ download_bask if ! Dir.exist? "#{MOUNTPOINT}/root/bask-#{@version}"
140
+ @log.info "Running Bask: #{@cmd}"
141
+ cmd = "chroot #{@gentoo} /bin/bash -c \"source /etc/profile \
142
+ && env-update \
143
+ && cd /root/bask-#{@version} \
144
+ && ./bask.sh #{@cmd} -k /usr/src/linux\""
145
+ Open3.popen2e(cmd) do |stdin, stdout_err, wait_thr|
146
+ while line = stdout_err.gets
147
+ puts line
148
+ end
149
+
150
+ exit_status = wait_thr.value
151
+ unless exit_status.success?
152
+ @log.fatal "Running #{cmd}"
153
+ exit 1
154
+ end
155
+ end
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
54
176
  end
55
177
  end