From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 93B6E1381F3 for ; Tue, 10 Sep 2013 10:53:40 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 802CDE0AA7; Tue, 10 Sep 2013 10:53:32 +0000 (UTC) Received: from smtpout.karoo.kcom.com (smtpout.karoo.kcom.com [212.50.160.34]) by pigeon.gentoo.org (Postfix) with ESMTP id 8F397E0A97 for ; Tue, 10 Sep 2013 10:53:31 +0000 (UTC) X-IronPort-AV: E=Sophos;i="4.90,877,1371078000"; d="scan'208";a="35833497" Received: from unknown (HELO rathaus.eclipse.co.uk) ([109.176.228.212]) by smtpout.karoo.kcom.com with ESMTP; 10 Sep 2013 11:53:11 +0100 Date: Tue, 10 Sep 2013 11:57:31 +0100 From: "Steven J. Long" To: gentoo-dev@lists.gentoo.org Subject: [gentoo-dev] Re: [PATCH systemd.eclass] Introduce systemd_install_serviced(). Message-ID: <20130910105731.GA19688@rathaus.eclipse.co.uk> Mail-Followup-To: gentoo-dev@lists.gentoo.org References: <1378638746-8626-1-git-send-email-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 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: <1378638746-8626-1-git-send-email-mgorny@gentoo.org> X-Archives-Salt: 6f8f22fc-2c84-4b29-98e6-e2da550b6950 X-Archives-Hash: 35d3488d0325c87c4764b3e3c3cf6b82 Micha=C5=82 G=C3=B3rny wrote: > +systemd_install_serviced() { > + debug-print-function ${FUNCNAME} "${@}" > + > + local src=3D${1} > + local service=3D${2} > + > + if [[ ! ${service} ]]; then > + [[ ${src} =3D=3D *.conf ]] || die "Source file needs .conf suffix" I would hoist this check to before the if. > + service=3D${src##*/} > + service=3D${service%.conf} > + fi > + # avoid potentially common mistake > + [[ ${service} !=3D *.d ]] || die "Service must not have .d suffix" Double-negative reads badly: [[ $service =3D *.d ]] && die "$FUNCNAME: Service must not have .d suffix" > Nope. 'insinto' sets INSDESTTREE. Due to lack of proper scoping > support in bash, we need to localize this variable to restore previous > 'insinto' scope after leaving the function. Actually the only reason you are able to do that, is *because* bash has pro= per scoping support. --=20 #friendly-coders -- We're friendly, but we're not /that/ friendly ;-)