Replaced sudo with pkexec in custom scripts
This commit is contained in:
parent
15bd4335e8
commit
b952fa07b5
@ -12,7 +12,8 @@
|
|||||||
"--socket=wayland",
|
"--socket=wayland",
|
||||||
"--filesystem=/sys/module/amdgpu:ro",
|
"--filesystem=/sys/module/amdgpu:ro",
|
||||||
"--env=LD_LIBRARY_PATH=/app/lib:/usr/lib/x86_64-linux-gnu/GL/default/lib:/usr/lib/x86_64-linux-gnu/openh264/extra:/usr/lib/x86_64-linux-gnu/openh264/extra:/usr/lib/sdk/llvm15/lib:/usr/lib/x86_64-linux-gnu/GL/default/lib:/usr/lib/ollama:/app/plugins/AMD/lib/ollama",
|
"--env=LD_LIBRARY_PATH=/app/lib:/usr/lib/x86_64-linux-gnu/GL/default/lib:/usr/lib/x86_64-linux-gnu/openh264/extra:/usr/lib/x86_64-linux-gnu/openh264/extra:/usr/lib/sdk/llvm15/lib:/usr/lib/x86_64-linux-gnu/GL/default/lib:/usr/lib/ollama:/app/plugins/AMD/lib/ollama",
|
||||||
"--env=GSK_RENDERER=ngl"
|
"--env=GSK_RENDERER=ngl",
|
||||||
|
"--talk-name=org.freedesktop.Flatpak"
|
||||||
],
|
],
|
||||||
"add-extensions": {
|
"add-extensions": {
|
||||||
"com.jeffser.Alpaca.Plugins": {
|
"com.jeffser.Alpaca.Plugins": {
|
||||||
|
@ -20,13 +20,14 @@ class terminal(Vte.Terminal):
|
|||||||
self.set_pty(pty)
|
self.set_pty(pty)
|
||||||
|
|
||||||
env = {
|
env = {
|
||||||
"TERM": "xterm-256color"
|
'TERM': "xterm-256color",
|
||||||
|
'SUDO_ASKPASS': "sh -c 'pkexec echo'"
|
||||||
}
|
}
|
||||||
|
|
||||||
pty.spawn_async(
|
pty.spawn_async(
|
||||||
GLib.get_current_dir(),
|
GLib.get_current_dir(),
|
||||||
script,
|
script,
|
||||||
[f"{key}={value}" for key, value in env.items()],
|
[],
|
||||||
GLib.SpawnFlags.DEFAULT,
|
GLib.SpawnFlags.DEFAULT,
|
||||||
None,
|
None,
|
||||||
None,
|
None,
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
Handles UI dialogs
|
Handles UI dialogs
|
||||||
"""
|
"""
|
||||||
import os
|
import os
|
||||||
import logging, requests, threading, shutil, subprocess
|
import logging, requests, threading, shutil, subprocess, re
|
||||||
from pytube import YouTube
|
from pytube import YouTube
|
||||||
from html2text import html2text
|
from html2text import html2text
|
||||||
from gi.repository import Adw, Gtk
|
from gi.repository import Adw, Gtk
|
||||||
@ -441,7 +441,7 @@ def run_script_response(self, dialog, task, script, language_name):
|
|||||||
|
|
||||||
script += '; echo "\n🦙 {}"'.format(_('Script exited'))
|
script += '; echo "\n🦙 {}"'.format(_('Script exited'))
|
||||||
if language_name == 'bash':
|
if language_name == 'bash':
|
||||||
script = script.replace('sudo ', 'pkexec ')
|
script = re.sub(r'(?m)^\s*sudo', 'pkexec', script)
|
||||||
if shutil.which('flatpak-spawn') and language_name == 'bash':
|
if shutil.which('flatpak-spawn') and language_name == 'bash':
|
||||||
sandbox = True
|
sandbox = True
|
||||||
try:
|
try:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user