next level

This commit is contained in:
Denis Knauf 2018-12-25 21:33:57 +01:00
parent 3eb91f4708
commit ec88e37571
9 changed files with 591 additions and 5 deletions

View file

@ -1,6 +1,6 @@
require 'to_lvm_xfs'
class Raspibian < Base
class Raspbian < Base
def initialize *args
@vgname = "raspi_#{SecureRandom.urlsafe_base64 5}"
super *args
@ -57,13 +57,17 @@ class Raspibian < Base
sh.mkxfs -:Lhome, vgpath+'home'
mount vgpath+'root', dest.root
addmp = {}
%i[home boot].each do |n|
%i[home boot dev proc sys].each do |n|
d = addmp[n] = dest.root+n.to_s
d.mkdir
end
mount vgpath+'home', addmp[:home]
mount dest_parts[0], addmp[:boot]
mount '/dev', addmp[:dev], --:bind
mount 'proc', addmp[:proc], -:tproc
mount 'sysfs', addmp[:sys], -:tsysfs
sh.rsync_all "#{base.root}/", dest.root
#sh.rsync *%w[kernel7.img initrd7.img], addmp[:boot]
@ -143,7 +147,7 @@ class Raspibian < Base
msg :copy, "/usr/bin/qemu-arm-static"
qemu_bin.copy '/usr/bin/qemu-arm-static', preserve: true
ish = sh.chroot dest.root
ish = sh.chroot( dest.root).chdir( '/')
ish.apt :update
ish.apt :upgrade, -:y
ish.apt :update

View file

@ -87,7 +87,6 @@ class Sh
else Fork
end
cl.new do
Dir.chdir @shell.opts[:pwd] if @shell.opts[:pwd]
cmd = @command.to_s
$0 = cmd
#STDERR.printf "\n|\n| %p\n|\n", cmd: cmd, args: @args
@ -101,6 +100,10 @@ class Sh
STDERR.printf "\e[1;34mchroot(%s)\e[0m ", opts[:chroot].to_s
Dir.chroot opts[:chroot].to_s
end
if @shell.opts[:pwd]
STDERR.printf "%s ", @shell.opts[:pwd]
Dir.chdir @shell.opts[:pwd]
end
#STDERR.puts "\e[0m#{opts[:return] ? '<=' : '#'} \e[33m#{cmd.shellescape} \e[35m#{usable_args.shelljoin}\e[0m"
STDERR.printf "\e[0m%s \e[33m%s \e[35m%s\e[0m\n",
opts[:return] ? '<=' : '#',