4066,7 → 4066,8 |
-U|--fullname) |
# -U accepts an optional argument, 0, to make an anonymous signature |
# --fullname accepts no argument |
if [[ $2 ]]; then # With argument, special handling |
if [[ $1 = '-U' ]]; then # -U always provides an argument |
if [[ -n $2 ]]; then # With argument, special handling |
if [[ $2 != '0' ]]; then |
error "Use '-U0' to make an anonymous contact sheet or '-u \"My Name\"'" |
error " to sign as My Name. Got -U$2" |
4073,11 → 4074,17 |
exit $EX_USAGE |
fi |
anonymous_mode=1 |
fi |
shift |
else # No argument, default handling (try to guess real name) |
user=$(grep ^$(id -un): /etc/passwd | cut -d':' -f5 |sed 's/,.*//g') |
username=$(id -un) |
if type -p getent >/dev/null ; then |
user=$(getent passwd "$username" | cut -d':' -f5 |sed 's/,.*//g') |
else |
user=$(grep "^$username:" /etc/passwd | cut -d':' -f5 |sed 's/,.*//g') |
fi |
if [[ -z $user ]]; then |
user=$(id -un) |
user=$username |
error "No fullname found, falling back to default ($user)" |
fi |
fi |