Browse Source

Premier Commit

Philippe Caseiro 5 years ago
commit
29df294ab5
4 changed files with 331 additions and 0 deletions
  1. 42
    0
      .gitignore
  2. 26
    0
      Makefile
  3. 64
    0
      apps.mk
  4. 199
    0
      eole.mk

+ 42
- 0
.gitignore View File

@@ -0,0 +1,42 @@
1
+# Backup and swap files
2
+*~
3
+*#
4
+*.swp
5
+
6
+### Python code
7
+*.py[cod]
8
+
9
+# C extensions
10
+*.so
11
+
12
+# Packages
13
+*.egg
14
+*.egg-info
15
+dist
16
+build
17
+eggs
18
+parts
19
+bin
20
+var
21
+sdist
22
+develop-eggs
23
+.installed.cfg
24
+lib
25
+lib64
26
+__pycache__
27
+
28
+# Installer logs
29
+pip-log.txt
30
+
31
+# Unit test / coverage reports
32
+.coverage
33
+.tox
34
+nosetests.xml
35
+
36
+# Translations
37
+*.mo
38
+
39
+# Mr Developer
40
+.mr.developer.cfg
41
+.project
42
+.pydevproject

+ 26
- 0
Makefile View File

@@ -0,0 +1,26 @@
1
+################################
2
+# Makefile pour eole-libvirt
3
+################################
4
+
5
+SOURCE=eole-one-frontend
6
+VERSION=0.0.1
7
+EOLE_VERSION=2.4
8
+PKGAPPS=non
9
+#FLASK_MODULE=<APPLICATION>
10
+
11
+################################
12
+# Début de zone à ne pas éditer
13
+################################
14
+
15
+include eole.mk
16
+include apps.mk
17
+
18
+################################
19
+# Fin de zone à ne pas éditer
20
+################################
21
+
22
+# Makefile rules dedicated to application
23
+# if exists
24
+ifneq (, $(strip $(wildcard $(SOURCE).mk)))
25
+include $(SOURCE).mk
26
+endif

+ 64
- 0
apps.mk View File

@@ -0,0 +1,64 @@
1
+# 
2
+# NE PAS EDITER CE FICHIER
3
+#
4
+# Voir Makefile
5
+
6
+
7
+##########################
8
+# Application web envole #
9
+##########################
10
+ifneq (, $(filter oui web, $(PKGAPPS)))
11
+#
12
+# Sanity check
13
+#
14
+ifeq (, $(filter-out X.X, $(strip $(VERSION))))
15
+$(error $$(VERSION) variable has incorrect value '$(VERSION)')
16
+endif
17
+
18
+# Where to store web application files
19
+WEB_PATH				:= $(DESTDIR)/var/www/html
20
+
21
+# Envole
22
+sharenvole_PROG_DIR			:= $(DESTDIR)/usr/share/envole/$(SOURCE)
23
+
24
+src_$(SOURCE)-$(VERSION)_REC_DIR	:= $(WEB_PATH)/$(SOURCE)
25
+src_plugins-$(VERSION)_REC_DIR		:= $(WEB_PATH)/$(SOURCE)/plugin
26
+src_lang-$(VERSION)_REC_DIR		:= $(WEB_PATH)/$(SOURCE)/lang
27
+
28
+endif
29
+
30
+##########################
31
+# Application EOLE flask #
32
+##########################
33
+ifneq (, $(filter flask, $(PKGAPPS)))
34
+#
35
+# Sanity check
36
+#
37
+ifeq (, $(filter-out XXX, $(strip $(FLASK_MODULE))))
38
+$(error $$(FLASK_MODULE) variable has incorrect value '$(FLASK_MODULE)')
39
+endif
40
+
41
+ifeq (, $(strip $(wildcard src/$(FLASK_MODULE).conf)))
42
+$(error missing eoleflask configuration file 'src/$(FLASK_MODULE).conf')
43
+endif
44
+
45
+# Everything is related to mount point
46
+APPS_MOUNT_POINT	:= $(shell sed -ne 's|^"MOUNT_POINT"[[:space:]]*:[[:space:]]*"/\([^"]*\)",|\1|p' \
47
+	src/$(FLASK_MODULE).conf)
48
+
49
+ifeq (, $(strip $(APPS_MOUNT_POINT)))
50
+$(error no "MOUNT_POINT" in eoleflask configuration file 'src/$(FLASK_MODULE).conf')
51
+endif
52
+
53
+# eole-flask configuration
54
+src_DATA_DIR		:= $(DESTDIR)/etc/eole/flask/available
55
+
56
+# Where to store flask application files
57
+FLASK_PATH		:= $(eole_DIR)/flask/$(APPS_MOUNT_POINT)
58
+
59
+# static files
60
+src_$(FLASK_MODULE)_static_REC_DIR	:= $(FLASK_PATH)/static
61
+src_$(FLASK_MODULE)_templates_REC_DIR	:= $(FLASK_PATH)/templates
62
+src_$(FLASK_MODULE)_instance_REC_DIR	:= $(FLASK_PATH)/resources
63
+
64
+endif

+ 199
- 0
eole.mk View File

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