diff options
author | Arvind Sankar <[email protected]> | 2020-07-11 19:35:58 -0400 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2020-07-14 17:33:44 -0700 |
commit | 38e2e9ce8327284b2d516874308300aa96102fe9 (patch) | |
tree | 0761f7f696e4da7888a0c99ffb3a91a63ecefdd4 /cmd | |
parent | bdb518c13abb9eca8d6f8f1d9e2096dc5163a9e7 (diff) |
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 <[email protected]>
Signed-off-by: Arvind Sankar <[email protected]>
Closes #10559
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/arc_summary/.gitignore | 1 | ||||
-rw-r--r-- | cmd/arc_summary/Makefile.am | 13 | ||||
-rw-r--r-- | cmd/arcstat/.gitignore | 1 | ||||
-rw-r--r-- | cmd/arcstat/Makefile.am | 16 | ||||
-rwxr-xr-x | cmd/arcstat/arcstat.in (renamed from cmd/arcstat/arcstat) | 2 | ||||
-rw-r--r-- | cmd/dbufstat/.gitignore | 1 | ||||
-rw-r--r-- | cmd/dbufstat/Makefile.am | 16 | ||||
-rwxr-xr-x | cmd/dbufstat/dbufstat.in (renamed from cmd/dbufstat/dbufstat) | 2 | ||||
-rw-r--r-- | cmd/zed/zed.d/Makefile.am | 12 |
9 files changed, 22 insertions, 42 deletions
diff --git a/cmd/arc_summary/.gitignore b/cmd/arc_summary/.gitignore new file mode 100644 index 000000000..50ba15f03 --- /dev/null +++ b/cmd/arc_summary/.gitignore @@ -0,0 +1 @@ +arc_summary diff --git a/cmd/arc_summary/Makefile.am b/cmd/arc_summary/Makefile.am index ee758006e..1a26c2c19 100644 --- a/cmd/arc_summary/Makefile.am +++ b/cmd/arc_summary/Makefile.am @@ -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 $< $@ diff --git a/cmd/arcstat/.gitignore b/cmd/arcstat/.gitignore new file mode 100644 index 000000000..6d6cd1ab7 --- /dev/null +++ b/cmd/arcstat/.gitignore @@ -0,0 +1 @@ +arcstat diff --git a/cmd/arcstat/Makefile.am b/cmd/arcstat/Makefile.am index a0728f9ce..d1ba989a0 100644 --- a/cmd/arcstat/Makefile.am +++ b/cmd/arcstat/Makefile.am @@ -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) diff --git a/cmd/arcstat/arcstat b/cmd/arcstat/arcstat.in index 5ce7e755c..b230e4b85 100755 --- a/cmd/arcstat/arcstat +++ b/cmd/arcstat/arcstat.in @@ -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 diff --git a/cmd/dbufstat/.gitignore b/cmd/dbufstat/.gitignore new file mode 100644 index 000000000..2c2e913ce --- /dev/null +++ b/cmd/dbufstat/.gitignore @@ -0,0 +1 @@ +dbufstat diff --git a/cmd/dbufstat/Makefile.am b/cmd/dbufstat/Makefile.am index f3b7ed809..e672a01a4 100644 --- a/cmd/dbufstat/Makefile.am +++ b/cmd/dbufstat/Makefile.am @@ -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) diff --git a/cmd/dbufstat/dbufstat b/cmd/dbufstat/dbufstat.in index 4a57d8113..95749bd80 100755 --- a/cmd/dbufstat/dbufstat +++ b/cmd/dbufstat/dbufstat.in @@ -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 diff --git a/cmd/zed/zed.d/Makefile.am b/cmd/zed/zed.d/Makefile.am index 5cf51e4fd..8b2d0c200 100644 --- a/cmd/zed/zed.d/Makefile.am +++ b/cmd/zed/zed.d/Makefile.am @@ -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 \ |