Centralize variable substitution

A bunch of places need to edit files to incorporate the configured paths
i.e. bindir, sbindir etc. Move this logic into a common file.

Create arc_summary by copying arc_summary[23] as appropriate at build
time instead of install time.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Arvind Sankar <nivedita@alum.mit.edu>
Closes #10559
This commit is contained in:
Arvind Sankar
2020-07-11 19:35:58 -04:00
committed by Brian Behlendorf
parent bdb518c13a
commit 38e2e9ce83
38 changed files with 156 additions and 289 deletions
+1
View File
@@ -0,0 +1 @@
arc_summary
+6 -7
View File
@@ -1,4 +1,7 @@
transform = $(program_transform_name)
bin_SCRIPTS = arc_summary
CLEANFILES = arc_summary
EXTRA_DIST = arc_summary2 arc_summary3
if USING_PYTHON_2
SCRIPT = arc_summary2
@@ -6,9 +9,5 @@ else
SCRIPT = arc_summary3
endif
dist_bin_SCRIPTS = $(SCRIPT)
install-exec-hook:
before=$$(echo $(SCRIPT) | sed '$(transform)'); \
after=$$(echo arc_summary | sed '$(transform)'); \
mv "$(DESTDIR)$(bindir)/$$before" "$(DESTDIR)$(bindir)/$$after"
arc_summary: $(SCRIPT)
cp $< $@
+1
View File
@@ -0,0 +1 @@
arcstat
+4 -12
View File
@@ -1,13 +1,5 @@
dist_bin_SCRIPTS = arcstat
include $(top_srcdir)/config/Substfiles.am
#
# The arcstat script is compatible with both Python 2.6 and 3.4.
# As such the python 3 shebang can be replaced at install time when
# targeting a python 2 system. This allows us to maintain a single
# version of the source.
#
if USING_PYTHON_2
install-exec-hook:
$(SED) ${ac_inplace} -e 's|^#!/usr/bin/env python3|#!/usr/bin/env python2|' \
$(DESTDIR)$(bindir)/arcstat
endif
bin_SCRIPTS = arcstat
SUBSTFILES += $(bin_SCRIPTS)
@@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/env @PYTHON_SHEBANG@
#
# Print out ZFS ARC Statistics exported via kstat(1)
# For a definition of fields, or usage, use arcstat -v
+1
View File
@@ -0,0 +1 @@
dbufstat
+4 -12
View File
@@ -1,13 +1,5 @@
dist_bin_SCRIPTS = dbufstat
include $(top_srcdir)/config/Substfiles.am
#
# The dbufstat script is compatible with both Python 2.6 and 3.4.
# As such the python 3 shebang can be replaced at install time when
# targeting a python 2 system. This allows us to maintain a single
# version of the source.
#
if USING_PYTHON_2
install-exec-hook:
$(SED) ${ac_inplace} -e 's|^#!/usr/bin/env python3|#!/usr/bin/env python2|' \
$(DESTDIR)$(bindir)/dbufstat
endif
bin_SCRIPTS = dbufstat
SUBSTFILES += $(bin_SCRIPTS)
@@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/env @PYTHON_SHEBANG@
#
# Print out statistics for all cached dmu buffers. This information
# is available through the dbufs kstat and may be post-processed as
+3 -9
View File
@@ -1,8 +1,7 @@
include $(top_srcdir)/config/Rules.am
include $(top_srcdir)/config/Substfiles.am
EXTRA_DIST = \
README \
history_event-zfs-list-cacher.sh.in
EXTRA_DIST += README
zedconfdir = $(sysconfdir)/zfs/zed.d
@@ -29,12 +28,7 @@ dist_zedexec_SCRIPTS = \
nodist_zedexec_SCRIPTS = history_event-zfs-list-cacher.sh
$(nodist_zedexec_SCRIPTS): %: %.in
-$(SED) -e 's,@bindir\@,$(bindir),g' \
-e 's,@runstatedir\@,$(runstatedir),g' \
-e 's,@sbindir\@,$(sbindir),g' \
-e 's,@sysconfdir\@,$(sysconfdir),g' \
$< >'$@'
SUBSTFILES += $(nodist_zedexec_SCRIPTS)
zedconfdefaults = \
all-syslog.sh \