Make sure the hwinfo executable exists before calling it

main
Rohan Garg 10 years ago
parent eed387f7a4
commit f9bd0dfcfc

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

Loading…
Cancel
Save