diff options
author | Pedro Alvarez <pedro.alvarez@codethink.co.uk> | 2014-11-26 16:55:23 +0000 |
---|---|---|
committer | Pedro Alvarez <pedro.alvarez@codethink.co.uk> | 2014-11-26 16:55:23 +0000 |
commit | 1119bb58d2fd54464cdffb4d3ebb0c78cdc979bc (patch) | |
tree | ddd4dedadc4aff9974c2615c1706ed80a1cbb353 | |
parent | c204b4417a380623cd469030db932b811af3dc45 (diff) | |
download | definitions-1119bb58d2fd54464cdffb4d3ebb0c78cdc979bc.tar.gz |
Rename to compute_install_command
-rwxr-xr-x | installer/installer.py | 15 |
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]+)$") |