File obs-server-2.9-0020-api-Make-api-log-directory-configurable.patch of Package obs-server
From 5ff966ae89f963e470bd997834622743e8001902 Mon Sep 17 00:00:00 2001
From: Oleg Girko <ol@infoserver.lv>
Date: Sun, 17 Jul 2016 01:01:31 +0100
Subject: [PATCH] [api] Make api log directory configurable.
This change adds OBS_API_LOG_DIR configuration parameter
to Makefile.include that specifies directory where api (and webui)
logs will be written.
Some distributions (like Fedora) have giudelines stating that
logs should be written in /var/log directory.
Signed-off-by: Oleg Girko <ol@infoserver.lv>
---
Makefile.include | 1 +
src/api/Makefile | 8 ++++++++
2 files changed, 9 insertions(+)
diff --git a/Makefile.include b/Makefile.include
index 26c01dd91b..588a56114a 100644
--- a/Makefile.include
+++ b/Makefile.include
@@ -8,6 +8,7 @@ OBS_BACKEND_DATA_DIR=/srv/obs
OBS_BACKEND_LOG_DIR=$(OBS_BACKEND_DATA_DIR)/log
OBS_DOCUMENT_ROOT=/srv/www/obs
OBS_API_PREFIX=$(OBS_DOCUMENT_ROOT)/api
+OBS_API_LOG_DIR=$(OBS_API_PREFIX)/log
OBS_APIDOCS_PREFIX=$(OBS_DOCUMENT_ROOT)/docs
OBS_FILLUP_DIR=/var/adm/fillup-templates
OBS_FILLUP_FILE=sysconfig.obs-server
diff --git a/src/api/Makefile b/src/api/Makefile
index 7919497b71..fed226f6d9 100644
--- a/src/api/Makefile
+++ b/src/api/Makefile
@@ -6,6 +6,14 @@ OBS_API_LOGS := access.log backend_access.log delayed_job.log error.log lasteven
all:
install: prepare_dirs prepare_rake docs config log_files build
+ifneq ($(OBS_API_LOG_DIR),$(OBS_API_PREFIX)/log)
+ $(INSTALL) -d -m 755 $(DESTDIR)$(OBS_API_LOG_DIR)
+ test -n "`ls -A $(DESTDIR)$(OBS_API_PREFIX)/log`" && \
+ mv $(DESTDIR)$(OBS_API_PREFIX)/log/* \
+ $(DESTDIR)$(OBS_API_LOG_DIR) || :
+ rmdir $(DESTDIR)$(OBS_API_PREFIX)/log
+ ln -s $(OBS_API_LOG_DIR) $(DESTDIR)$(OBS_API_PREFIX)/log
+endif
prepare_dirs:
$(INSTALL) -d -m 755 $(DESTDIR)$(OBS_API_PREFIX)
--
2.20.1