def run(cls, info): import os guest_additions_path = info.manifest.bootstrapper['guest_additions'] mount_dir = 'mnt/guest_additions' mount_path = os.path.join(info.root, mount_dir) os.mkdir(mount_path) root = info.volume.partition_map.root root.add_mount(guest_additions_path, mount_path, ['-o', 'loop']) install_script = os.path.join('/', mount_dir, 'VBoxLinuxAdditions.run') from common.tools import log_call status, out, err = log_call(['chroot', info.root, install_script, '--nox11']) # Install will exit with $?=1 because X11 isn't installed if status != 1: msg = ('VBoxLinuxAdditions.run exited with status {status}, ' 'it should exit with status 1').format(status=status) raise TaskError(msg) log_call(['chroot', info.root, 'service', 'vboxadd-service', 'stop']) root.remove_mount(mount_path) os.rmdir(mount_path)
def run(cls, info): from hashlib import sha1 import os.path executable, options, arguments = get_bootstrap_args(info) # Filter info.root which points at /target/volume-id, we won't ever hit anything with that in there. hash_args = [arg for arg in arguments if arg != info.root] tarball_id = sha1(repr(frozenset(options + hash_args))).hexdigest()[0:8] tarball_filename = 'debootstrap-{id}.tar'.format(id=tarball_id) info.tarball = os.path.join(info.manifest.bootstrapper['workspace'], tarball_filename) if os.path.isfile(info.tarball): log.debug('Found matching tarball, skipping download') else: from common.tools import log_call status, out, err = log_call(executable + options + ['--make-tarball=' + info.tarball] + arguments) if status != 1: msg = 'debootstrap exited with status {status}, it should exit with status 1'.format(status=status) raise TaskError(msg)
def run(cls, info): import os guest_additions_path = info.manifest.bootstrapper['guest_additions'] mount_dir = 'mnt/guest_additions' mount_path = os.path.join(info.root, mount_dir) os.mkdir(mount_path) root = info.volume.partition_map.root root.add_mount(guest_additions_path, mount_path, ['-o', 'loop']) install_script = os.path.join('/', mount_dir, 'VBoxLinuxAdditions.run') from common.tools import log_call status, out, err = log_call( ['chroot', info.root, install_script, '--nox11']) # Install will exit with $?=1 because X11 isn't installed if status != 1: msg = ('VBoxLinuxAdditions.run exited with status {status}, ' 'it should exit with status 1').format(status=status) raise TaskError(msg) root.remove_mount(mount_path) os.rmdir(mount_path)
def run(cls, info): from hashlib import sha1 import os.path executable, options, arguments = get_bootstrap_args(info) # Filter info.root which points at /target/volume-id, we won't ever hit anything with that in there. hash_args = [arg for arg in arguments if arg != info.root] tarball_id = sha1(repr(frozenset(options + hash_args))).hexdigest()[0:8] tarball_filename = 'debootstrap-{id}.tar'.format(id=tarball_id) info.tarball = os.path.join(info.manifest.bootstrapper['workspace'], tarball_filename) if os.path.isfile(info.tarball): log.debug('Found matching tarball, skipping download') else: from common.tools import log_call status, out, err = log_call(executable + options + ['--make-tarball=' + info.tarball] + arguments) if status != 1: msg = 'debootstrap exited with status {status}, it should exit with status 1'.format( status=status) raise TaskError(msg)