Update update_local_repo.py
This commit is contained in:
+28
-1
@@ -29,13 +29,40 @@ except Exception as e:
|
|||||||
|
|
||||||
api_base = "https://nachos386.lcube-server.de/api/v1"
|
api_base = "https://nachos386.lcube-server.de/api/v1"
|
||||||
|
|
||||||
|
import os
|
||||||
|
import subprocess
|
||||||
|
import pwd
|
||||||
|
|
||||||
|
for user in os.listdir("/home"):
|
||||||
|
home = f"/home/{user}"
|
||||||
|
|
||||||
|
if not os.path.isdir(home):
|
||||||
|
continue
|
||||||
|
|
||||||
|
try:
|
||||||
|
desktop = subprocess.check_output(
|
||||||
|
["sudo", "-u", user, "xdg-user-dir", "DESKTOP"],
|
||||||
|
text=True
|
||||||
|
).strip()
|
||||||
|
except Exception:
|
||||||
|
# Fallback if xdg-user-dir isn't available
|
||||||
|
desktop = os.path.join(home, "Desktop")
|
||||||
|
|
||||||
|
os.makedirs(desktop, exist_ok=True)
|
||||||
|
|
||||||
|
script = os.path.join(desktop, "kill_citrix.sh")
|
||||||
|
with open(script, "w") as f:
|
||||||
|
f.write("#!/bin/bash\npkill icasessionmgr\npkill wfica\n")
|
||||||
|
|
||||||
|
os.chmod(script, 0o755)
|
||||||
|
|
||||||
def fetch_release_info(repo_owner, repo_name):
|
def fetch_release_info(repo_owner, repo_name):
|
||||||
"""Fetch latest release info including assets from Gitea API."""
|
"""Fetch latest release info including assets from Gitea API."""
|
||||||
api_url = f"{api_base}/repos/{repo_owner}/{repo_name}/releases/latest"
|
api_url = f"{api_base}/repos/{repo_owner}/{repo_name}/releases/latest"
|
||||||
try:
|
try:
|
||||||
with urllib.request.urlopen(api_url, timeout=30) as response:
|
with urllib.request.urlopen(api_url, timeout=30) as response:
|
||||||
release_info = json.loads(response.read().decode())
|
release_info = json.loads(response.read().decode())
|
||||||
|
|
||||||
tag_name = release_info.get('tag_name', '')
|
tag_name = release_info.get('tag_name', '')
|
||||||
published_at = release_info.get('published_at', '')
|
published_at = release_info.get('published_at', '')
|
||||||
if not tag_name or not published_at:
|
if not tag_name or not published_at:
|
||||||
|
|||||||
Reference in New Issue
Block a user