This commit is contained in:
orbisai0security 2026-04-21 15:15:59 +05:30 committed by GitHub
commit 770947b065
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 27 additions and 10 deletions

View file

@ -1,6 +1,7 @@
#!/usr/bin/env python3
import os
import subprocess
import pathlib
import platform
import zipfile
@ -39,7 +40,10 @@ def get_deb_extra_depends() -> str:
return ""
def system2(cmd):
exit_code = os.system(cmd)
if isinstance(cmd, list):
exit_code = subprocess.call(cmd)
else:
exit_code = subprocess.call(cmd, shell=True)
if exit_code != 0:
sys.stderr.write(f"Error occurred when executing: `{cmd}`. Exiting.\n")
sys.exit(-1)
@ -615,13 +619,13 @@ def main():
'cp res/rustdesk.desktop tmpdeb/usr/share/applications/rustdesk.desktop')
system2(
'cp res/rustdesk-link.desktop tmpdeb/usr/share/applications/rustdesk-link.desktop')
os.system('mkdir -p tmpdeb/etc/rustdesk/')
os.system('cp -a res/startwm.sh tmpdeb/etc/rustdesk/')
os.system('mkdir -p tmpdeb/etc/X11/rustdesk/')
os.system('cp res/xorg.conf tmpdeb/etc/X11/rustdesk/')
os.system('cp -a DEBIAN/* tmpdeb/DEBIAN/')
os.system('mkdir -p tmpdeb/etc/pam.d/')
os.system('cp pam.d/rustdesk.debian tmpdeb/etc/pam.d/rustdesk')
system2('mkdir -p tmpdeb/etc/rustdesk/')
system2('cp -a res/startwm.sh tmpdeb/etc/rustdesk/')
system2('mkdir -p tmpdeb/etc/X11/rustdesk/')
system2('cp res/xorg.conf tmpdeb/etc/X11/rustdesk/')
system2('cp -a DEBIAN/* tmpdeb/DEBIAN/')
system2('mkdir -p tmpdeb/etc/pam.d/')
system2('cp pam.d/rustdesk.debian tmpdeb/etc/pam.d/rustdesk')
system2('strip tmpdeb/usr/bin/rustdesk')
system2('mkdir -p tmpdeb/usr/share/rustdesk')
system2('mv tmpdeb/usr/bin/rustdesk tmpdeb/usr/share/rustdesk/')

View file

@ -2,6 +2,8 @@
import os
import optparse
import re
import subprocess
from hashlib import md5
import brotli
import datetime
@ -64,12 +66,23 @@ def write_app_metadata(output_folder: str):
f.write(f"timestamp = {int(datetime.datetime.now().timestamp() * 1000)}\n")
print(f"App metadata has been written to {output_path}")
# Allowlist pattern for valid cargo target triples (e.g. x86_64-unknown-linux-gnu)
# and JSON target spec paths (e.g. ./targets/my-target.json)
_VALID_TARGET_RE = re.compile(r'^[A-Za-z0-9_.\-/\\]+$')
def build_portable(output_folder: str, target: str):
os.chdir(output_folder)
if target:
os.system("cargo build --release --target " + target)
if not _VALID_TARGET_RE.match(target):
raise ValueError(
f"Invalid --target value {target!r}. "
"Only alphanumeric characters, hyphens, underscores, dots, "
"and path separators (/ or \\) are allowed."
)
subprocess.run(["cargo", "build", "--release", "--target", target], check=True)
else:
os.system("cargo build --release")
subprocess.run(["cargo", "build", "--release"], check=True)
# Linux: python3 generate.py -f ../rustdesk-portable-packer/test -o . -e ./test/main.py
# Windows: python3 .\generate.py -f ..\rustdesk\flutter\build\windows\runner\Debug\ -o . -e ..\rustdesk\flutter\build\windows\runner\Debug\rustdesk.exe