• R/O
  • HTTP
  • SSH
  • HTTPS

image-creator: Commit

KVM host image creator.


Commit MetaInfo

Révision6dd5421cee42f0dbb084861e27fc070a40c45603 (tree)
l'heure2019-10-08 13:37:17
AuteurTatsuki Sugiura <sugi@nemu...>
CommiterTatsuki Sugiura

Message de Log

Install jessie kernel forcely to keep compat with Amazon's image importer.

Change Summary

Modification

--- a/create-image
+++ b/create-image
@@ -139,7 +139,16 @@ class ImageCreator
139139 end
140140
141141 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
143152
144153 puts "Update grub..."
145154 unless File.exists? "#{dir}/usr/sbin/grub-mkconfig"
Afficher sur ancien navigateur de dépôt.