File obs-server-2.10-0010-dist-Use-configuration-variables-instead-of-hardcode.patch of Package obs-server

From d435c296f2c90ce30443c9ef837640f52931a086 Mon Sep 17 00:00:00 2001
From: Oleg Girko <ol@infoserver.lv>
Date: Tue, 28 Jun 2016 16:39:50 +0100
Subject: [PATCH] [dist] Use configuration variables instead of hardcoded
 paths.

This change introduces BINDIR and SBINDIR configuration variables
that are used instead of hardcoded "/usr/bin" and "/usr/sbin"
paths to install user utilities, system utilities and init scripts.

Signed-off-by: Oleg Girko <ol@infoserver.lv>
---
 Makefile.include |  5 ++++-
 dist/Makefile    | 14 +++++++-------
 2 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/Makefile.include b/Makefile.include
index a4278248bd..4c1a246715 100644
--- a/Makefile.include
+++ b/Makefile.include
@@ -1,4 +1,7 @@
-INSTALL=/usr/bin/install
+BINDIR=/usr/bin
+SBINDIR=/usr/sbin
+
+INSTALL=$(BINDIR)/install
 OBS_BACKEND_PREFIX=/usr/lib/obs/server
 OBS_BACKEND_DATA_DIR=/srv/obs
 OBS_DOCUMENT_ROOT=/srv/www/obs
diff --git a/dist/Makefile b/dist/Makefile
index 3c378251c7..ef2c779e51 100644
--- a/dist/Makefile
+++ b/dist/Makefile
@@ -45,7 +45,7 @@ install_systemd_services: system_dirs
 	    $(SYSTEMD_SERVICE_FILES_WITHOUT_LINK:%=$(DESTDIR)$(UNITDIR)%.service)
 
 install_project_update: system_dirs
-	$(INSTALL) -m 0755 obs_project_update $(DESTDIR)/usr/sbin/obs_project_update
+	$(INSTALL) -m 0755 obs_project_update $(DESTDIR)$(SBINDIR)/obs_project_update
 
 
 install_logrotate: system_dirs
@@ -67,13 +67,13 @@ install_slp: system_dirs
 	$(INSTALL) -m 644 obs.repo_server.reg $(DESTDIR)/etc/slp.reg.d/
 
 install_obs_bin: system_dirs
-	$(foreach script,$(OBS_BIN_SCRIPTS),$(shell $(INSTALL) -m 755 $(script) $(DESTDIR)/usr/bin/$(script)) )
-	$(foreach script,$(OBS_SBIN_SCRIPTS),$(shell $(INSTALL) -m 755 $(script) $(DESTDIR)/usr/sbin/$(script)) )
+	$(foreach script,$(OBS_BIN_SCRIPTS),$(shell $(INSTALL) -m 755 $(script) $(DESTDIR)$(BINDIR)/$(script)) )
+	$(foreach script,$(OBS_SBIN_SCRIPTS),$(shell $(INSTALL) -m 755 $(script) $(DESTDIR)$(SBINDIR)/$(script)) )
 	sed -i \
 	    -e 's|/srv/obs/log|$(OBS_BACKEND_LOG_DIR)|g' \
 	    -e 's|/srv/obs|$(OBS_BACKEND_DATA_DIR)|g' \
-	    $(OBS_BIN_SCRIPTS:%=$(DESTDIR)/usr/bin/%) \
-	    $(OBS_SBIN_SCRIPTS:%=$(DESTDIR)/usr/sbin/%)
+	    $(OBS_BIN_SCRIPTS:%=$(DESTDIR)$(BINDIR)/%) \
+	    $(OBS_SBIN_SCRIPTS:%=$(DESTDIR)$(SBINDIR)/%)
 
 install_crontabs:
 	$(INSTALL) -m 644 cleanup_scm_cache.cron $(DESTDIR)/etc/cron.d/cleanup_scm_cache
@@ -87,8 +87,8 @@ system_dirs:
 	$(INSTALL) -d -m 755 $(DESTDIR)/etc/logrotate.d/
 	$(INSTALL) -d -m 755 $(DESTDIR)/etc/slp.reg.d/
 	$(INSTALL) -d -m 755 $(DESTDIR)/etc/cron.d/
-	$(INSTALL) -d -m 755 $(DESTDIR)/usr/bin/
-	$(INSTALL) -d -m 755 $(DESTDIR)/usr/sbin/
+	$(INSTALL) -d -m 755 $(DESTDIR)$(BINDIR)/
+	$(INSTALL) -d -m 755 $(DESTDIR)$(SBINDIR)/
 	$(INSTALL) -d -m 755 $(DESTDIR)$(FILLUPDIR)
 	$(INSTALL) -d -m 755 $(DESTDIR)/usr/lib/obs/tests/appliance
 	$(INSTALL) -d -m 755 $(DESTDIR)$(UNITDIR)
-- 
2.31.1