aboutsummaryrefslogtreecommitdiff
path: root/scripts/boot.py
blob: 1f7e0f932961e643e9f8fa2b210ced1c4068f233 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import os
import sys
import subprocess
import shutil

import utils
from conf import conf
from exceptions import MissingFile

def gen_nbscript():
	try:
		os.remove(conf.nbscript)
	except OSError:
		pass

	with open(conf.nbscript, 'w') as f:
		f.write('load ' + conf.linux_image + ' console=ttyS0,115200\n')
		f.write('load ' + conf.initram + '\n')

def boot():
	if not os.path.isfile(conf.nbscript):
		gen_nbscript()

	sprc = subprocess.Popen([conf.novaboot, conf.nbscript] + conf.novaboot_args,
			stdout = subprocess.PIPE)