Eolisation d'un serveur Mariadb (Serveur unique ou Grappe) / Eole Mariadb server integration (Cluster or standalone)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

eole.mk 6.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  1. #
  2. # NE PAS EDITER CE FICHIER
  3. #
  4. # Utiliser <appli>.mk à inclure à la fin de Makefile
  5. #################
  6. # Sanity checks #
  7. #################
  8. ifeq (, $(DESTDIR))
  9. $(warning $$(DESTDIR) is empty, installation will be done in /)
  10. endif
  11. ifeq (, $(filter-out XXX-XXX, $(strip $(SOURCE))))
  12. $(error $$(SOURCE) variable has incorrect value '$(SOURCE)')
  13. endif
  14. ifeq (, $(filter-out 2.X, $(strip $(EOLE_VERSION))))
  15. $(error $$(EOLE_VERSION) variable has incorrect value '$(EOLE_VERSION)')
  16. endif
  17. ifeq (, $(filter-out 2.X.Y, $(strip $(EOLE_RELEASE))))
  18. $(error $$(EOLE_RELEASE) variable has incorrect value '$(EOLE_RELEASE)')
  19. endif
  20. #########################
  21. # Variables definitions #
  22. #########################
  23. INSTALL := install
  24. INSTALL_DATA := install -m 644
  25. INSTALL_PROGRAM := install -m 755
  26. INSTALL_DIRECTORY := install -m 755 -d
  27. INSTALL_RECURSIVE := cp -dr --no-preserve=ownership
  28. # Standard path
  29. bin_PROG_DIR := $(DESTDIR)/usr/bin
  30. sbin_PROG_DIR := $(DESTDIR)/usr/sbin
  31. man8_DATA_DIR := $(DESTDIR)/usr/share/man/fr.UTF-8/man8
  32. # Base
  33. eole_DIR := $(DESTDIR)/usr/share/eole
  34. ifeq ($(strip $(EOLE_VERSION)), 2.3)
  35. diagnose_PROG_DIR := $(eole_DIR)/diagnose/module
  36. else
  37. diagnose_PROG_DIR := $(eole_DIR)/diagnose/
  38. endif
  39. # Creole
  40. creole_DIR := $(eole_DIR)/creole
  41. dicos_DATA_DIR := $(creole_DIR)/dicos
  42. tmpl_DATA_DIR := $(creole_DIR)/distrib
  43. preservice_PROG_DIR := $(eole_DIR)/preservice
  44. pretemplate_PROG_DIR := $(eole_DIR)/pretemplate
  45. posttemplate_PROG_DIR := $(eole_DIR)/posttemplate
  46. postservice_PROG_DIR := $(eole_DIR)/postservice
  47. ifeq ($(strip $(EOLE_VERSION)), 2.3)
  48. firewall_DATA_DIR := $(eole_DIR)/firewall
  49. endif
  50. bacula_restore_DATA_DIR := $(eole_DIR)/bacula/restore
  51. bareos_restore_DATA_DIR := $(eole_DIR)/bareos/restore
  52. bacula_fichier_DATA_DIR := $(DESTDIR)/etc/bacula/baculafichiers.d
  53. bareos_fichier_DATA_DIR := $(DESTDIR)/etc/bareos/bareosfichiers.d
  54. ifeq ($(strip $(EOLE_VERSION)), 2.3)
  55. schedule_pre_PROG_DIR := $(eole_DIR)/schedule/pre
  56. schedule_post_PROG_DIR := $(eole_DIR)/schedule/post
  57. else
  58. schedule_scripts_PROG_DIR := $(eole_DIR)/schedule/scripts
  59. endif
  60. extra_REC_DIR := $(creole_DIR)/extra
  61. # Zéphir
  62. zephir_DATA_DIR := $(DESTDIR)/usr/share/zephir
  63. zephir_configs_DATA_DIR := $(zephir_DATA_DIR)/monitor/configs
  64. zephir_srv_DATA_DIR := $(zephir_configs_DATA_DIR)/services
  65. zephir_scripts_PROG_DIR := $(zephir_DATA_DIR)/scripts
  66. # SSO
  67. sso_DATA_DIR := $(DESTDIR)/usr/share/sso
  68. sso_filtres_DATA_DIR := $(sso_DATA_DIR)/app_filters
  69. sso_user-info_DATA_DIR := $(sso_DATA_DIR)/user_infos
  70. # EAD
  71. ead_DATA_DIR := $(DESTDIR)/usr/share/ead2/backend/config
  72. ead_actions_DATA_DIR := $(ead_DATA_DIR)/actions
  73. ead_perms_DATA_DIR := $(ead_DATA_DIR)/perms
  74. ead_roles_DATA_DIR := $(ead_DATA_DIR)/roles
  75. # Program libraries goes under /usr/lib/<PROGRAM>/
  76. lib_$(SOURCE)_DATA_DIR := $(DESTDIR)/usr/lib/$(SOURCE)
  77. # Scripts Eole
  78. scripts_PROG_DIR := $(eole_DIR)/sbin
  79. lib_eole_DATA_DIR := $(DESTDIR)/usr/lib/eole
  80. # LDAP
  81. ldap_passwords_DATA_DIR := $(eole_DIR)/annuaire/password_files
  82. # LXC
  83. lxc_DATA_DIR := $(eole_DIR)/lxc
  84. lxc_fstab_DATA_DIR := $(lxc_DATA_DIR)/fstab
  85. lxc_hosts_DATA_DIR := $(lxc_DATA_DIR)/hosts
  86. # SQL
  87. sql_DATA_DIR := $(eole_DIR)/mysql/$(SOURCE)
  88. sql_gen_DATA_DIR := $(sql_DATA_DIR)/gen
  89. sql_updates_DATA_DIR := $(sql_DATA_DIR)/updates
  90. sql_conf_gen_DATA_DIR := $(eole_DIR)/applications/gen
  91. sql_conf_passwords_DATA_DIR := $(eole_DIR)/applications/passwords
  92. sql_conf_updates_DATA_DIR := $(eole_DIR)/applications/updates/$(SOURCE)
  93. # EoleDB sql directory
  94. db_DIR := $(eole_DIR)/db
  95. db_gen_DATA_DIR := $(eole_DIR)/db/$(SOURCE)/gen
  96. db_updates_DATA_DIR := $(eole_DIR)/db/$(SOURCE)/updates
  97. # Certifs
  98. certs_DATA_DIR := $(eole_DIR)/certs
  99. # Logrotate
  100. logrotate_DATA_DIR := $(DESTDIR)/etc/logrotate.d
  101. # Cron
  102. cron_PROG_DIR := $(DESTDIR)/etc/cron.daily
  103. # Python modules
  104. ifneq ($(DESTDIR),)
  105. PYTHON_OPTS := --root $(DESTDIR)
  106. endif
  107. # Translation
  108. TRANSLATION_SRC := translation
  109. TRANSLATION_DEST := $(DESTDIR)/usr/share/locale
  110. PO_FILES = $(wildcard $(TRANSLATION_SRC)/*/*.po)
  111. MO_FOLDERS = $(addprefix $(TRANSLATION_DEST), $(addsuffix LC_MESSAGES,$(subst $(TRANSLATION_SRC),,$(dir $(PO_FILES)))))
  112. #############################################
  113. # Common directories and files installation #
  114. #############################################
  115. all:
  116. $(MO_FOLDERS):
  117. $(INSTALL_DIRECTORY) $@
  118. $(PO_FILES): $(MO_FOLDERS)
  119. msgfmt -o $(TRANSLATION_DEST)$(subst $(TRANSLATION_SRC),,$(addsuffix LC_MESSAGES,$(dir $@)))/$(notdir $(@:.po=.mo)) $@
  120. install-lang: $(PO_FILES)
  121. install:: install-dirs install-files install-lang
  122. # $1 = command to run
  123. # $2 = source directory
  124. # $3 = destination directory
  125. define fc_install_file
  126. if [ -d $2 ]; then \
  127. for file in `ls -1 $2/`; do \
  128. $1 $2/$$file $3 || true; \
  129. done; \
  130. fi
  131. endef
  132. ##
  133. ## Directory creation
  134. ##
  135. # use % to catch local name in $*
  136. # data, program and recursive directory require a corresponding
  137. # directory in local sources
  138. %_DATA_DIR %_PROG_DIR %REC_DIR:
  139. test ! -d $(subst _,/,$*) || $(INSTALL_DIRECTORY) $($@)
  140. # Create the directory referenced by the variable without a local one.
  141. %_DIR:
  142. @: # do nothing
  143. ##
  144. ## Install files present directly under data, program and recursive directories
  145. ##
  146. # $* : name of variable
  147. # $($*): value of variable
  148. %-instdata:
  149. $(call fc_install_file, $(INSTALL_DATA), $(subst _,/,$(subst _DATA_DIR,,$*)), $($*))
  150. %-instprog:
  151. $(call fc_install_file, $(INSTALL_PROGRAM), $(subst _,/,$(subst _PROG_DIR,,$*)), $($*))
  152. %-instrec:
  153. $(call fc_install_file, $(INSTALL_RECURSIVE), $(subst _,/,$(subst _REC_DIR,,$*)), $($*))
  154. # Use second expansion as variables may be created in included
  155. # Makefiles
  156. .SECONDEXPANSION:
  157. # List of all directories
  158. installdirs_LIST = $(foreach V, $(filter %_DIR, $(.VARIABLES)), \
  159. $(if $(filter file, $(origin $(V))), \
  160. $(V)))
  161. # List of data directories
  162. installdata_LIST = $(filter %_DATA_DIR, $(installdirs_LIST))
  163. # List of program directories
  164. installprog_LIST = $(filter %_PROG_DIR, $(installdirs_LIST))
  165. # List of recursive directories
  166. installrec_LIST = $(filter %_REC_DIR, $(installdirs_LIST))
  167. # Expand directories to create as dependency
  168. # Use double-colon to permit user to define additionnal install-dirs
  169. install-dirs:: $$(installdirs_LIST)
  170. # Expand files to install as dependency
  171. # Use double-colon to permit user to define additionnal install-files
  172. install-files:: install-data-files install-prog-files install-rec-dirs
  173. install-data-files: $$(patsubst %,%-instdata,$$(installdata_LIST))
  174. install-prog-files: $$(patsubst %,%-instprog,$$(installprog_LIST))
  175. install-rec-dirs: $$(patsubst %,%-instrec,$$(installrec_LIST))
  176. # Installation of python modules
  177. ifeq ($(shell test -f setup.py && echo 0), 0)
  178. install-files::
  179. python setup.py install --no-compile --install-layout=deb $(PYTHON_OPTS)
  180. endif
  181. .PHONY: install install-dirs install-files install-data-files install-prog-files install-rec-dirs