diff --git a/src/pesign-rpmbuild-helper.in b/src/pesign-rpmbuild-helper.in index 9dee56e..30d5441 100644 --- a/src/pesign-rpmbuild-helper.in +++ b/src/pesign-rpmbuild-helper.in @@ -169,6 +169,14 @@ main() { return 0 fi + local inplace=0 || : + if [[ -n "${input[*]}" ]] && [[ -z "${output[*]}" ]] \ + || [[ "${input[1]}" = "${output[1]}" ]]; then + inplace=1 + output[0]=-o + output[1]="$(mktemp -u pesign-XXXXXXX.efi)" + fi + USERNAME="${USERNAME:-$(id -un)}" local socket="" || : @@ -235,6 +243,11 @@ main() { if [[ "${#output[@]}" -eq 2 ]] ; then error_on_empty "${output[1]}" fi + + if [[ "$inplace" -eq 1 ]] ; then + chmod 644 "${output[1]}" + mv "${output[1]}" "${input[1]}" + fi } main "${@}"