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.
155 156 157 |
# File 'lib/system_builder/boot.rb', line 155 def initialize(image) @image = image end |
Instance Attribute Details
#image ⇒ Object (readonly)
Returns the value of attribute image.
153 154 155 |
# File 'lib/system_builder/boot.rb', line 153 def image @image end |
Instance Method Details
#apt_install(*packages) ⇒ Object
159 160 161 |
# File 'lib/system_builder/boot.rb', line 159 def apt_install(*packages) sudo "apt-get install --yes --force-yes #{packages.join(' ')}" end |
#cp(*arguments) ⇒ Object
163 164 165 |
# File 'lib/system_builder/boot.rb', line 163 def cp(*arguments) sudo "cp #{arguments.join(' ')}" end |
#execute(&block) ⇒ Object
172 173 174 175 176 177 178 179 |
# File 'lib/system_builder/boot.rb', line 172 def execute(&block) begin prepare_run yield self ensure unprepare_run end end |
#prepare_run ⇒ Object
181 182 183 |
# File 'lib/system_builder/boot.rb', line 181 def prepare_run FileUtils::sudo "mount proc #{image.('/proc')} -t proc" end |