From: Tatsuki SUGIURA Date: Fri, 26 Jun 2020 07:16:04 +0000 (+0900) Subject: Update to suport squeeze machine. X-Git-Url: http://git.osdn.net/view?p=osdn-codes%2Fimage-creator.git;a=commitdiff_plain;h=bbc168c0f1c97d86db760038361ab3efa43260ff Update to suport squeeze machine. --- diff --git a/create-image b/create-image index 0c4b2a9..2af4aaa 100755 --- a/create-image +++ b/create-image @@ -130,7 +130,7 @@ class ImageCreator system("mount", di.device, "#{dir}#{di.path}") or raise "Failed to mount #{di.device} to #{dir}#{path}" end - system "rm", "-f", "#{dir}/etc/systemd/system/udev.service", "#{dir}/etc/systemd/system/systemd-udevd.service" + 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" puts "Rewrite fstab..." File.open "#{dir}/etc/fstab", "w" do |f| @@ -149,7 +149,7 @@ class ImageCreator system("chroot", dir, "dpkg", "-i", "/tmp/linux.deb") system({'DEBIAN_FRONTEND' => 'noninteractive'}, "chroot", dir, "apt", "install", "-f", "-y") or raise "Failed to install jessie kernel" else - system({'DEBIAN_FRONTEND' => 'noninteractive'}, "chroot", dir, "apt-get", "-y", "install", "linux-image-amd64") + system({'DEBIAN_FRONTEND' => 'noninteractive'}, "chroot", dir, "apt-get", "-y", "--allow-unauthenticated", "install", "linux-image-amd64") end puts "Update grub..." @@ -165,6 +165,9 @@ class ImageCreator end system("chroot", dir, "grub-mkconfig", "-o", "/boot/grub/grub.cfg") or raise "grub-mkconfig fails." system(*%W(grub-install --no-floppy --grub-mkdevicemap=#{dir}/boot/grub/device.map --root-directory=#{dir} #{root_dev})) or raise "grub-install failed." + cfg = File.read "#{dir}/boot/grub/grub.cfg" + cfg.gsub! %r{mapper/loop0p}, "sda" + File.write "#{dir}/boot/grub/grub.cfg", cfg ensure system("umount", "#{dir}/dev") system("umount", "#{dir}/proc")