@@ -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 = <list of libs>; see $($(subst...)) rules below
@@ -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"
@@ -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
Signed-off-by: Axel Burri <axel@tty0.ch> --- Makefile | 17 ++++------------- Makefile.install_setcap | 2 ++ splitcmd-gen.sh | 17 ++++++++++++++--- 3 files changed, 20 insertions(+), 16 deletions(-)