• R/O
  • HTTP
  • SSH
  • HTTPS

image-creator: コミット

KVM host image creator.


コミットメタ情報

リビジョンbbc168c0f1c97d86db760038361ab3efa43260ff (tree)
日時2020-06-26 16:16:04
作者Tatsuki SUGIURA <sugi@osdn...>
コミッターTatsuki SUGIURA

ログメッセージ

Update to suport squeeze machine.

変更サマリ

差分

--- a/create-image
+++ b/create-image
@@ -130,7 +130,7 @@ class ImageCreator
130130 system("mount", di.device, "#{dir}#{di.path}") or raise "Failed to mount #{di.device} to #{dir}#{path}"
131131 end
132132
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"
134134
135135 puts "Rewrite fstab..."
136136 File.open "#{dir}/etc/fstab", "w" do |f|
@@ -149,7 +149,7 @@ class ImageCreator
149149 system("chroot", dir, "dpkg", "-i", "/tmp/linux.deb")
150150 system({'DEBIAN_FRONTEND' => 'noninteractive'}, "chroot", dir, "apt", "install", "-f", "-y") or raise "Failed to install jessie kernel"
151151 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")
153153 end
154154
155155 puts "Update grub..."
@@ -165,6 +165,9 @@ class ImageCreator
165165 end
166166 system("chroot", dir, "grub-mkconfig", "-o", "/boot/grub/grub.cfg") or raise "grub-mkconfig fails."
167167 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
168171 ensure
169172 system("umount", "#{dir}/dev")
170173 system("umount", "#{dir}/proc")
旧リポジトリブラウザで表示