Gentoo Archives: gentoo-dev

From: Jaco Kroon <jaco@××××××.za>
To: gentoo-dev@l.g.o, "Michał Górny" <mgorny@g.o>
Subject: Re: [gentoo-dev] [PATCH v4 12/19] user.eclass: Support getting & setting comment field
Date: Wed, 12 Jun 2019 07:08:18
Message-Id: 32aecad6-5408-e99b-a7ef-e2e63a5fccc5@uls.co.za
In Reply to: [gentoo-dev] [PATCH v4 12/19] user.eclass: Support getting & setting comment field by "Michał Górny"
1 Hi,
2
3
4 > + # update the comment
5 > + case ${CHOST} in
6 > + *-freebsd*|*-dragonfly*)
7 > + pw usermod "${euser}" -c "${ecomment}" && return 0
8 > + [[ $? == 8 ]] && eerror "${euser} is in use, cannot update comment"
9 > + eerror "There was an error when attempting to update the comment for ${euser}"
10 > + eerror "Please update it manually on your system:"
11 > + eerror "\t pw usermod \"${euser}\" -c \"${ecomment}\""
12 > + ;;
13 > +
14 > + *)
15 > + usermod -c "${ecomment}" "${euser}" && return 0
16 > + [[ $? == 8 ]] && eerror "${euser} is in use, cannot update comment"
17 > + eerror "There was an error when attempting to update the comment for ${euser}"
18 > + eerror "Please update it manually on your system (as root):"
19 > + eerror "\t usermod -c \"${ecomment}\" \"${euser}\""
20 > + ;;
21 > + esac
22 > +}
23 > +
24 > fi
25
26
27 Those error messages are duplicate and can move to after the case.
28
29 You should probably also explicitly return with an error if the case
30 drops through.
31
32 Kind Regards,
33 Jaco