Menu style for setting trust level
This commit is contained in:
parent
f85e37e49e
commit
df1961e553
|
@ -283,34 +283,25 @@ function gpg_set_trust {
|
|||
fpr=$(gpg --with-colons --fingerprint "$TRUST_ADDRESS" | grep fpr | head -n 1 | awk -F ':' '{print $10}')
|
||||
if [ ${#fpr} -gt 2 ]; then
|
||||
|
||||
data=$(mktemp 2>/dev/null)
|
||||
dialog --backtitle $"Freedombone User Control Panel" \
|
||||
--title $"Trust a PGP/GPG key or website domain" \
|
||||
--radiolist $"Set the trust level for $TRUST_ADDRESS:" 18 70 10 \
|
||||
1 $"I don't know or won't say" off \
|
||||
2 $"I do NOT trust" off \
|
||||
3 $"I trust marginally" on \
|
||||
4 $"I trust fully" off \
|
||||
5 $"I trust ultimately" off 2> "$data"
|
||||
sel=$?
|
||||
case $sel in
|
||||
1) rm -f "$data"
|
||||
return;;
|
||||
255) rm -f "$data"
|
||||
return;;
|
||||
esac
|
||||
TRUST_LEVEL=$(cat "$data")
|
||||
if [ "${TRUST_LEVEL}" -ge 1 ] ; then
|
||||
if [ "${TRUST_LEVEL}" -le 5 ] ; then
|
||||
if echo -e "trust\\n${TRUST_LEVEL}\\ny\\nsave\\n" | gpg --command-fd 0 --edit-key "$fpr"; then
|
||||
gpg --update-trustdb
|
||||
dialog --title $"Trust a PGP/GPG key or website domain" \
|
||||
--backtitle $"Freedombone User Control Panel" \
|
||||
--msgbox $"$TRUST_ADDRESS was set to trust level ${TRUST_LEVEL}" 6 50
|
||||
fi
|
||||
fi
|
||||
W=(1 $"I don't know or won't say"
|
||||
2 $"I do NOT trust"
|
||||
3 $"I trust marginally"
|
||||
4 $"I trust fully"
|
||||
5 $"I trust ultimately")
|
||||
|
||||
# shellcheck disable=SC2068
|
||||
TRUST_LEVEL=$(dialog --backtitle $"Freedombone User Control Panel" --title $"Trust a PGP/GPG key or website domain" --menu $"Set the trust level for $TRUST_ADDRESS:" 18 70 10 "${W[@]}" 3>&2 2>&1 1>&3)
|
||||
|
||||
if [ ! "$TRUST_LEVEL" ]; then
|
||||
return;
|
||||
fi
|
||||
|
||||
if echo -e "trust\\n${TRUST_LEVEL}\\ny\\nsave\\n" | gpg --command-fd 0 --edit-key "$fpr"; then
|
||||
gpg --update-trustdb
|
||||
dialog --title $"Trust a PGP/GPG key or website domain" \
|
||||
--backtitle $"Freedombone User Control Panel" \
|
||||
--msgbox $"$TRUST_ADDRESS was set to trust level ${TRUST_LEVEL}" 6 50
|
||||
fi
|
||||
rm -f "$data"
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue