Class: SystemBuilder::DebianBoot::Chroot
- Defined in:
- lib/system_builder/boot.rb
Instance Attribute Summary collapse
-
#image ⇒ Object
readonly
Returns the value of attribute image.
Instance Method Summary collapse
- #apt_install(*packages) ⇒ Object
- #cp(*arguments) ⇒ Object
- #execute(&block) ⇒ Object
-
#initialize(image) ⇒ Chroot
constructor
A new instance of Chroot.
- #prepare_run ⇒ Object
- #sh(*arguments) ⇒ Object (also: #sudo)
- #unprepare_run ⇒ Object
Constructor Details
#initialize(image) ⇒ Chroot
Returns a new instance of Chroot.
320 321 322 |
# File 'lib/system_builder/boot.rb', line 320 def initialize(image) @image = image end |
Instance Attribute Details
#image ⇒ Object (readonly)
Returns the value of attribute image.
318 319 320 |
# File 'lib/system_builder/boot.rb', line 318 def image @image end |
Instance Method Details
#apt_install(*packages) ⇒ Object
324 325 326 |
# File 'lib/system_builder/boot.rb', line 324 def apt_install(*packages) sudo "apt-get install #{SystemBuilder::DebianBoot.} --yes --force-yes #{packages.join(' ')}" end |
#cp(*arguments) ⇒ Object
328 329 330 |
# File 'lib/system_builder/boot.rb', line 328 def cp(*arguments) sudo "cp #{arguments.join(' ')}" end |
#execute(&block) ⇒ Object
337 338 339 340 341 342 343 344 |
# File 'lib/system_builder/boot.rb', line 337 def execute(&block) begin prepare_run yield self ensure unprepare_run end end |
#prepare_run ⇒ Object
346 347 348 |
# File 'lib/system_builder/boot.rb', line 346 def prepare_run FileUtils::sudo "mount proc #{image.('/proc')} -t proc" end |