From cb3e1864828802680a164e7a45ab058235c5404c Mon Sep 17 00:00:00 2001 From: Mikhail Novosyolov Date: Sat, 24 Aug 2019 21:33:23 +0300 Subject: [PATCH] Get system architecture by /bin/sh executable instead of parsing not standartized /etc/system-release There is no standard for /etc/system-release, and old code did not understand that "OS ROSA Nickel 64" is a 64-bit system. --- imgcreate/live.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/imgcreate/live.py b/imgcreate/live.py index f63c2e0..027d14d 100644 --- a/imgcreate/live.py +++ b/imgcreate/live.py @@ -24,6 +24,7 @@ import shutil import subprocess import logging import re +import platform from imgcreate.errors import * from imgcreate.fs import * @@ -742,9 +743,9 @@ menu end """ fail = False missing = [] - if os.path.exists(self._instroot + "/etc/system-release"): - arch = subprocess.check_output("echo -n `sed 's/^.* release \\S* for //' " + self._instroot + "/etc/system-release`", shell=True) - grub_arch = ("x64" if arch == "x86_64" else "ia32") + if os.path.exists(self._instroot + "/bin/sh"): + arch = platform.architecture(executable=self._instroot + "/bin/sh")[0] + grub_arch = ("x64" if arch == "64bit" else "ia32") else: grub_arch = "x64" -- 2.17.1