2019-03-26 15:59:06 +00:00
|
|
|
# SPDX-License-Identifier: GPL-2.0
|
2018-07-16 20:45:36 +02:00
|
|
|
# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv)
|
2016-04-25 10:37:15 -07:00
|
|
|
|
2020-12-25 16:15:10 +01:00
|
|
|
import xbmcaddon
|
2016-04-25 10:37:15 -07:00
|
|
|
import xbmcgui
|
2016-09-09 03:33:47 +02:00
|
|
|
import subprocess
|
2022-03-20 19:28:21 +01:00
|
|
|
import re
|
|
|
|
|
import csv
|
2016-09-09 03:33:47 +02:00
|
|
|
|
2022-03-20 19:28:21 +01:00
|
|
|
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':
|
2020-12-25 16:15:10 +01:00
|
|
|
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)
|
|
|
|
|
else:
|
|
|
|
|
xbmcgui.Dialog().ok('System Tools', 'This is a console-only addon')
|