Make sure to check things exist before actually modifying them

This fixes crashes when a system does not have squashfs-tools or
a grub dir does not exist.
This commit is contained in:
Rohan Garg 2014-10-14 15:09:38 +02:00
parent 9c10b49802
commit eed387f7a4
2 changed files with 9 additions and 2 deletions

View file

@ -123,6 +123,10 @@ class UnpackOperation:
fslist = ""
if entry.sourcefs == "squashfs":
if shutil.which("unsquashfs") == None:
return ("Failed to unpack image", "Failed to find unsquashfs, make sure you have
the squashfs-tools package installed")
fslist = subprocess.check_output(["unsquashfs",
"-l",
entry.source])