make-rules/puppetmodule.mk
changeset 7130 73b1ef197337
parent 5682 94c0ca64c022
child 7527 352b7a456c30
--- a/make-rules/puppetmodule.mk	Tue Oct 04 14:04:16 2016 +0200
+++ b/make-rules/puppetmodule.mk	Tue Oct 18 15:03:44 2016 -0700
@@ -20,7 +20,7 @@
 #
 
 #
-# Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
 #
 
 # Puppet modules do not have any concept of 'build' so make this a no-op
@@ -30,6 +30,15 @@
 	$(COMPONENT_POST_BUILD_ACTION)
 	$(TOUCH) $@
 
+# Modify ruby scripts containing "#!/usr/bin/env ruby" to
+# use the version-specific ruby path, defined by the $(RUBY_VERSION) macro.
+# Without this change, the mediated ruby version in /usr/bin/ruby
+# will probably be used, which may not match the ruby
+# version supported by the puppet module.
+COMPONENT_POST_INSTALL_ACTION += \
+    cd $(PROTO_DIR); \
+    $(RUBY_SCRIPT_FIX_FUNC);
+
 # install the source into the proto directory
 $(BUILD_DIR)/%/.installed:      $(BUILD_DIR)/%/.built
 	$(COMPONENT_PRE_INSTALL_ACTION)