def setup_sandbox_drive(): umask = conf.get('sandbox-drive.umask') mountpoint = conf.get('sandbox-drive.mountpoint') symlink_path = conf.get('sandbox-drive.symlink') group_name = conf.get('sandbox-drive.group-name') owner_name = conf.get('sandbox-drive.owner-name') os.mkdir(mountpoint) os.symlink(mountpoint, symlink_path) exectools.check_call_command(['groupadd', group_name]) exectools.check_call_command(['usermod', '-a', '-G', 'vboxsf', owner_name]) exectools.check_call_command( ['usermod', '-a', '-G', group_name, owner_name]) patchtools.apply_patch(restools.get_resource_file('fstab.patch'), '/etc/fstab') drive_uid = pwd.getpwnam(owner_name).pw_uid drive_gid = grp.getgrnam(group_name).gr_gid tokens = { 'mountpoint': mountpoint, 'umask': umask, 'gid': str(drive_gid), 'uid': str(drive_uid) } patchtools.replace_tokens(tokens, '/etc/fstab') exectools.check_call_command(['mount', '-a'])
def setup_sandbox_drive(): umask = conf.get('sandbox-drive.umask') mountpoint = conf.get('sandbox-drive.mountpoint') symlink_path = conf.get('sandbox-drive.symlink') group_name = conf.get('sandbox-drive.group-name') owner_name = conf.get('sandbox-drive.owner-name') os.mkdir(mountpoint) os.symlink(mountpoint, symlink_path) exectools.check_call_command(['groupadd', group_name]) exectools.check_call_command(['usermod', '-a', '-G', 'vboxsf', owner_name]) exectools.check_call_command(['usermod', '-a', '-G', group_name, owner_name]) patchtools.apply_patch(restools.get_resource_file('fstab.patch'), '/etc/fstab') drive_uid = pwd.getpwnam(owner_name).pw_uid drive_gid = grp.getgrnam(group_name).gr_gid tokens = { 'mountpoint': mountpoint, 'umask': umask, 'gid': str(drive_gid), 'uid': str(drive_uid) } patchtools.replace_tokens(tokens, '/etc/fstab') exectools.check_call_command(['mount', '-a'])
def setup_swap(): patchtools.apply_patch(restools.get_resource_file('sysctl.conf.patch'), '/etc/sysctl.conf') exectools.check_call_command(['sysctl', '-w', 'vm.swappiness=10'])
def setup_grub(): patchtools.apply_patch(restools.get_resource_file('grub.patch'), '/etc/default/grub') exectools.check_call_command(['update-grub'])
def setup_networking(): patchtools.apply_patch(restools.get_resource_file('interfaces.patch'), '/etc/network/interfaces') patchtools.apply_patch(restools.get_resource_file('hosts.patch'), '/etc/hosts') exectools.check_call_command(['service', 'networking', 'restart'])