From patchwork Fri Oct 4 05:52:30 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Kim_B=C3=B8ndergaard?= X-Patchwork-Id: 280469 X-Patchwork-Delegate: esben@haabendal.dk Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from hugin.dotsrc.org (hugin.dotsrc.org [IPv6:2001:878:346::102]) by ozlabs.org (Postfix) with ESMTP id 204942C00CB for ; Fri, 4 Oct 2013 15:52:35 +1000 (EST) Received: from hugin.dotsrc.org (localhost [127.0.0.1]) by hugin.dotsrc.org (Postfix) with ESMTP id 278E3447E5 for ; Fri, 4 Oct 2013 07:52:34 +0200 (CEST) X-Original-To: dev@oe-lite.org Delivered-To: dev@oe-lite.org Received: from mail02.prevas.se (mail02.prevas.se [62.95.78.10]) by hugin.dotsrc.org (Postfix) with ESMTPS id 65074447E4 for ; Fri, 4 Oct 2013 07:52:32 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=prevas.dk; i=@prevas.dk; l=1138; q=dns/txt; s=ironport2; t=1380865952; x=1412401952; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=Pkzqd48letVu2KjEKMcWhRZWcDGay9CPS1r9SM1r5sQ=; b=EieSk7QbmsvMHr2fodbTkyjNzfZ8gVddm0tUY7oGSxcwLkvrV1TJYJTO x1TRS37NQYPj/+wEKugKCLVEo54/fh11GVnQgrBziJDuRIcIm/QynprIV M62P5fJHd4jdZeSPo6BoAYZ9XC67Whf7qTIV8jU9VX5z6/dibwFIENMl+ o=; X-IronPort-AV: E=Sophos;i="4.90,1030,1371074400"; d="scan'208";a="3746425" Received: from vmprevas3.prevas.se (HELO smtp.prevas.se) ([172.16.8.103]) by ironport2.prevas.se with ESMTP/TLS/AES128-SHA; 04 Oct 2013 07:52:31 +0200 Received: from localhost (172.16.10.102) by smtp.prevas.se (172.16.8.105) with Microsoft SMTP Server id 14.2.347.0; Fri, 4 Oct 2013 07:52:31 +0200 Received: by localhost (Postfix, from userid 30019) id 1CE916814CE; Fri, 4 Oct 2013 05:52:31 +0000 (UTC) From: =?UTF-8?q?Kim=20B=C3=B8ndergaard?= To: Subject: [PATCH 3/3] sudoers.oeclass: New class able to handle sudoers extensions (/etc/sudoers.d) Date: Fri, 4 Oct 2013 05:52:30 +0000 Message-ID: <5622d8db1f1c556b84d38e3a2820181597c8dfd4.1380865838.git.kibo@prevas.dk> X-Mailer: git-send-email 1.8.4 In-Reply-To: References: MIME-Version: 1.0 Cc: =?UTF-8?q?Kim=20B=C3=B8ndergaard?= X-BeenThere: dev@oe-lite.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: OE-lite development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dev-bounces@oe-lite.org Errors-To: dev-bounces@oe-lite.org --- classes/sudoers.oeclass | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 classes/sudoers.oeclass diff --git a/classes/sudoers.oeclass b/classes/sudoers.oeclass new file mode 100644 index 0000000..ea453e2 --- /dev/null +++ b/classes/sudoers.oeclass @@ -0,0 +1,29 @@ +## @class sudoers +# OE-lite class for handling entries to the sudoers.d directory +# +# Inherit this class to ensure all sudoers.d entries becomes unique. +# Let SUDOERS_FILES list all SRC files going to sudoers.d +# +# Notice: Files in sudoers.d are read in lexical order. If the order is important +# accross recipes this class is too simple +# +# @var SUDOERS_FILES Lists all files going to sudoers.d + +# -*- mode:python; -*- + +SUDOERS_FILES ?= "" + +do_install[postfuncs] += "do_install_sudoers" +do_install_sudoers () { + if [ -z "${SUDOERS_FILES}" ]; then + return + fi + + sudoers_dir=${D}${sysconfdir}/sudoers.d + install -m 0755 -d $sudoers_dir + i=1 + for f in ${SUDOERS_FILES} ; do + install -m 0644 $f $sudoers_dir/${PN}_$i + i=$((i+1)) + done +}