--- Makefile.orig	2024-10-29 18:07:10 UTC
+++ Makefile
@@ -1,7 +1,7 @@ confdir = /etc
 prefix = /usr/local
 datadir = $(prefix)/share
 confdir = /etc
-rubylibdir = $(shell ruby -rrbconfig -e "puts RbConfig::CONFIG['sitelibdir']")
+rubylibdir = $(shell %%PREFIX%%/bin/ruby -rrbconfig -e "puts RbConfig::CONFIG['sitelibdir']")
 rundir = /var/run
 bindir = /usr/bin
 
@@ -36,22 +36,33 @@ install-puppetdb-termini:
 
 
 install-puppetdb-termini:
-	install -Dm 0644 puppet/util/puppetdb.rb "$(DESTDIR)$(rubylibdir)/puppet/util/puppetdb.rb"
-	install -Dm 0644 puppet/util/puppetdb/command_names.rb "$(DESTDIR)$(rubylibdir)/puppet/util/puppetdb/command_names.rb"
-	install -Dm 0644 puppet/util/puppetdb/config.rb "$(DESTDIR)$(rubylibdir)/puppet/util/puppetdb/config.rb"
-	install -Dm 0644 puppet/util/puppetdb/atom.rb "$(DESTDIR)$(rubylibdir)/puppet/util/puppetdb/atom.rb"
-	install -Dm 0644 puppet/util/puppetdb/http.rb "$(DESTDIR)$(rubylibdir)/puppet/util/puppetdb/http.rb"
-	install -Dm 0644 puppet/util/puppetdb/char_encoding.rb "$(DESTDIR)$(rubylibdir)/puppet/util/puppetdb/char_encoding.rb"
-	install -Dm 0644 puppet/util/puppetdb/command.rb "$(DESTDIR)$(rubylibdir)/puppet/util/puppetdb/command.rb"
-	install -Dm 0644 puppet/face/node/status.rb "$(DESTDIR)$(rubylibdir)/puppet/face/node/status.rb"
-	install -Dm 0644 puppet/face/node/deactivate.rb "$(DESTDIR)$(rubylibdir)/puppet/face/node/deactivate.rb"
-	install -Dm 0644 puppet/functions/puppetdb_query.rb "$(DESTDIR)$(rubylibdir)/puppet/functions/puppetdb_query.rb"
-	install -Dm 0644 puppet/reports/puppetdb.rb "$(DESTDIR)$(rubylibdir)/puppet/reports/puppetdb.rb"
-	install -Dm 0644 puppet/indirector/catalog/puppetdb.rb "$(DESTDIR)$(rubylibdir)/puppet/indirector/catalog/puppetdb.rb"
-	install -Dm 0644 puppet/indirector/facts/puppetdb.rb "$(DESTDIR)$(rubylibdir)/puppet/indirector/facts/puppetdb.rb"
-	install -Dm 0644 puppet/indirector/facts/puppetdb_apply.rb "$(DESTDIR)$(rubylibdir)/puppet/indirector/facts/puppetdb_apply.rb"
-	install -Dm 0644 puppet/indirector/resource/puppetdb.rb "$(DESTDIR)$(rubylibdir)/puppet/indirector/resource/puppetdb.rb"
-	install -Dm 0644 puppet/indirector/node/puppetdb.rb "$(DESTDIR)$(rubylibdir)/puppet/indirector/node/puppetdb.rb"
+	install -d -m 0755 "$(DESTDIR)$(rubylibdir)/puppet/face"
+	install -d -m 0755 "$(DESTDIR)$(rubylibdir)/puppet/face/node"
+	install -d -m 0755 "$(DESTDIR)$(rubylibdir)/puppet/functions"
+	install -d -m 0755 "$(DESTDIR)$(rubylibdir)/puppet/indirector"
+	install -d -m 0755 "$(DESTDIR)$(rubylibdir)/puppet/indirector/catalog"
+	install -d -m 0755 "$(DESTDIR)$(rubylibdir)/puppet/indirector/facts"
+	install -d -m 0755 "$(DESTDIR)$(rubylibdir)/puppet/indirector/node"
+	install -d -m 0755 "$(DESTDIR)$(rubylibdir)/puppet/indirector/resource"
+	install -d -m 0755 "$(DESTDIR)$(rubylibdir)/puppet/reports"
+	install -d -m 0755 "$(DESTDIR)$(rubylibdir)/puppet/util"
+	install -d -m 0755 "$(DESTDIR)$(rubylibdir)/puppet/util/puppetdb"
+	install -m 0644 puppet/util/puppetdb.rb "$(DESTDIR)$(rubylibdir)/puppet/util/puppetdb.rb"
+	install -m 0644 puppet/util/puppetdb/command_names.rb "$(DESTDIR)$(rubylibdir)/puppet/util/puppetdb/command_names.rb"
+	install -m 0644 puppet/util/puppetdb/config.rb "$(DESTDIR)$(rubylibdir)/puppet/util/puppetdb/config.rb"
+	install -m 0644 puppet/util/puppetdb/atom.rb "$(DESTDIR)$(rubylibdir)/puppet/util/puppetdb/atom.rb"
+	install -m 0644 puppet/util/puppetdb/http.rb "$(DESTDIR)$(rubylibdir)/puppet/util/puppetdb/http.rb"
+	install -m 0644 puppet/util/puppetdb/char_encoding.rb "$(DESTDIR)$(rubylibdir)/puppet/util/puppetdb/char_encoding.rb"
+	install -m 0644 puppet/util/puppetdb/command.rb "$(DESTDIR)$(rubylibdir)/puppet/util/puppetdb/command.rb"
+	install -m 0644 puppet/face/node/status.rb "$(DESTDIR)$(rubylibdir)/puppet/face/node/status.rb"
+	install -m 0644 puppet/face/node/deactivate.rb "$(DESTDIR)$(rubylibdir)/puppet/face/node/deactivate.rb"
+	install -m 0644 puppet/functions/puppetdb_query.rb "$(DESTDIR)$(rubylibdir)/puppet/functions/puppetdb_query.rb"
+	install -m 0644 puppet/reports/puppetdb.rb "$(DESTDIR)$(rubylibdir)/puppet/reports/puppetdb.rb"
+	install -m 0644 puppet/indirector/catalog/puppetdb.rb "$(DESTDIR)$(rubylibdir)/puppet/indirector/catalog/puppetdb.rb"
+	install -m 0644 puppet/indirector/facts/puppetdb.rb "$(DESTDIR)$(rubylibdir)/puppet/indirector/facts/puppetdb.rb"
+	install -m 0644 puppet/indirector/facts/puppetdb_apply.rb "$(DESTDIR)$(rubylibdir)/puppet/indirector/facts/puppetdb_apply.rb"
+	install -m 0644 puppet/indirector/resource/puppetdb.rb "$(DESTDIR)$(rubylibdir)/puppet/indirector/resource/puppetdb.rb"
+	install -m 0644 puppet/indirector/node/puppetdb.rb "$(DESTDIR)$(rubylibdir)/puppet/indirector/node/puppetdb.rb"
 
 install-rpm-sysv-init: install-rpm-preinst
 	install -d -m 0755 "$(DESTDIR)$(initdir)"
