From patchwork Wed Aug 29 17:24:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Axel Burri X-Patchwork-Id: 10580713 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 09D8E5A4 for ; Wed, 29 Aug 2018 17:31:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E189D2B6A9 for ; Wed, 29 Aug 2018 17:31:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DF8562B831; Wed, 29 Aug 2018 17:31:48 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 625492B8E2 for ; Wed, 29 Aug 2018 17:31:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727676AbeH2V3k (ORCPT ); Wed, 29 Aug 2018 17:29:40 -0400 Received: from tty0.vserver.softronics.ch ([91.214.169.36]:53538 "EHLO fe1.digint.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727508AbeH2V3j (ORCPT ); Wed, 29 Aug 2018 17:29:39 -0400 Received: by fe1.digint.ch (Postfix, from userid 1000) id B6625307EE; Wed, 29 Aug 2018 19:23:14 +0200 (CEST) Received: from mail.tty0.ch (hermes.tty0.ch [172.21.1.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by fe1.digint.ch (Postfix) with ESMTPS id 5FB25307EA for ; Wed, 29 Aug 2018 19:23:14 +0200 (CEST) Received: from ares.tty0.ch (ares.tty0.ch [10.0.1.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.tty0.ch (Postfix) with ESMTPS id 4B00D1DA0F3; Wed, 29 Aug 2018 19:22:43 +0200 (CEST) Received: by ares.tty0.ch (sSMTP sendmail emulation); Wed, 29 Aug 2018 19:24:48 +0200 From: Axel Burri To: linux-btrfs@vger.kernel.org Cc: Axel Burri Subject: [RFC PATCH 5/6] btrfs-progs: Makefile: move progs_splitcmd variable to Makefile.install_setcap Date: Wed, 29 Aug 2018 19:24:08 +0200 Message-Id: <20180829172409.18064-6-axel@tty0.ch> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20180829172409.18064-1-axel@tty0.ch> References: <20180829172409.18064-1-axel@tty0.ch> Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Axel Burri --- Makefile | 17 ++++------------- Makefile.install_setcap | 2 ++ splitcmd-gen.sh | 17 ++++++++++++++--- 3 files changed, 20 insertions(+), 16 deletions(-) diff --git a/Makefile b/Makefile index acf5a677..3f16434c 100644 --- a/Makefile +++ b/Makefile @@ -232,22 +232,13 @@ progs_install = progs_build = endif -# split-command executables, generated by splitcmd-gen.sh -progs_splitcmd = btrfs-send \ - btrfs-receive \ - btrfs-subvolume-list \ - btrfs-subvolume-show \ - btrfs-subvolume-snapshot \ - btrfs-subvolume-delete \ - btrfs-filesystem-usage \ - btrfs-qgroup-destroy - -progs_install_splitcmd = $(progs_splitcmd) +# defines "progs_splitcmd" as well as "btrfs_*_fcaps" variables +# used by "install-splitcmd-setcap-%" below +include Makefile.install_setcap INSTALL_SETCAP_FLAGS = -m710 -gbtrfs -# defines btrfs_*_caps; used by "install-splitcmd-setcap-%" below -include Makefile.install_setcap +progs_install_splitcmd = $(progs_splitcmd) # external libs required by various binaries; for btrfs-foo, # specify btrfs_foo_libs = ; see $($(subst...)) rules below diff --git a/Makefile.install_setcap b/Makefile.install_setcap index 7705db74..e1efb686 100644 --- a/Makefile.install_setcap +++ b/Makefile.install_setcap @@ -1,5 +1,7 @@ # capabilities(7) for splitcmd executables +progs_splitcmd = btrfs-subvolume-show btrfs-subvolume-list btrfs-subvolume-snapshot btrfs-subvolume-delete btrfs-send btrfs-receive btrfs-filesystem-usage btrfs-qgroup-destroy + btrfs_subvolume_show_fcaps = "cap_sys_admin,cap_fowner,cap_dac_read_search" btrfs_subvolume_list_fcaps = "cap_sys_admin,cap_fowner,cap_dac_read_search" btrfs_subvolume_snapshot_fcaps = "cap_sys_admin,cap_fowner,cap_dac_override,cap_dac_read_search" diff --git a/splitcmd-gen.sh b/splitcmd-gen.sh index d34c5cbd..7492594f 100755 --- a/splitcmd-gen.sh +++ b/splitcmd-gen.sh @@ -36,12 +36,14 @@ function gen_splitcmd { -e "s|@BTRFS_SPLITCMD_ENTRY@|${entry}|g" \ splitcmd.c.in >> $dest - echo "${name//-/_}_fcaps = \"${caps}\"" >> $makefile_out + splitcmd_list="${splitcmd_list} ${name}"; + setcap_lines="${setcap_lines}\n${name//-/_}_fcaps = \"${caps}\"" } -echo "generating: ${makefile_out}" -echo -e "# capabilities(7) for splitcmd executables\n" > $makefile_out +# +# generate c-files +# gen_splitcmd "btrfs-subvolume-show" \ "cmds-subvolume.c" "cmd_subvol_show" \ "cap_sys_admin,cap_fowner,cap_dac_read_search" @@ -73,3 +75,12 @@ gen_splitcmd "btrfs-filesystem-usage" \ gen_splitcmd "btrfs-qgroup-destroy" \ "cmds-qgroup.c" "cmd_qgroup_destroy" \ "cap_sys_admin,cap_dac_override" + + +# +# generate Makefile includes +# +echo "generating: ${makefile_out}" +echo -e "# capabilities(7) for splitcmd executables" > $makefile_out +echo -e "\nprogs_splitcmd =$splitcmd_list" >> $makefile_out +echo -e "${setcap_lines}" >> $makefile_out