Merge pull request #121 from shadeslayer/master

Make sure executables and paths exist before using them
main
Teo Mrnjavac 10 years ago
commit 0436aa0ea0

@ -29,6 +29,9 @@ def modify_grub_default(partitions, root_mount_point, distributor):
use_splash = ""
swap_uuid = ""
if not os.path.exists(default_dir):
return ("Directory does not exist", "The directory {} does not exist on
the target".format(default_dir))
if os.path.exists(plymouth_bin):
use_splash = "splash"
@ -58,10 +61,10 @@ def modify_grub_default(partitions, root_mount_point, distributor):
with open(default_grub, 'w') as grub_file:
grub_file.write("\n".join(lines) + "\n")
return None
def run():
partitions = libcalamares.globalstorage.value("partitions")
root_mount_point = libcalamares.globalstorage.value("rootMountPoint")
distributor = libcalamares.job.configuration["distributor"]
modify_grub_default(partitions, root_mount_point, distributor)
return None
return modify_grub_default(partitions, root_mount_point, distributor)

@ -20,19 +20,22 @@
import libcalamares
import os
import subprocess
import shutil
from libcalamares.utils import check_chroot_call
def get_cpu():
""" Check if system is an intel system. """
process1 = subprocess.Popen(["hwinfo", "--cpu"], stdout=subprocess.PIPE)
process2 = subprocess.Popen(["grep", "Model:[[:space:]]"],
stdin=process1.stdout, stdout=subprocess.PIPE)
process1.stdout.close()
out, err = process2.communicate()
return out.decode().lower()
if shutil.which("hwinfo") != None:
process1 = subprocess.Popen(["hwinfo", "--cpu"], stdout=subprocess.PIPE)
process2 = subprocess.Popen(["grep", "Model:[[:space:]]"],
stdin=process1.stdout, stdout=subprocess.PIPE)
process1.stdout.close()
out, err = process2.communicate()
return out.decode().lower()
return ""
def set_mkinitcpio_hooks_and_modules(hooks, modules, root_mount_point):
""" Set up mkinitcpio.conf """

@ -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])

Loading…
Cancel
Save