Clean up grub.cfg

This commit is contained in:
Ian Gulliver
2016-03-30 15:39:59 -07:00
parent 58300fd7e6
commit 3509652ef7
2 changed files with 18 additions and 3 deletions

View File

@@ -4,6 +4,7 @@ import argparse
import os import os
import shutil import shutil
import subprocess import subprocess
import sys
import tempfile import tempfile
@@ -31,8 +32,7 @@ parser.add_argument(
parser.add_argument( parser.add_argument(
'--shell', '--shell',
dest='shell', dest='shell',
action='store', action='store_true',
type=bool,
default=False) default=False)
parser.add_argument( parser.add_argument(
'--source-iso', '--source-iso',
@@ -55,6 +55,7 @@ class ImageBuilder(object):
'nano', 'nano',
'net-tools', 'net-tools',
'iputils-ping', 'iputils-ping',
'openssh-server',
'python3-openssl', 'python3-openssl',
'sudo', 'sudo',
'user-setup', 'user-setup',
@@ -67,6 +68,9 @@ class ImageBuilder(object):
self._archive = archive self._archive = archive
self._arch = arch self._arch = arch
self._release = release self._release = release
self._ico_server_path = os.path.dirname(sys.argv[0])
self._umount = [] self._umount = []
self._rmtree = [] self._rmtree = []
@@ -152,10 +156,14 @@ class ImageBuilder(object):
os.path.join(union_path, 'casper', 'filesystem.squashfs'), os.path.join(union_path, 'casper', 'filesystem.squashfs'),
'-noappend') '-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): def _CreateISO(self, union_path):
self._Exec( self._Exec(
'grub-mkrescue', 'grub-mkrescue',
'--verbose',
'--output=%s' % self._dest_iso, '--output=%s' % self._dest_iso,
union_path) union_path)
@@ -172,6 +180,7 @@ class ImageBuilder(object):
if FLAGS.shell: if FLAGS.shell:
self._Exec('bash') self._Exec('bash')
self._Squash(chroot_path, union_path) self._Squash(chroot_path, union_path)
self._FixGrub(union_path)
self._CreateISO(union_path) self._CreateISO(union_path)
def BuildImage(self): def BuildImage(self):

View File

@@ -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
}