class Getch::Bask
Public Class Methods
new(cmd)
click to toggle source
# File lib/getch/command.rb, line 131 def initialize(cmd) @gentoo = MOUNTPOINT @cmd = cmd @log = Getch::Log.new @version = "0.5" end
Public Instance Methods
run!()
click to toggle source
# File lib/getch/command.rb, line 138 def run! download_bask if ! Dir.exist? "#{MOUNTPOINT}/root/bask-#{@version}" @log.info "Running Bask: #{@cmd}" cmd = "chroot #{@gentoo} /bin/bash -c \"source /etc/profile \ && env-update \ && cd /root/bask-#{@version} \ && ./bask.sh #{@cmd} -k /usr/src/linux\"" Open3.popen2e(cmd) do |stdin, stdout_err, wait_thr| while line = stdout_err.gets puts line end exit_status = wait_thr.value unless exit_status.success? @log.fatal "Running #{cmd}" exit 1 end end end
Private Instance Methods
download_bask()
click to toggle source
# File lib/getch/command.rb, line 160 def download_bask @log.info "Installing Bask..." url = "https://github.com/szorfein/bask/archive/v#{@version}.tar.gz" file = "bask-#{@version}.tar.gz" Dir.chdir("#{MOUNTPOINT}/root") Helpers::get_file_online(url, file) Getch::Command.new("tar xzf #{file}").run! end