KVM host image creator.Jessica Lockwood
修訂 | 6dd5421cee42f0dbb084861e27fc070a40c45603 (tree) |
---|---|
時間 | 2019-10-08 13:37:17 |
作者 | Tatsuki Sugiura <sugi@nemu...> |
Commiter | Tatsuki Sugiura |
Install jessie kernel forcely to keep compat with Amazon's image importer.
@@ -139,7 +139,16 @@ class ImageCreator | ||
139 | 139 | end |
140 | 140 | |
141 | 141 | system("chroot", dir, "apt-get", "-qy", "update") |
142 | - system("chroot", dir, "apt-get", "-y", "install", "linux-image-amd64") | |
142 | + if File.read("#{dir}/etc/debian_version").to_f >= 9.0 | |
143 | + # Note: 2019-10-08 時点で Debian9 のカーネルバージョンに対応していないので、エラー回避のために既存のカーネルを全て削除し、強制的に jessie のカーネルをイントールする | |
144 | + system("rm", "-f", "#{dir}/var/lib/dpkg/info/linux-image-#{`uname -r`.chomp}.prerm") | |
145 | + system({'DEBIAN_FRONTEND' => 'noninteractive'}, "chroot", dir, "apt", "remove", "--purge", "-y", "linux-image-*") | |
146 | + system("wget", "-O", "#{dir}/tmp/linux.deb", "http://security.debian.org/debian-security/pool/updates/main/l/linux/linux-image-3.16.0-10-amd64_3.16.74-1_amd64.deb") or raise "Failed to get jessie kernel" | |
147 | + system("chroot", dir, "dpkg", "-i", "/tmp/linux.deb") | |
148 | + system("chroot", dir, "apt", "install", "-f", "-y") or raise "Failed to install jessie kernel" | |
149 | + else | |
150 | + system("chroot", dir, "apt-get", "-y", "install", "linux-image-amd64") | |
151 | + end | |
143 | 152 | |
144 | 153 | puts "Update grub..." |
145 | 154 | unless File.exists? "#{dir}/usr/sbin/grub-mkconfig" |