mirror of
https://github.com/armbian/build
synced 2025-09-24 19:47:06 +07:00
Fix gpg signing when sudo unavailable. (#3100)
Signed-off-by: Vyacheslav Bocharov <devel@lexina.in>
This commit is contained in:
@@ -825,8 +825,13 @@ create_image()
|
||||
cd ${DESTIMG}
|
||||
if [[ -n $GPG_PASS ]]; then
|
||||
display_alert "GPG signing" "${version}.img${compression_type}" "info"
|
||||
[[ -n ${SUDO_USER} ]] && sudo chown -R ${SUDO_USER}:${SUDO_USER} "${DESTIMG}"/
|
||||
echo "${GPG_PASS}" | sudo -H -u ${SUDO_USER} bash -c "gpg --passphrase-fd 0 --armor --detach-sign --pinentry-mode loopback --batch --yes ${DESTIMG}/${version}.img${compression_type}" || exit 1
|
||||
if [[ -n $SUDO_USER ]]; then
|
||||
sudo chown -R ${SUDO_USER}:${SUDO_USER} "${DESTIMG}"/
|
||||
SUDO_PREFIX="sudo -H -u ${SUDO_USER}"
|
||||
else
|
||||
SUDO_PREFIX=""
|
||||
fi
|
||||
echo "${GPG_PASS}" | $SUDO_PREFIX bash -c "gpg --passphrase-fd 0 --armor --detach-sign --pinentry-mode loopback --batch --yes ${DESTIMG}/${version}.img${compression_type}" || exit 1
|
||||
else
|
||||
display_alert "GPG signing skipped - no GPG_PASS" "${version}.img" "wrn"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user