filename,
]
- print('+', shell_join(cmd))
+ print('+', shell_join(cmd), file=sys.stderr)
try:
notes = subprocess.check_output(cmd, stderr=subprocess.PIPE, text=True)
except subprocess.CalledProcessError as e:
for func in (cls.scrape_x86, cls.scrape_elf, cls.scrape_generic):
try:
version = func(filename, opts=opts)
- print(f'Found uname version: {version}')
+ print(f'Found uname version: {version}', file=sys.stderr)
return version
except ValueError as e:
print(str(e))
'-o', output_f,
] # fmt: skip
- print('+', shell_join(cmd))
+ print('+', shell_join(cmd), file=sys.stderr)
subprocess.check_call(cmd)
@staticmethod
tool = find_tool('pesign', opts=opts)
cmd = [tool, '-i', opts.linux, '-S']
- print('+', shell_join(cmd))
+ print('+', shell_join(cmd), file=sys.stderr)
info = subprocess.check_output(cmd, text=True)
return 'No signatures found.' in info
'--output', output_f,
] # fmt: skip
- print('+', shell_join(cmd))
+ print('+', shell_join(cmd), file=sys.stderr)
subprocess.check_call(cmd)
@staticmethod
tool = find_tool('sbverify', opts=opts)
cmd = [tool, '--list', opts.linux]
- print('+', shell_join(cmd))
+ print('+', shell_join(cmd), file=sys.stderr)
info = subprocess.check_output(cmd, text=True)
return 'No signature table present' in info
'--output', output_f,
] # fmt: skip
- print('+', shell_join(cmd))
+ print('+', shell_join(cmd), file=sys.stderr)
subprocess.check_call(cmd)
@staticmethod
return
img = Image.open(filename, formats=['BMP'])
- print(f'Splash image {filename} is {img.width}×{img.height} pixels')
+ print(f'Splash image {filename} is {img.width}×{img.height} pixels', file=sys.stderr)
def check_inputs(opts: UkifyConfig) -> None:
*(f'--phase={phase_path}' for phase_path in itertools.chain.from_iterable(pp_groups)),
]
- print('+', shell_join(cmd))
+ print('+', shell_join(cmd), file=sys.stderr)
subprocess.check_call(cmd)
# PCR signing
extra += [f'--phase={phase_path}' for phase_path in group or ()]
- print('+', shell_join(cmd + extra)) # type: ignore
+ print('+', shell_join(cmd + extra), file=sys.stderr) # type: ignore
pcrsig = subprocess.check_output(cmd + extra, text=True) # type: ignore
pcrsig = json.loads(pcrsig)
pcrsigs += [pcrsig]
signtool.sign(os.fspath(opts.linux), os.fspath(linux), opts=opts)
if opts.uname is None and opts.linux is not None:
- print('Kernel version not specified, starting autodetection 😖.')
+ print('Kernel version not specified, starting autodetection 😖.', file=sys.stderr)
opts.uname = Uname.scrape(opts.linux, opts=opts)
uki = UKI(opts.stub)
if opts.certificate_provider:
cmd += ['--certificate-source', f'provider:{opts.certificate_provider}']
- print('+', shell_join(cmd))
+ print('+', shell_join(cmd), file=sys.stderr)
pcrpkey = subprocess.check_output(cmd)
else:
pcrpkey = Path(opts.pcr_public_keys[0])
if opts.signing_provider:
cmd += ['--private-key-source', f'provider:{opts.signing_provider}']
- print('+', shell_join(cmd))
+ print('+', shell_join(cmd), file=sys.stderr)
pcrpkey = subprocess.check_output(cmd)
hwids = None
if n not in to_import:
continue
- print(f"Copying section '{n}' from '{profile}': {pesection.Misc_VirtualSize} bytes")
+ print(
+ f"Copying section '{n}' from '{profile}': {pesection.Misc_VirtualSize} bytes",
+ file=sys.stderr,
+ )
uki.add_section(
Section.create(n, pesection.get_data(length=pesection.Misc_VirtualSize), measure=True)
)
os.umask(umask := os.umask(0))
os.chmod(opts.output, 0o777 & ~umask)
- print(f'Wrote {"signed" if sign_args_present else "unsigned"} {opts.output}')
+ print(f'Wrote {"signed" if sign_args_present else "unsigned"} {opts.output}', file=sys.stderr)
@contextlib.contextmanager
if namespace.config:
# Config set by the user, use that.
filename = namespace.config
- print(f'Using config file: {filename}')
+ print(f'Using config file: {filename}', file=sys.stderr)
else:
# Try to look for a config file then use the first one found.
for config_dir in DEFAULT_CONFIG_DIRS:
filename = Path(config_dir) / DEFAULT_CONFIG_FILE
if filename.is_file():
# Found a config file, use it.
- print(f'Using found config file: {filename}')
+ print(f'Using found config file: {filename}', file=sys.stderr)
break
else:
# No config file specified or found, nothing to do.
elif opts.linux or opts.initrd:
raise ValueError('--linux=/--initrd= options cannot be used with positional arguments')
else:
- print("Assuming obsolete command line syntax with no verb. Please use 'build'.")
+ print("Assuming obsolete command line syntax with no verb. Please use 'build'.", file=sys.stderr)
if opts.positional:
opts.linux = Path(opts.positional[0])
# If we have initrds from parsing config files, append our positional args at the end