KVM host image creator.Jessica Lockwood
Revisão | 324052eadf9f578b23c09867c0546f2859dc78a9 (tree) |
---|---|
Hora | 2020-06-28 23:42:38 |
Autor | Tatsuki SUGIURA <sugi@osdn...> |
Commiter | Tatsuki SUGIURA |
Fix order to enable grub config rewrite.
@@ -166,15 +166,16 @@ class ImageCreator | ||
166 | 166 | end |
167 | 167 | system("chroot", dir, "grub-mkconfig", "-o", "/boot/grub/grub.cfg") or raise "grub-mkconfig fails." |
168 | 168 | system(*%W(grub-install --no-floppy --grub-mkdevicemap=#{dir}/boot/grub/device.map --root-directory=#{dir} #{root_dev})) or raise "grub-install failed." |
169 | - cfg = File.read "#{dir}/boot/grub/grub.cfg" | |
170 | - cfg.gsub! %r{mapper/loop\d+p}, "sda" | |
171 | - File.write "#{dir}/boot/grub/grub.cfg", cfg | |
172 | 169 | |
173 | 170 | unless Array(run_cmds).empty? |
174 | 171 | Array(run_cmds).each do |cmd| |
175 | 172 | system({'DEBIAN_FRONTEND' => 'noninteractive'}, "chroot", dir, *Array(cmd)) or raise "Failed to execute command (#{cmd}): #{$!}" |
176 | 173 | end |
177 | 174 | end |
175 | + | |
176 | + cfg = File.read "#{dir}/boot/grub/grub.cfg" | |
177 | + cfg.gsub! %r{mapper/loop\d+p}, "sda" | |
178 | + File.write "#{dir}/boot/grub/grub.cfg", cfg | |
178 | 179 | ensure |
179 | 180 | system("umount", "#{dir}/dev") |
180 | 181 | system("umount", "#{dir}/proc") |