From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 8CD4F138350 for ; Thu, 13 Feb 2020 16:17:35 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id F0A52E08DB; Thu, 13 Feb 2020 16:17:31 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 95DF2E08CE for ; Thu, 13 Feb 2020 16:17:31 +0000 (UTC) Received: from localhost.localdomain (c142-245.icpnet.pl [85.221.142.245]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: mgorny) by smtp.gentoo.org (Postfix) with ESMTPSA id 92B0834ED48; Thu, 13 Feb 2020 16:17:29 +0000 (UTC) From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= To: gentoo-dev@lists.gentoo.org Cc: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Subject: [gentoo-dev] [PATCH] user.eclass: Use more verbose logging Date: Thu, 13 Feb 2020 17:17:03 +0100 Message-Id: <20200213161703.209776-1-mgorny@gentoo.org> X-Mailer: git-send-email 2.25.0 Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@lists.gentoo.org Reply-to: gentoo-dev@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Archives-Salt: a415376d-2d58-4e9d-8dea-5d6b9836029e X-Archives-Hash: f8ad68806126583fced8684796b47d1e Replace 'einfo' calls with either 'elog' or 'ewarn'. Practically all messages printed by the eclass functions are important, in particular regarding account changes and lack of permissions. Signed-off-by: Michał Górny --- eclass/user.eclass | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/eclass/user.eclass b/eclass/user.eclass index 9bd0b607eab8..a33915e21192 100644 --- a/eclass/user.eclass +++ b/eclass/user.eclass @@ -68,7 +68,7 @@ user_get_nologin() { # exist. enewuser() { if [[ ${EUID} != 0 ]] ; then - einfo "Insufficient privileges to execute ${FUNCNAME[0]}" + ewarn "Insufficient privileges to execute ${FUNCNAME[0]}" return 0 fi _assert_pkg_ebuild_phase ${FUNCNAME} @@ -94,7 +94,7 @@ enewuser() { if [[ -n $(egetent passwd "${euser}") ]] ; then return 0 fi - einfo "Adding user '${euser}' to your system ..." + elog "Adding user '${euser}' to your system ..." # options to pass to useradd local opts=() @@ -122,7 +122,7 @@ enewuser() { [[ ${euid} -ge 101 ]] || die "${FUNCNAME}: no free UID found" fi opts+=( -u ${euid} ) - einfo " - Userid: ${euid}" + elog " - Userid: ${euid}" # handle shell local eshell=$1; shift @@ -138,7 +138,7 @@ enewuser() { else eshell=$(user_get_nologin) fi - einfo " - Shell: ${eshell}" + elog " - Shell: ${eshell}" opts+=( -s "${eshell}" ) # handle homedir @@ -146,7 +146,7 @@ enewuser() { if [[ -z ${ehome} ]] || [[ ${ehome} == "-1" ]] ; then ehome="/dev/null" fi - einfo " - Home: ${ehome}" + elog " - Home: ${ehome}" opts+=( -d "${ehome}" ) # handle groups @@ -171,7 +171,7 @@ enewuser() { opts+=( -G "${exgroups:1}" ) fi fi - einfo " - Groups: ${egroups:-(none)}" + elog " - Groups: ${egroups:-(none)}" # handle extra args if [[ $# -gt 0 ]] ; then @@ -179,7 +179,7 @@ enewuser() { else local comment="added by portage for ${PN}" opts+=( -c "${comment}" ) - einfo " - GECOS: ${comment}" + elog " - GECOS: ${comment}" fi # add the user @@ -204,7 +204,7 @@ enewuser() { esac if [[ -n ${create_home} && ! -e ${ROOT}/${ehome} ]] ; then - einfo " - Creating ${ehome} in ${ROOT}" + elog " - Creating ${ehome} in ${ROOT}" mkdir -p "${ROOT}/${ehome}" chown "${euser}" "${ROOT}/${ehome}" chmod 755 "${ROOT}/${ehome}" @@ -223,7 +223,7 @@ enewuser() { # can not be assigned. enewgroup() { if [[ ${EUID} != 0 ]] ; then - einfo "Insufficient privileges to execute ${FUNCNAME[0]}" + ewarn "Insufficient privileges to execute ${FUNCNAME[0]}" return 0 fi _assert_pkg_ebuild_phase ${FUNCNAME} @@ -248,7 +248,7 @@ enewgroup() { if [[ -n $(egetent group "${egroup}") ]] ; then return 0 fi - einfo "Adding group '${egroup}' to your system ..." + elog "Adding group '${egroup}' to your system ..." # handle gid local egid=$1; shift @@ -266,7 +266,7 @@ enewgroup() { [[ -n ${force_gid} ]] && die "${FUNCNAME}: -F with gid==-1 makes no sense" egid="next available" fi - einfo " - Groupid: ${egid}" + elog " - Groupid: ${egid}" # handle extra if [[ $# -gt 0 ]] ; then @@ -351,12 +351,12 @@ esethome() { return 0 fi - einfo "Updating home for user '${euser}' ..." - einfo " - Home: ${ehome}" + elog "Updating home for user '${euser}' ..." + elog " - Home: ${ehome}" # ensure home directory exists, otherwise update will fail if [[ ! -e ${ROOT}/${ehome} ]] ; then - einfo " - Creating ${ehome} in ${ROOT}" + elog " - Creating ${ehome} in ${ROOT}" mkdir -p "${ROOT}/${ehome}" chown "${euser}" "${ROOT}/${ehome}" chmod 755 "${ROOT}/${ehome}" @@ -420,8 +420,8 @@ esetshell() { return 0 fi - einfo "Updating shell for user '${euser}' ..." - einfo " - Shell: ${eshell}" + elog "Updating shell for user '${euser}' ..." + elog " - Shell: ${eshell}" # update the shell case ${CHOST} in @@ -476,8 +476,8 @@ esetcomment() { return 0 fi - einfo "Updating comment for user '${euser}' ..." - einfo " - Comment: ${ecomment}" + elog "Updating comment for user '${euser}' ..." + elog " - Comment: ${ecomment}" # update the comment case ${CHOST} in @@ -546,8 +546,8 @@ esetgroups() { fi local opts=( -g "${defgroup}" -G "${exgroups}" ) - einfo "Updating groups for user '${euser}' ..." - einfo " - Groups: ${egroups}" + elog "Updating groups for user '${euser}' ..." + elog " - Groups: ${egroups}" # update the group case ${CHOST} in -- 2.25.0