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-12-02 17:58:47 +0000 |
commit | f073462e320d10a3d2d6f277237bd1d804ee3def (patch) | |
tree | 39d2bba9149d137488183047a4d1a7d754495876 | |
parent | cf722a4d2347ac54ade1916a19f3990569937b13 (diff) | |
download | definitions-f073462e320d10a3d2d6f277237bd1d804ee3def.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]+)$") |