Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- import os
- import sys
- import pexpect
- def main():
- if not os.geteuid() == 0:
- sys.exit('Script must be run as root')
- os.system("sudo apt-get -y install python-pexpect bridge-utils")
- os.chdir("/srv/vm/qemu")
- os.system("git remote add nested https://github.com/columbia/qemu-nested.git")
- child = pexpect.spawn("git fetch nested")
- child.expect('sername.*')
- child.sendline('put_user_name')
- child.expect('assword.*')
- child.sendline('put_password')
- child.expect (pexpect.EOF)
- os.system("git checkout nested-v2.3.0")
- os.system("make -j 10")
- os.system("cp /proj/kvmarm-PG0/jintack/nested/linaro-trusty-nesting-v3.img /vmdata/linaro-trusty.img")
- os.system("mkdir /usr/local/etc/qemu/")
- os.system("echo \"allow br0\" > /usr/local/etc/qemu/bridge.conf")
- os.system("sed -i 's/cpu host/cpu host,nested=true/g' /srv/vm/run-guest.sh")
- # Add host public key to guest
- os.system("mount -o loop /vmdata/linaro-trusty.img /mnt")
- os.system("cat /users/jintackl/.ssh/id_rsa.pub >> /mnt/root/.ssh/authorized_keys")
- os.system("mkdir -p /mnt_l2")
- os.system("mount -o loop /mnt/root/vm/l2.img /mnt_l2")
- os.system("cat /users/jintackl/.ssh/id_rsa.pub >> /mnt_l2/root/.ssh/authorized_keys")
- os.system("umount /mnt_l2")
- os.system("umount /mnt")
- os.system("cp /proj/kvmarm-PG0/jintack/scripts/run.sh /users/jintackl")
- sys.exit(1)
- if __name__ == '__main__':
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement