summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPedro Alvarez <pedro.alvarez@codethink.co.uk>2014-11-26 16:55:23 +0000
committerPedro Alvarez <pedro.alvarez@codethink.co.uk>2014-11-26 16:55:23 +0000
commit1119bb58d2fd54464cdffb4d3ebb0c78cdc979bc (patch)
treeddd4dedadc4aff9974c2615c1706ed80a1cbb353
parentc204b4417a380623cd469030db932b811af3dc45 (diff)
downloaddefinitions-1119bb58d2fd54464cdffb4d3ebb0c78cdc979bc.tar.gz
Rename to compute_install_command
-rwxr-xr-xinstaller/installer.py15
1 files changed, 6 insertions, 9 deletions
diff --git a/installer/installer.py b/installer/installer.py
index aec43591..cfca5bb6 100755
--- a/installer/installer.py
+++ b/installer/installer.py
@@ -52,11 +52,9 @@ class BaserockInstaller():
deployment_config=self.get_deployment_config(rootfs)
- install_script = self.create_install_script(rawdisk_path,
- deployment_config, rootfs, disk_dest)
+ self.compute_install_command(rawdisk_path,
+ deployment_config, rootfs, disk_dest)
- self.install_system(install_script)
- os.remove(install_script)
self.do_unmounts(mounted)
self.finish_and_reboot()
except BaseException, e:
@@ -80,7 +78,7 @@ class BaserockInstaller():
return True
return False
- def create_install_script(self, rawdisk_path, deployment_config,
+ def compute_install_command(self, rawdisk_path, deployment_config,
rootfs, disk_dest):
fd, script = tempfile.mkstemp()
with os.fdopen(fd, 'w') as fp:
@@ -90,7 +88,8 @@ class BaserockInstaller():
if deployment_config[name] is not None:
fp.write('%s="%s" ' % (name, deployment_config[name]))
fp.write("%s %s %s\n" % (rawdisk_path, rootfs, disk_dest))
- return script
+ self.install_system(script)
+ os.remove(script)
def finish_and_reboot(self):
os.system("sync")
@@ -164,9 +163,7 @@ class BaserockInstaller():
def install_system(self, install_script):
run_script = "sh %s" % install_script
- process = subprocess.Popen(run_script, shell=True, stdout=subprocess.PIPE)
- for line in iter(process.stdout.readline, ''):
- sys.stdout.write(line)
+ process = subprocess.check_call(run_script, shell=True)
def deploying_to_device(self, location):
dev_regex = re.compile("^/dev/((sd|vd|mmcblk|hd)[a-z0-9]+)$")