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 E59F8138334 for ; Thu, 9 Aug 2018 15:20:04 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id CA7FDE09FE; Thu, 9 Aug 2018 15:16:18 +0000 (UTC) Received: from smtp.gentoo.org (dev.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 70FACE09DF for ; Thu, 9 Aug 2018 15:16:16 +0000 (UTC) Received: from localhost.localdomain (d202-252.icpnet.pl [109.173.202.252]) (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 083D5335C71; Thu, 9 Aug 2018 15:16:13 +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 v2 5/8] www-apps/postfixadmin: Replace path_exists with inline logic Date: Thu, 9 Aug 2018 17:15:59 +0200 Message-Id: <20180809151602.11147-6-mgorny@gentoo.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180809151602.11147-1-mgorny@gentoo.org> References: <20180809151602.11147-1-mgorny@gentoo.org> 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-Archives-Salt: 755ab384-61aa-4a10-8a06-afd20c3b1b38 X-Archives-Hash: 382a470d3fbdd01d2c9b8070f65bd10b Replace the call to path_exists with local filename expansion. While at it, also kill the ugly ls-abuse in favor of using the results of earlier expansion. --- www-apps/postfixadmin/postfixadmin-3.1.ebuild | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/www-apps/postfixadmin/postfixadmin-3.1.ebuild b/www-apps/postfixadmin/postfixadmin-3.1.ebuild index 3e69bc6b6573..5cb58aab877a 100644 --- a/www-apps/postfixadmin/postfixadmin-3.1.ebuild +++ b/www-apps/postfixadmin/postfixadmin-3.1.ebuild @@ -3,7 +3,7 @@ EAPI="6" -inherit eutils user webapp +inherit user webapp DESCRIPTION="Web Based Management tool for Postfix style virtual domains and users" HOMEPAGE="http://postfixadmin.sourceforge.net" @@ -89,10 +89,12 @@ pkg_postinst() { pkg_postrm() { # Make sure we don't leave broken vacation.pl symlink find -L "${ROOT}"/var/spool/vacation/ -type l -delete - if [[ ! -e "${ROOT}"/var/spool/vacation/vacation.pl ]] && - path_exists "${ROOT}"/var/spool/vacation/vacation.pl-*; then - ln -s $(LC_ALL=C ls -1 /var/spool/vacation/vacation.pl-* | tail -n1) \ - "${ROOT}"/var/spool/vacation/vacation.pl || die + local shopt_save=$(shopt -p nullglob) + shopt -s nullglob + local vacation=( "${ROOT}"/var/spool/vacation/vacation.pl-* ) + ${shopt_save} + if [[ ! -e "${ROOT}"/var/spool/vacation/vacation.pl && -n ${vacation[@]} ]]; then + ln -s "${vacation[-1]}" "${ROOT}"/var/spool/vacation/vacation.pl || die ewarn "/var/spool/vacation/vacation.pl was updated to point on most" ewarn "recent verion, but please, do your own checks" fi -- 2.18.0