From 3509652ef7ed750106857e69077ade831f2a03af Mon Sep 17 00:00:00 2001 From: Ian Gulliver Date: Wed, 30 Mar 2016 15:39:59 -0700 Subject: [PATCH] Clean up grub.cfg --- server/build_image.py | 15 ++++++++++++--- server/iso_files/grub.cfg | 6 ++++++ 2 files changed, 18 insertions(+), 3 deletions(-) create mode 100644 server/iso_files/grub.cfg diff --git a/server/build_image.py b/server/build_image.py index c185471..7187eb9 100755 --- a/server/build_image.py +++ b/server/build_image.py @@ -4,6 +4,7 @@ import argparse import os import shutil import subprocess +import sys import tempfile @@ -31,8 +32,7 @@ parser.add_argument( parser.add_argument( '--shell', dest='shell', - action='store', - type=bool, + action='store_true', default=False) parser.add_argument( '--source-iso', @@ -55,6 +55,7 @@ class ImageBuilder(object): 'nano', 'net-tools', 'iputils-ping', + 'openssh-server', 'python3-openssl', 'sudo', 'user-setup', @@ -67,6 +68,9 @@ class ImageBuilder(object): self._archive = archive self._arch = arch self._release = release + + self._ico_server_path = os.path.dirname(sys.argv[0]) + self._umount = [] self._rmtree = [] @@ -152,10 +156,14 @@ class ImageBuilder(object): os.path.join(union_path, 'casper', 'filesystem.squashfs'), '-noappend') + def _FixGrub(self, union_path): + shutil.copyfile( + os.path.join(self._ico_server_path, 'iso_files', 'grub.cfg'), + os.path.join(union_path, 'boot', 'grub', 'loopback.cfg')) + def _CreateISO(self, union_path): self._Exec( 'grub-mkrescue', - '--verbose', '--output=%s' % self._dest_iso, union_path) @@ -172,6 +180,7 @@ class ImageBuilder(object): if FLAGS.shell: self._Exec('bash') self._Squash(chroot_path, union_path) + self._FixGrub(union_path) self._CreateISO(union_path) def BuildImage(self): diff --git a/server/iso_files/grub.cfg b/server/iso_files/grub.cfg new file mode 100644 index 0000000..3c9281a --- /dev/null +++ b/server/iso_files/grub.cfg @@ -0,0 +1,6 @@ +set timeout=5 + +menuentry "Ubuntu Server Live Image" { + linux /casper/vmlinuz.efi boot=casper iso-scan/filename=${iso_path} + initrd /casper/initrd.lz +}