Update public source

This commit is contained in:
2026-10-06 21:08:12 +03:00
commit f231cc5b1f
102 changed files with 48249 additions and 0 deletions
+77
View File
@@ -0,0 +1,77 @@
import logging
import subprocess
import sys
class SudoChecker:
def __init__(self):
self.log = logging.getLogger(
"sudo"
)
def check(self):
self.log.info(
"Checking sudo..."
)
try:
result = subprocess.run(
[
"sudo",
"-n",
"-v"
]
)
if result.returncode != 0:
result = subprocess.run(
[
"sudo",
"-v"
]
)
except KeyboardInterrupt:
self.log.error(
"Sudo authentication cancelled."
)
raise SystemExit(1)
if result.returncode != 0:
self.log.error(
"Sudo authentication is not available."
)
raise SystemExit(1)
self.log.info(
"Sudo: OK"
)
def refresh(self):
try:
result = subprocess.run(
[
"sudo",
"-n",
"-v"
],
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL
)
except Exception:
return False
return result.returncode == 0