Base package list, --shell flag

This commit is contained in:
Ian Gulliver
2016-03-30 14:26:53 -07:00
parent 7f807e468a
commit ca51da3d1f

View File

@@ -28,6 +28,12 @@ parser.add_argument(
dest='release',
action='store',
required=True)
parser.add_argument(
'--shell',
dest='shell',
action='store',
type=bool,
default=False)
parser.add_argument(
'--source-iso',
dest='source_iso',
@@ -38,6 +44,21 @@ FLAGS = parser.parse_args()
class ImageBuilder(object):
_BASE_PACKAGES = [
'debconf',
'devscripts',
'dialog',
'gnupg',
'isc-dhcp-client',
'locales',
'nano',
'net-tools',
'iputils-ping',
'sudo',
'user-setup',
'wget',
]
def __init__(self, source_iso, dest_iso, archive, arch, release):
self._source_iso = source_iso
self._dest_iso = dest_iso
@@ -51,6 +72,9 @@ class ImageBuilder(object):
print('+', args)
subprocess.check_call(args)
def _ExecChroot(self, chroot_path, *args):
self._Exec('chroot', chroot_path, *args)
def _Debootstrap(self, root):
path = os.path.join(root, 'chroot')
os.mkdir(path)
@@ -100,6 +124,18 @@ class ImageBuilder(object):
return union_path
def _InstallPackages(self, chroot_path):
self._ExecChroot(
chroot_path,
'apt-get',
'install',
'--assume-yes',
*self._BASE_PACKAGES)
self._ExecChroot(
chroot_path,
'apt-get',
'clean')
def _Squash(self, chroot_path, union_path):
self._Exec(
'mksquashfs',
@@ -122,6 +158,9 @@ class ImageBuilder(object):
chroot_path = self._Debootstrap(root)
union_path = self._CreateUnion(root)
self._InstallPackages(chroot_path)
if FLAGS.shell:
self._Exec('bash')
self._Squash(chroot_path, union_path)
self._CreateISO(union_path)