mirror of
https://github.com/LibreELEC/LibreELEC.tv.git
synced 2025-07-31 22:47:51 +00:00
system-tools: only execute "st" on X11 platform
This commit is contained in:
parent
cb854d7a1b
commit
46c841fde2
@ -4,9 +4,16 @@
|
||||
import xbmcaddon
|
||||
import xbmcgui
|
||||
import subprocess
|
||||
import os.path
|
||||
import re
|
||||
import csv
|
||||
|
||||
if os.path.exists(os.path.join(xbmcaddon.Addon().getAddonInfo('path'), 'bin/st')):
|
||||
with open('/etc/os-release') as stream:
|
||||
contents = stream.read().strip()
|
||||
vars = re.findall(r"^[a-zA-Z0-9_]+=.*$", contents, flags=re.MULTILINE)
|
||||
reader = csv.reader(vars, delimiter="=")
|
||||
osrelease = dict(reader)
|
||||
|
||||
if osrelease['LIBREELEC_ARCH'] == 'x11.x86_64' or osrelease['LIBREELEC_ARCH'] == 'Generic-legacy.x86_64':
|
||||
yes = xbmcgui.Dialog().yesno('System Tools', 'This is a console-only addon.[CR][CR]Open a terminal window?',nolabel='No',yeslabel='Yes')
|
||||
if yes:
|
||||
subprocess.Popen(["systemd-run","sh","-c",". /etc/profile;cd;exec st -e sh -l"], shell=False, close_fds=True)
|
||||
|
Loading…
x
Reference in New Issue
Block a user