diff options
Diffstat (limited to 'installer/installer.py')
-rwxr-xr-x | installer/installer.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/installer/installer.py b/installer/installer.py index 5c504ad1..e9761a5c 100755 --- a/installer/installer.py +++ b/installer/installer.py @@ -63,7 +63,7 @@ class BaserockInstaller(): os.execl('/bin/sh', 'sh') def validate_install_values(self, disk_dest, rootfs): - if not self.deploying_to_device(disk_dest): + if not self.is_device(disk_dest): print "ERROR: Not deploying to a device" raise BaseException if not os.path.exists(disk_dest): @@ -160,7 +160,15 @@ class BaserockInstaller(): run_script = "sh %s" % install_script subprocess.check_call(run_script, shell=True) - def deploying_to_device(self, location): + def is_device(self, location): + try: + st = os.stat(location) + return stat.S_ISBLK(st.st_mode) + except OSError as e: + if e.errno == errno.ENOENT: + return False + raise + dev_regex = re.compile("^/dev/((sd|vd|mmcblk|hd)[a-z0-9]+)$") if dev_regex.match(location): return True |