KVM host image creator.Jessica Lockwood
Revisión | bbc168c0f1c97d86db760038361ab3efa43260ff (tree) |
---|---|
Tiempo | 2020-06-26 16:16:04 |
Autor | Tatsuki SUGIURA <sugi@osdn...> |
Commiter | Tatsuki SUGIURA |
Update to suport squeeze machine.
@@ -130,7 +130,7 @@ class ImageCreator | ||
130 | 130 | system("mount", di.device, "#{dir}#{di.path}") or raise "Failed to mount #{di.device} to #{dir}#{path}" |
131 | 131 | end |
132 | 132 | |
133 | - system "rm", "-f", "#{dir}/etc/systemd/system/udev.service", "#{dir}/etc/systemd/system/systemd-udevd.service" | |
133 | + system "rm", "-f", "#{dir}/etc/systemd/system/udev.service", "#{dir}/etc/systemd/system/systemd-udevd.service", "#{dir}/etc/udev/rules.d/70-persistent-net.rules" | |
134 | 134 | |
135 | 135 | puts "Rewrite fstab..." |
136 | 136 | File.open "#{dir}/etc/fstab", "w" do |f| |
@@ -149,7 +149,7 @@ class ImageCreator | ||
149 | 149 | system("chroot", dir, "dpkg", "-i", "/tmp/linux.deb") |
150 | 150 | system({'DEBIAN_FRONTEND' => 'noninteractive'}, "chroot", dir, "apt", "install", "-f", "-y") or raise "Failed to install jessie kernel" |
151 | 151 | else |
152 | - system({'DEBIAN_FRONTEND' => 'noninteractive'}, "chroot", dir, "apt-get", "-y", "install", "linux-image-amd64") | |
152 | + system({'DEBIAN_FRONTEND' => 'noninteractive'}, "chroot", dir, "apt-get", "-y", "--allow-unauthenticated", "install", "linux-image-amd64") | |
153 | 153 | end |
154 | 154 | |
155 | 155 | puts "Update grub..." |
@@ -165,6 +165,9 @@ class ImageCreator | ||
165 | 165 | end |
166 | 166 | system("chroot", dir, "grub-mkconfig", "-o", "/boot/grub/grub.cfg") or raise "grub-mkconfig fails." |
167 | 167 | system(*%W(grub-install --no-floppy --grub-mkdevicemap=#{dir}/boot/grub/device.map --root-directory=#{dir} #{root_dev})) or raise "grub-install failed." |
168 | + cfg = File.read "#{dir}/boot/grub/grub.cfg" | |
169 | + cfg.gsub! %r{mapper/loop0p}, "sda" | |
170 | + File.write "#{dir}/boot/grub/grub.cfg", cfg | |
168 | 171 | ensure |
169 | 172 | system("umount", "#{dir}/dev") |
170 | 173 | system("umount", "#{dir}/proc") |