mirror of
https://github.com/netinvent/npbackup.git
synced 2025-10-09 13:11:58 +08:00
Add external signer to compile script
This commit is contained in:
parent
8417eec09b
commit
02fedcebb9
1 changed files with 17 additions and 3 deletions
|
@ -33,6 +33,11 @@ from command_runner import command_runner
|
||||||
from ofunctions.platform import python_arch, get_os
|
from ofunctions.platform import python_arch, get_os
|
||||||
|
|
||||||
if os.name == "nt":
|
if os.name == "nt":
|
||||||
|
EXTERNAL_SIGNER = r"C:\ev_signer_npbackup\ev_signer_npbackup.exe"
|
||||||
|
if os.path.isfile(EXTERNAL_SIGNER):
|
||||||
|
SIGN_EXTERNALY = True
|
||||||
|
else:
|
||||||
|
SIGN_EXTERNALY = False
|
||||||
from npbackup.windows.sign_windows import sign
|
from npbackup.windows.sign_windows import sign
|
||||||
from npbackup.__version__ import IS_LEGACY
|
from npbackup.__version__ import IS_LEGACY
|
||||||
|
|
||||||
|
@ -366,7 +371,16 @@ def compile(
|
||||||
npbackup_executable = os.path.join(
|
npbackup_executable = os.path.join(
|
||||||
compiled_output_dir, "npbackup-{}.exe".format(build_type)
|
compiled_output_dir, "npbackup-{}.exe".format(build_type)
|
||||||
)
|
)
|
||||||
if os.path.isfile(ev_cert_data):
|
if SIGN_EXTERNALY:
|
||||||
|
print(f"Signing with external signer {EXTERNAL_SIGNER}")
|
||||||
|
cmd = f"{EXTERNAL_SIGNER} --executable {npbackup_executable}"
|
||||||
|
print(cmd)
|
||||||
|
exit_code, output = command_runner(cmd, shell=True)
|
||||||
|
if exit_code != 0:
|
||||||
|
print(f"ERROR: Could not sign: {output}")
|
||||||
|
errors = True
|
||||||
|
elif os.path.isfile(ev_cert_data):
|
||||||
|
print(f"Signing with interal signer {ev_cert_data}")
|
||||||
sign(
|
sign(
|
||||||
executable=npbackup_executable,
|
executable=npbackup_executable,
|
||||||
arch=arch,
|
arch=arch,
|
||||||
|
@ -374,7 +388,7 @@ def compile(
|
||||||
dry_run=args.dry_run,
|
dry_run=args.dry_run,
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
print("ERROR: Cannot sign windows executable without EV certificate data")
|
print(f"ERROR: Cannot sign windows executable: {SIGN_EXTERNALY} {ev_cert_data}")
|
||||||
errors = True
|
errors = True
|
||||||
|
|
||||||
if not onefile:
|
if not onefile:
|
||||||
|
|
Loading…
Add table
Reference in a new issue