Commit 94ee3645 authored by Michael Pöhn's avatar Michael Pöhn

preseed vagrants default ssh key to virtualbox VMs

parent 891f967d
......@@ -24,7 +24,6 @@ import stat
import logging
import tarfile
import tempfile
import textwrap
import subprocess
from argparse import ArgumentParser
......@@ -110,13 +109,8 @@ def init_params(provider, workdir='.'):
def write_bootstrap_script(path, username):
with open(path, 'w') as f:
#! /bin/sh
set -e
echo '{username} ALL=(ALL) NOPASSWD: ALL' >> $VMROOT/etc/sudoers
st = os.stat(path)
os.chmod(path, st.st_mode |
stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH)
......@@ -146,13 +140,12 @@ def exec_vmdebootstrap(params, provider, verbose=False, dry_run=False):
cmd = [x for x in cmd if x is not None] # strip nones
if provider == 'virtualbox':
cmd += ['--debootstrapopts=components=main,contrib']
if dry_run:
cmd += ['--dry-run']
logging.debug('> {}'.format(' '.join(cmd)))
if not dry_run:'running vmdebootstrap (please be patient, '
'this may take several minutes) ...')
else:'(dry run) Skip running vmdebootstrap')'running vmdebootstrap (please be patient, '
'this may take several minutes) ...')
def libvirt_convert_raw_to_qcow2(params, verbose=False, dry_run=False):
#! /bin/sh
set -e
echo '{username} ALL=(ALL) NOPASSWD: ALL' >> $VMROOT/etc/sudoers
VGRNT_UID=`ls -ln $VMROOT/home | grep vagrant | awk '{{print $3}}'`
VGRNT_GID=`ls -ln $VMROOT/home | grep vagrant | awk '{{print $4}}'`
mkdir $VMROOT/home/vagrant/.ssh
chmod 700 $VMROOT/home/vagrant/.ssh
chown $VGRNT_UID:$VGRNT_GID $VMROOT/home/vagrant/.ssh
echo "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA6NF8iallvQVp22WDkTkyrtvp9eWW6A8YVr+kz4TjGYe7gHzIw+niNltGEFHzD8+v1I2YJ6oXevct1YeS0o9HZyN1Q9qgCgzUFtdOKLv6IedplqoPkcmF0aYet2PkEDo3MlTBckFXPITAMzF8dJSIFo9D8HfdOV0IAdx4O7PtixWKn5y2hMNG0zQPyUecp4pzC6kivAIhyfHilFR61RGL+GPXQ2MWZWFYbAGjyiYJnAmCP3NOTd0jMZEnDkbUvxhMmBYSdETk1rRgm+R4LOzFUGaHqHDLKLX+FIPKcF96hrucXzcWyLbIbEgE98OHlnVYCzRdK8jlqm8tehUc9c9WhQ== vagrant_insecure_public_key" > $VMROOT/home/vagrant/.ssh/authorized_keys
chmod 600 $VMROOT/home/vagrant/.ssh/authorized_keys
chown $VGRNT_UID:$VGRNT_GID $VMROOT/home/vagrant/.ssh/authorized_keys
echo 'DEBUG +++ DEBUG +++ DEBUG +++ DEBUG +++ DEBUG +++ DEBUG +++ DEBUG'
ls -al $VMROOT/home/vagrant/
ls -al $VMROOT/home/vagrant/.ssh
......@@ -3,8 +3,6 @@ do |config|
# the MAC address of the box. Custom configuration should be placed in
# the actual `Vagrantfile` in this box.
config.vm.base_mac = "080027E8A88A"
config.ssh.username = "{username}"
config.ssh.password = "{password}"
# Load include vagrant file if it exists after the auto-generated
Vagrant.configure("2") do |config| = "fdroid-jessie64"
config.ssh.password = "vagrant"
config.ssh.username = "vagrant"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment