mirror of
https://github.com/rustdesk/rustdesk
synced 2026-04-21 13:27:19 +00:00
Merge 3e00b3b8b0 into 803ac8cc4e
This commit is contained in:
commit
770947b065
2 changed files with 27 additions and 10 deletions
20
build.py
20
build.py
|
|
@ -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/')
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue