OSDN Git Service

Update to suport squeeze machine.
authorTatsuki SUGIURA <sugi@osdn.jp>
Fri, 26 Jun 2020 07:16:04 +0000 (16:16 +0900)
committerTatsuki SUGIURA <sugi@osdn.jp>
Fri, 26 Jun 2020 07:16:04 +0000 (16:16 +0900)
create-image

index 0c4b2a9..2af4aaa 100755 (executable)
@@ -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")