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.
This commit is contained in:
Mikhail Novosyolov 2019-08-24 21:36:50 +03:00
parent 188d61a93d
commit 3291cbb5b1
2 changed files with 41 additions and 1 deletions

View file

@ -0,0 +1,39 @@
From cb3e1864828802680a164e7a45ab058235c5404c Mon Sep 17 00:00:00 2001
From: Mikhail Novosyolov <m.novosyolov@rosalinux.ru>
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

View file

@ -3,7 +3,7 @@
Summary: Tools for building live CDs
Name: livecd-tools
Version: 21.1
Release: 58
Release: 59
Epoch: 1
License: GPLv2+
Group: System/Base
@ -34,6 +34,7 @@ Patch21: livecd-tools-21.1.use.add_drivers.patch
Patch22: livecd-tools-21.1.no.vga.opts.patch
Patch23: livecd-tools-21.1-genisoimage.patch
Patch24: 0001-Run-setfiles-after-chroot.patch
Patch25: 0002-Get-system-architecture-by-bin-sh-executable-instead.patch
Requires: python-imgcreate = %{EVRD}
Requires: dosfstools